Sierra Toolkit
Version of the Day
|
Class basic_indent_streambuf implements a output streambuf that performs indentation, blank line removal and outline bracing, sending the result character stream to another output stream buffer. More...
#include <IndentStreambuf.hpp>
Inherits basic_streambuf< Ch, Tr >.
Public Types | |
enum | { MAX_INDENT_LEVEL = 50 } |
enum | Flags { NO_BRACES = 0x00, NO_BLANK_LINES = 0x00, BRACES = 0x01, BLANK_LINES = 0x02 } |
Class Flags ... More... | |
Public Member Functions | |
basic_indent_streambuf (std::basic_streambuf< Ch, Tr > *stream_buffer, size_t indent_size=2, unsigned flags=BRACES) | |
virtual | ~basic_indent_streambuf () |
void | redirect (std::basic_streambuf< Ch, Tr > *stream_buffer) |
Member function redirect sets the destination output stream buffer. | |
std::streambuf * | get_stream_buffer () |
Member function get_stream_buffer returns the current destination output stream buffer. More... | |
void | set_indent_size (size_t indent_size) |
Member function set_indent_size set the number of spaces to write for each indentation level. More... | |
void | set_flags (unsigned flags) |
Member function set_flags enables or disables the BLANK_LINES and BRACES written to the destination stream. More... | |
virtual std::basic_streambuf< Ch, Tr >::int_type | overflow (typename std::basic_streambuf< Ch, Tr >::int_type c) |
Member function overflow interprets a meta-character or writes the specified character to the destination output stream buffer. If the character is a meta-character, the aproprate action is performed. More... | |
virtual std::streamsize | xsputn (const Ch *p, std::streamsize n) |
Member function xsputn interprets the meta-characters or writes the specified characters to the destination output stream buffer. If a character is a meta-character, the aproprate action is performed. More... | |
virtual int | sync () |
Member function sync syncs the destination output stream buffer. More... | |
Class basic_indent_streambuf implements a output streambuf that performs indentation, blank line removal and outline bracing, sending the result character stream to another output stream buffer.
When, the meta-characters PUSH, POP, and LEFT are inserted into the stream buffer, the characters is discarded and the appropriate operation occurs. In the case of PUSH, the next line will indented by an additional m_indentSize spaces and the currently line will end with an open brace ({) is BRACES are enabled. In the case of POP, the next line will be indented by m_indentSize spaces, it may be preceeded by a line containing a properly indented close brace (}). In the case of LEFT, the next line (current line if at the start), will not be indented.
The stream bufer can be created with BRACES and BLANK_LINES enabled or disabled. When BRACE is enabled, then indentation will be produces braces which allows editors to traverse blocks. Blank lines are normally eliminated, but may be allowed if BLANK_LINES is specified.
Definition at line 40 of file IndentStreambuf.hpp.
anonymous enum |
Enumerator | |
---|---|
MAX_INDENT_LEVEL | Maximum indentation level. |
Definition at line 43 of file IndentStreambuf.hpp.
enum stk_classic::basic_indent_streambuf::Flags |
Class Flags ...
Enumerator | |
---|---|
NO_BRACES | No braces on indentation shift. |
NO_BLANK_LINES | No blank line are written. |
BRACES | Braces on indentation shift. |
BLANK_LINES | Blank line are written. |
Definition at line 51 of file IndentStreambuf.hpp.
|
inlineexplicit |
Creates a new basic_indent_streambuf instance.
indent_size | a size_t value of the number of spaces for each indentation level. |
flags | an unsigned int value of Flags to enable or disable BLANK_LINES and BRACES. |
Definition at line 68 of file IndentStreambuf.hpp.
|
inlinevirtual |
Destroys a basic_indent_streambuf instance.
Definition at line 85 of file IndentStreambuf.hpp.
|
inline |
Member function get_stream_buffer returns the current destination output stream buffer.
Definition at line 104 of file IndentStreambuf.hpp.
|
inline |
Member function set_indent_size set the number of spaces to write for each indentation level.
indent_size | a size_t value of the number of spaces for each indentation level. |
Definition at line 116 of file IndentStreambuf.hpp.
|
inline |
Member function set_flags enables or disables the BLANK_LINES and BRACES written to the destination stream.
flags | an unsigned int value of the Flags to enable/disable. |
Definition at line 131 of file IndentStreambuf.hpp.
|
inlinevirtual |
Member function overflow interprets a meta-character or writes the specified character to the destination output stream buffer. If the character is a meta-character, the aproprate action is performed.
c | an int value of the character to write. |
Definition at line 197 of file IndentStreambuf.hpp.
|
inlinevirtual |
Member function xsputn interprets the meta-characters or writes the specified characters to the destination output stream buffer. If a character is a meta-character, the aproprate action is performed.
p | a Ch const pointer to the character string to write. |
n | a std::streamsize value of the number of characters in the string. |
Definition at line 235 of file IndentStreambuf.hpp.
|
inlinevirtual |
Member function sync syncs the destination output stream buffer.
Definition at line 309 of file IndentStreambuf.hpp.