JugiMap Framework
TextSegment Class Reference

The TextSegment class defines a segment of text which can be accessed and displayed separatelly from other texts. More...

#include <jmGuiText.h>

Public Member Functions

int GetId ()
 Returns the identification number of this text segment. More...
 
std::vector< Parameter > & GetParameters ()
 Returns a reference to the vector of stored custom parameter. More...
 
bool Replace (const std::string &_searchedWord, const std::string &newWord)
 Replace the given word *_searchedWord* with the newWord. More...
 
bool Contains (const std::string &_word, bool compareWithOriginalWord=false)
 Returns true if this text segment contain the given *_word*; otherwise it returns false. More...
 

Detailed Description

The TextSegment class defines a segment of text which can be accessed and displayed separatelly from other texts.

Text segments are usually created by parsing texts from text files via special markup codes. In addition to text data, a text segment also stores styling information and custom parameters. Text segments are displayed on screen with GuiTextField widgets.

Member Function Documentation

◆ GetId()

int GetId ( )
inline

Returns the identification number of this text segment.

◆ GetParameters()

std::vector<Parameter>& GetParameters ( )
inline

Returns a reference to the vector of stored custom parameter.

◆ Replace()

bool Replace ( const std::string &  _searchedWord,
const std::string &  newWord 
)

Replace the given word *_searchedWord* with the newWord.

Important! The *_searchedWord* is allways the original word stored in the text segment at creation. When you call replace more times for the same original word, use the original word as *_searchedWord* every time!

If the searched word was found and replaced the function returns true, otherwise it returns false.

◆ Contains()

bool Contains ( const std::string &  _word,
bool  compareWithOriginalWord = false 
)

Returns true if this text segment contain the given *_word*; otherwise it returns false.

The flag compareWithOriginalWord decide if comparing is done with original words or current words. A current word can be different then original if TextSegment::Replace has been used.


The documentation for this class was generated from the following files: