#include <data_node_format.h>
Public Types | |
typedef ContextT | context_type |
The context type for this class. | |
Static Public Member Functions | |
static void | bind (const FlexLexer *lexer, tree_builder *builder) |
Sets the current builder object for this context. | |
static void | unbind (const FlexLexer *lexer) |
Frees up the internal resources used by the marshaling process for the given lexer. | |
static tree_builder * | builder (const FlexLexer *lexer) |
Gets the current builder object for this context, which must have been previously set up via a call to bind(lexer,builder). | |
static bool | open_node (const FlexLexer *lexer, const std::string &classname, const std::string &nodename) |
See tree_builder::open_node(). | |
static bool | close_node (const FlexLexer *lexer) |
See tree_builder::clode_node(). | |
static bool | add_property (const FlexLexer *lexer, const std::string &key, const std::string &val) |
See tree_builder::add_property(). | |
static size_t | node_depth (const FlexLexer *lexer) |
See tree_builder::node_depth(). | |
static bool | change_node_class (const FlexLexer *lexer, const std::string &newclassname) |
See tree_builder::change_node_class(). | |
static lexer_metadata & | metadata (const FlexLexer *lexer) |
Returns the lexer_metadata for the given lexer, creating one if needed. | |
Classes | |
struct | lexer_metadata |
This is intended for direct access by a lexer associated with this context, and ONLY by such lexers. More... |
It's usage is admitedly a bit strange (indeed, it's whole existance is).
This object sets up a "context channel" where a given FlexLexer can, in a thread-safe manner, communicate data back to a data_tree_builder<NodeType> without knowing the exact NodeType.
For samples see the s11n lexers, under src/node/lex.
All of it's methods, except for builder(), mirror those of a tree_builder object, so see that class for the API docs. For the "mirrored" functions, the object being proxied is that set via builder(). It is intended that only the lexers associated with this context actually use it's API.
Calling the proxied functions when no builder is set has no effect. Calling them with no bind()ed FlexLexer may be fatal.
Definition at line 176 of file data_node_format.h.
|
Sets the current builder object for this context. Pointer ownership does not change by calling this function. This must be carefully marshalled: it must always be set immediately before the matching lexer is used, and unbind(lexer) should be called immediately afterwards to free up the internal marshaling data. Failing to call unbind will mean a resource leak (albeit a small one). Preconditions:
Definition at line 202 of file data_node_format.h. |
|
Gets the current builder object for this context, which must have been previously set up via a call to bind(lexer,builder). Ownership of the returned pointer does not change by calling this function. Definition at line 224 of file data_node_format.h. |
|
Returns the lexer_metadata for the given lexer, creating one if needed. It is assumed that the lexer has been bound via a call to bind(). Definition at line 314 of file data_node_format.h. |