namespace Synopsis
class Buffer

Buffer holds the memory on top of which a parse tree / syntax tree is constructed. Besides giving access to individual characters, it provides the means to register replacements for buffer chunks, such that when the Buffer's write method is executed the new file will contain the modified source.

Public Member functions Summary:
 constructor Buffer(std::streambuf*, const std::string& = std :: string ( "unknown" ))
source code
 unsigned long size() const
references
source code

return the size of the buffer

 char get()
references
source code

report the character at the current position and advance one character

 void unget()
references
source code

undo the last get

 void reset(unsigned long c = 0)
references
source code

reset the current position to position c

 unsigned long position() const
references
source code

report the current position

 char at(unsigned long p) const
references
source code

report the character at position p

 const char* ptr(unsigned long p = 0) const
references
source code

report the pointer at position p

 void replace(const char* from, const char* to, const char* begin, unsigned long length)
references
source code

replace the text between from and to by the text between begin and begin + length

 unsigned long origin(const char*, std::string&) const
source code

Return the origin of the given pointer (filename and line number)

 void write(std::ostream&, const std::string&) const
source code

Write the buffer into the given output stream The first line contains a line directive issuing the input file name; if filename is non-empty, use this to fake another one.

Private Typedefs Summary:
references
source code
Private Structs Summary:
references
source code
Private Member functions Summary:
 long read_line_directive(unsigned long cursor, long line, unsigned long& begin, unsigned long& end) const
references
source code

read a line directive starting at position pos, and return the line number found.

Private Data members Summary:
std::string my_filename
references
source code
std::string my_buffer
references
source code
unsigned long my_cursor
references
source code
references
source code
Public Member functions Details:
 unsigned long size() const
references
source code

return the size of the buffer

 char get()
references
source code

report the character at the current position and advance one character

 void unget()
references
source code

undo the last get

 void reset(unsigned long c = 0)
references
source code

reset the current position to position c

 unsigned long position() const
references
source code

report the current position

 char at(unsigned long p) const
references
source code

report the character at position p

 const char* ptr(unsigned long p = 0) const
references
source code

report the pointer at position p

 void replace(const char* from, const char* to, const char* begin, unsigned long length)
references
source code

replace the text between from and to by the text between begin and begin + length

 unsigned long origin(const char*, std::string&) const
source code

Return the origin of the given pointer (filename and line number)

 void write(std::ostream&, const std::string&) const
source code

Write the buffer into the given output stream The first line contains a line directive issuing the input file name; if filename is non-empty, use this to fake another one.

Private Member functions Details:
 long read_line_directive(unsigned long cursor, long line, unsigned long& begin, unsigned long& end) const
references
source code

read a line directive starting at position pos, and return the line number found. Also report the begin and end of the filename (with respect to the internal buffer). line is the default line number that gets reported on error (in which case begin and end remain unchanged)