clang API Documentation
#include <Rewriter.h>
Public Types | |
| typedef BufferTy::const_iterator | iterator |
Public Member Functions | |
| iterator | begin () const |
| iterator | end () const |
| unsigned | size () const |
| raw_ostream & | write (raw_ostream &) const |
| void | RemoveText (unsigned OrigOffset, unsigned Size, bool removeLineIfEmpty=false) |
| RemoveText - Remove the specified text. | |
| void | InsertText (unsigned OrigOffset, StringRef Str, bool InsertAfter=true) |
| void | InsertTextBefore (unsigned OrigOffset, StringRef Str) |
| void | InsertTextAfter (unsigned OrigOffset, StringRef Str) |
| void | ReplaceText (unsigned OrigOffset, unsigned OrigLength, StringRef NewStr) |
Friends | |
| class | Rewriter |
RewriteBuffer - As code is rewritten, SourceBuffer's from the original input with modifications get a new RewriteBuffer associated with them. The RewriteBuffer captures the modified text itself as well as information used to map between SourceLocation's in the original input and offsets in the RewriteBuffer. For example, if text is inserted into the buffer, any locations after the insertion point have to be mapped.
Definition at line 38 of file Rewriter.h.
Definition at line 50 of file Rewriter.h.
| iterator clang::RewriteBuffer::begin | ( | ) | const [inline] |
Definition at line 51 of file Rewriter.h.
References clang::RewriteRope::begin().
Referenced by clang::Rewriter::getRewrittenText(), RemoveText(), and write().
| iterator clang::RewriteBuffer::end | ( | ) | const [inline] |
Definition at line 52 of file Rewriter.h.
References clang::RewriteRope::end().
Referenced by RemoveText(), and write().
| void RewriteBuffer::InsertText | ( | unsigned | OrigOffset, |
| StringRef | Str, | ||
| bool | InsertAfter = true |
||
| ) |
InsertText - Insert some text at the specified point, where the offset in the buffer is specified relative to the original SourceBuffer. The text is inserted after the specified location.
Definition at line 90 of file Rewriter.cpp.
References clang::RewriteRope::insert().
Referenced by clang::Rewriter::IncreaseIndentation(), clang::Rewriter::InsertText(), InsertTextAfter(), clang::Rewriter::InsertTextAfterToken(), and InsertTextBefore().
| void clang::RewriteBuffer::InsertTextAfter | ( | unsigned | OrigOffset, |
| StringRef | Str | ||
| ) | [inline] |
InsertTextAfter - Insert some text at the specified point, where the offset in the buffer is specified relative to the original SourceBuffer. The text is inserted after the specified location.
Definition at line 80 of file Rewriter.h.
References InsertText().
Referenced by clang::html::AddLineNumbers(), clang::html::HighlightRange(), and clang::RewriteMacrosInInput().
| void clang::RewriteBuffer::InsertTextBefore | ( | unsigned | OrigOffset, |
| StringRef | Str | ||
| ) | [inline] |
InsertTextBefore - Insert some text before the specified point, where the offset in the buffer is specified relative to the original SourceBuffer. The text is inserted before the specified location. This is method is the same as InsertText with "InsertAfter == false".
Definition at line 73 of file Rewriter.h.
References InsertText().
Referenced by AddLineNumber(), clang::html::AddLineNumbers(), clang::html::HighlightRange(), and clang::RewriteMacrosInInput().
| void RewriteBuffer::RemoveText | ( | unsigned | OrigOffset, |
| unsigned | Size, | ||
| bool | removeLineIfEmpty = false |
||
| ) |
RemoveText - Remove the specified text.
Definition at line 47 of file Rewriter.cpp.
References begin(), end(), clang::RewriteRope::erase(), isWhitespace(), and clang::RewriteRope::size().
Referenced by clang::Rewriter::RemoveText().
| void RewriteBuffer::ReplaceText | ( | unsigned | OrigOffset, |
| unsigned | OrigLength, | ||
| StringRef | NewStr | ||
| ) |
ReplaceText - This method replaces a range of characters in the input buffer with a new string. This is effectively a combined "remove/insert" operation.
ReplaceText - This method replaces a range of characters in the input buffer with a new string. This is effectively a combined "remove+insert" operation.
Definition at line 106 of file Rewriter.cpp.
References clang::RewriteRope::erase(), and clang::RewriteRope::insert().
Referenced by clang::html::EscapeText(), and clang::Rewriter::ReplaceText().
| unsigned clang::RewriteBuffer::size | ( | ) | const [inline] |
Definition at line 53 of file Rewriter.h.
References clang::RewriteRope::size().
| raw_ostream & RewriteBuffer::write | ( | raw_ostream & | os | ) | const |
Definition at line 26 of file Rewriter.cpp.
References begin(), and end().
Referenced by clang::arcmt::MigrationProcess::applyTransform(), clang::FixItRewriter::WriteFixedFile(), and clang::FixItRewriter::WriteFixedFiles().
friend class Rewriter [friend] |
Definition at line 39 of file Rewriter.h.