Detailed Description

This object represents any Markup Language (ML) tag such as html, sml, xml etc.

Inheritance diagram for Wrench.MLElement:
Wrench.LanguageElement

Public Member Functions

virtual void SetTag (string tag)
 Sets the tag of this element. More...
 
virtual TagHandler GetHandler ()
 Gets the handler which determines how this element and it's properties are used. More...
 
virtual void ResetVariable (string name)
 Reloads the content of variables if it's name matches the given one. More...
 
virtual void ResetAllVariables ()
 Re-resolves all variable tags. This is used when the language is changed. More...
 
virtual void OnChildrenLoaded ()
 Called when this elements children are fully loaded. More...
 
override string ToString ()
 

Public Attributes

string Tag
 The raw tag as a string. e.g. "div","span" etc in html. More...
 

Protected Member Functions

void ReadTag (MLLexer lexer)
 Reads a tag from the given lexer. Note that this does not read it's children or closing tag. More...
 
void ReadContent (MLLexer lexer, bool innerElement, bool literal)
 Reads the children for this tag from a lexer. More...
 
virtual MLVariableElement CreateVariableElement ()
 Called from within this element to create a variable element. Variable elements holds the resolved value of a . More...
 
virtual MLTextElement CreateTextElement ()
 Called from within this element to create a raw text element. More...
 
virtual MLElement CreateTagElement (MLLexer lexer)
 Called from within this element to generate a new tag element. More...
 
virtual string GetVariableValue (string variable)
 Called from within this element when it parses an attempts to resolve a . More...
 

Protected Attributes

bool SelfClosing
 True if this tag closes itself and doesn't need an end ("/div" for example) tag. More...
 
Dictionary< string, string > Properties =new Dictionary<string,string>()
 The set of attributes on this tag. An attribute is e.g. style="display:none;". More...
 

Properties

string this[string property] [get, set]
 Gets or sets the named attribute of this tag. An attribute is e.g. style="display:none;". More...
 

Member Function Documentation

virtual MLElement Wrench.MLElement.CreateTagElement ( MLLexer  lexer)
inlineprotectedvirtual

Called from within this element to generate a new tag element.

Reimplemented in Wrench.LanguageElement.

virtual MLTextElement Wrench.MLElement.CreateTextElement ( )
inlineprotectedvirtual

Called from within this element to create a raw text element.

virtual MLVariableElement Wrench.MLElement.CreateVariableElement ( )
inlineprotectedvirtual

Called from within this element to create a variable element. Variable elements holds the resolved value of a .

virtual TagHandler Wrench.MLElement.GetHandler ( )
inlinevirtual

Gets the handler which determines how this element and it's properties are used.

Returns
A tag handler which manages this element.

Reimplemented in Wrench.LanguageElement.

virtual string Wrench.MLElement.GetVariableValue ( string  variable)
inlineprotectedvirtual

Called from within this element when it parses an attempts to resolve a .

virtual void Wrench.MLElement.OnChildrenLoaded ( )
inlinevirtual

Called when this elements children are fully loaded.

void Wrench.MLElement.ReadContent ( MLLexer  lexer,
bool  innerElement,
bool  literal 
)
inlineprotected

Reads the children for this tag from a lexer.

Parameters
lexer
innerElementTrue if we're looking for the closing tag of this element to exit. If its found, this method safely returns. Unbalanced tags will otherwise throw an exception.
literalLiteral is true if the content should be read 'as is', ignoring any tags.
void Wrench.MLElement.ReadTag ( MLLexer  lexer)
inlineprotected

Reads a tag from the given lexer. Note that this does not read it's children or closing tag.

Parameters
lexerThe lexer the tag should be read from.
virtual void Wrench.MLElement.ResetAllVariables ( )
inlinevirtual

Re-resolves all variable tags. This is used when the language is changed.

virtual void Wrench.MLElement.ResetVariable ( string  name)
inlinevirtual

Reloads the content of variables if it's name matches the given one.

Parameters
nameThe name of the variable to reset.
virtual void Wrench.MLElement.SetTag ( string  tag)
inlinevirtual

Sets the tag of this element.

Reimplemented in Wrench.LanguageElement.

override string Wrench.MLElement.ToString ( )
inline

Member Data Documentation

Dictionary<string,string> Wrench.MLElement.Properties =new Dictionary<string,string>()
protected

The set of attributes on this tag. An attribute is e.g. style="display:none;".

bool Wrench.MLElement.SelfClosing
protected

True if this tag closes itself and doesn't need an end ("/div" for example) tag.

string Wrench.MLElement.Tag

The raw tag as a string. e.g. "div","span" etc in html.

Property Documentation

string Wrench.MLElement.this[string property]
getset

Gets or sets the named attribute of this tag. An attribute is e.g. style="display:none;".

Parameters
propertyThe name of the attribute to get/set.