Crazy Eddie's GUI System  0.8.4
CEGUI::BasicRenderedStringParser Class Reference

Basic RenderedStringParser class that offers support for the following tags: More...

+ Inheritance diagram for CEGUI::BasicRenderedStringParser:
+ Collaboration diagram for CEGUI::BasicRenderedStringParser:

List of all members.

Public Member Functions

 BasicRenderedStringParser ()
 Constructor.
 BasicRenderedStringParser (const String &initial_font, const ColourRect &initial_colours)
 Initialising constructor.
virtual ~BasicRenderedStringParser ()
 Destructor.
void setInitialFontName (const String &font_name)
 set the initial font name to be used on subsequent calls to parse.
void setInitialColours (const ColourRect &colours)
 Set the initial colours to be used on subsequent calls to parse.
const StringgetInitialFontName () const
 Return the name of the initial font used in each parse.
const ColourRectgetInitialColours () const
 Return a ColourRect describing the initial colours used in each parse.
RenderedString parse (const String &input_string, const Font *initial_font, const ColourRect *initial_colours)
 parse a text string and return a RenderedString representation.

Static Public Attributes

static const String ColourTagName
static const String FontTagName
static const String ImageTagName
static const String WindowTagName
static const String VertAlignmentTagName
static const String PaddingTagName
static const String TopPaddingTagName
static const String BottomPaddingTagName
static const String LeftPaddingTagName
static const String RightPaddingTagName
static const String AspectLockTagName
static const String ImageSizeTagName
static const String ImageWidthTagName
static const String ImageHeightTagName
static const String TopAlignedValueName
static const String BottomAlignedValueName
static const String CentreAlignedValueName
static const String StretchAlignedValueName

Protected Types

typedef void(BasicRenderedStringParser::* TagHandler )(RenderedString &, const String &)
 definition of type used for handler functions
typedef std::map< String,
TagHandler,
StringFastLessCompare
TagHandlerMap
 definition of type used to despatch tag handler functions

Protected Member Functions

virtual void appendRenderedText (RenderedString &rs, const String &text) const
 append the text string text to the RenderedString rs.
virtual void processControlString (RenderedString &rs, const String &ctrl_str)
 Process the control string ctrl_str.
virtual void initialiseDefaultState ()
 initialise the default state
void initialiseTagHandlers ()
 initialise tag handlers
void handleColour (RenderedString &rs, const String &value)
 handlers for the various tags supported
void handleFont (RenderedString &rs, const String &value)
void handleImage (RenderedString &rs, const String &value)
void handleWindow (RenderedString &rs, const String &value)
void handleVertAlignment (RenderedString &rs, const String &value)
void handlePadding (RenderedString &rs, const String &value)
void handleTopPadding (RenderedString &rs, const String &value)
void handleBottomPadding (RenderedString &rs, const String &value)
void handleLeftPadding (RenderedString &rs, const String &value)
void handleRightPadding (RenderedString &rs, const String &value)
void handleAspectLock (RenderedString &rs, const String &value)
void handleImageSize (RenderedString &rs, const String &value)
void handleImageWidth (RenderedString &rs, const String &value)
void handleImageHeight (RenderedString &rs, const String &value)

Protected Attributes

String d_initialFontName
 initial font name
ColourRect d_initialColours
 initial colours
Rectf d_padding
 active padding values.
ColourRect d_colours
 active colour values.
String d_fontName
 active font.
VerticalFormatting d_vertAlignment
 active vertical alignment
Sizef d_imageSize
 active image size
bool d_aspectLock
 active 'aspect lock' state
bool d_initialised
 true if handlers have been registered
TagHandlerMap d_tagHandlers
 Collection to map tag names to their handler functions.

Detailed Description

Basic RenderedStringParser class that offers support for the following tags:

  • 'colour' value is a CEGUI colour property value.
  • 'font' value is the name of a font.
  • 'image' value is a CEGUI image property value.
  • 'window' value is the name of a window.
  • 'vert-alignment' value is either top, bottom, centre or stretch.
  • 'padding' value is a CEGUI Rect property value.
  • 'top-padding' value is a float.
  • 'bottom-padding' value is a float.
  • 'left-padding' value is a float.
  • 'right-padding' value is a float.
  • 'image-size' value is a CEGUI size property value.
  • 'image-width' value is a float.
  • 'image-height' value is a float.
  • 'aspect-lock' value is a boolean (NB: this currently has no effect).

Constructor & Destructor Documentation

CEGUI::BasicRenderedStringParser::BasicRenderedStringParser ( const String initial_font,
const ColourRect initial_colours 
)

Initialising constructor.

Parameters:
initial_fontReference to a String holding the name of the initial font to be used.
initial_coloursReference to a ColourRect describing the initial colours to be used.

Member Function Documentation

RenderedString CEGUI::BasicRenderedStringParser::parse ( const String input_string,
const Font initial_font,
const ColourRect initial_colours 
) [virtual]

parse a text string and return a RenderedString representation.

Parameters:
input_stringString object holding the text that is to be parsed.
initial_fontPointer to the initial font to be used for text (0 for system default).
initial_coloursPointer to the initial colours to be used (0 for default).
Returns:
RenderedString object holding the result of the parse operation.

Implements CEGUI::RenderedStringParser.

Set the initial colours to be used on subsequent calls to parse.

Parameters:
coloursColourRect object holding the colours.

set the initial font name to be used on subsequent calls to parse.

Parameters:
font_nameString object holding the name of the font.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends