40 #ifndef _uidefaultmarkupparser_cpp
41 #define _uidefaultmarkupparser_cpp
43 #include "UI/defaultmarkupparser.h"
44 #include "UI/textlayer.h"
45 #include "UI/screen.h"
46 #include "UI/textureatlas.h"
47 #include "stringtool.h"
60 NameValuePairMap::iterator Colour = Params.find(
"Value");
61 if( Colour != Params.end() ) {
62 if( (*Colour).second.size() < 6 )
return ProcessResult(
false,NULL);
83 NameValuePairMap::iterator FontName = Params.find(
"Name");
84 if( FontName != Params.end() ) {
85 Traits.
CharFont = ParentScreen->
GetFont( (*FontName).second,AtlasName );
111 NameValuePairMap::iterator SpriteName = Params.find(
"Name");
112 if( SpriteName != Params.end() ) {
113 Sprite* NewSprite = ParentScreen->
GetSprite( (*SpriteName).second,AtlasName );
115 ToInsert =
new Character(NewSprite,Layer);
120 NameValuePairMap::iterator SpriteSize = Params.find(
"Size");
121 if( ToInsert && SpriteSize != Params.end() ) {
122 String SizeStr = (*SpriteSize).second;
123 SizeStr.replace( SizeStr.find_first_of(
'x'),1,
" " );
139 {
delete (*TagIt).second; }
145 this->
Tags.insert( std::pair<String,MarkupTag*>( DefaultColourTag::TagName,
new DefaultColourTag() ) );
146 this->
Tags.insert( std::pair<String,MarkupTag*>( DefaultFontTag::TagName,
new DefaultFontTag() ) );
147 this->
Tags.insert( std::pair<String,MarkupTag*>( DefaultSpriteTag::TagName,
new DefaultSpriteTag() ) );
154 {
return "Default"; }
This class implements a character colour changing tag.
virtual Char8 GetMarkupTagStart() const
Gets the ID for the character that marks the start of a markup section.
TagContainer::iterator TagIterator
Iterator type for MarkupTag instances stored by this class.
virtual ProcessResult Process(NameValuePairMap &Params, CharacterTraits &Traits, TextLayer *Layer) const
Processes this tag.
virtual String GetName() const
Gets the name of this parser implementation.
This class implements a character font changing tag.
static const String TagName
The name of this tag as it should appear in markup.
virtual ProcessResult Process(NameValuePairMap &Params, CharacterTraits &Traits, TextLayer *Layer) const
Processes this tag.
FontData * GetFont(const String &FontName, const String &Atlas) const
Gets the specified FontData from an Atlas.
virtual Screen * GetScreen() const
Gets the screen the parent renderable is being rendered on.
This class stores common data for determining the look of a Character.
virtual ~DefaultMarkupParser()
Class destructor.
FontData * CharFont
The font this Character belongs to.
char Char8
A datatype to represent one character.
TagContainer Tags
Map of tags recognized by this parser.
This class creates and encapsultes a character that can be used in text renders.
static const String TagName
The name of this tag as it should appear in markup.
Sprite * GetSprite(const String &SpriteName, const String &Atlas) const
Gets a sprite from an Atlas.
virtual Char8 GetMarkupTagEnd() const
Gets the ID for the character that marks the end of a markup section.
std::pair< Boole, Character * > ProcessResult
An std::pair used to report the result of a MarkupTag being processed any the character it may have g...
virtual void Initialize()
Populates the tag map with the tags recognized by this parser.
ColourValue CharColour
The colour to render this Character as.
The bulk of the engine components go in this namspace.
void SetCustomSize(const Vector2 &Size)
Sets the custom size this character is to be resized to.
static const String TagName
The name of this tag as it should appear in markup.
This class implements a sprite inserting tag.
virtual String GetPrimaryAtlas() const
Gets the currently set primary atlas.
virtual ProcessResult Process(NameValuePairMap &Params, CharacterTraits &Traits, TextLayer *Layer) const
Processes this tag.
DefaultMarkupParser()
Class constructor.
std::map< String, String > NameValuePairMap
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
This class is a helper class for creating UI's. It is responsible for storing and keeping track of al...
Basic class used to describe a portion of a texture to be applied to a Quad.
std::string String
A datatype used to a series of characters.
This is a base class for render layers that render text.