From f64c7c7ad9e8eb3c1b203ed5cdd94deb7eeb02f0 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 24 Aug 2010 05:48:19 +0000 Subject: [PATCH] toString method. --- .../core/parser/scanner/AbstractCharArray.java | 12 ++++++++++++ .../core/parser/scanner/InternalFileContent.java | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/AbstractCharArray.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/AbstractCharArray.java index 794ffeb72f7..984b63cdb4b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/AbstractCharArray.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/AbstractCharArray.java @@ -53,4 +53,16 @@ public abstract class AbstractCharArray { * range checks. */ public abstract void arraycopy(int offset, char[] destination, int destinationPos, int length); + + /** + * This method is slow. Use only for debugging. + */ + @Override + public String toString() { + StringBuilder buf = new StringBuilder(); + for (int pos = 0; isValidOffset(pos); pos++) { + buf.append(get(pos)); + } + return buf.toString(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/InternalFileContent.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/InternalFileContent.java index 81eeb4ac38e..ccfacf5ece7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/InternalFileContent.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/InternalFileContent.java @@ -182,4 +182,12 @@ public class InternalFileContent extends FileContent { public void setFoundOnPath(IncludeSearchPathElement isp) { fFoundOnPath= isp; } + + /** + * This method is slow. Use only for debugging. + */ + @Override + public String toString() { + return getSource().toString(); + } }