Source-highlight Library
srchilite::StringDef Class Reference

represent a string for a language definition file's element More...

#include <stringdef.h>

Collaboration diagram for srchilite::StringDef:

Public Member Functions

 StringDef (const std::string &s, const std::string &o)
 constructs a StringDef and store also the original representation More...
 
 StringDef (const std::string &s, bool doubleQuotes=false)
 constructs a StringDef and record whether it comes from a double quoted string. More...
 
const std::string toString () const
 return the string representation (after preprocessing) More...
 
const std::string toStringOriginal () const
 return the original representation (without any preprocessing); this is useful for printing errors More...
 
bool isDoubleQuoted () const
 whether this comes from a double quoted string More...
 
bool hasBackRef () const
 
void setBackRef (bool b)
 

Static Public Member Functions

static StringDefconcat (const StringDef *s1, const StringDef *s2)
 Given two StringDef produces a new StringDef (keeping properties such as hasBackRef) More...
 

Private Attributes

std::string stringdef
 the actual content
 
std::string orig
 the original representation (without any preprocessing)
 
bool doubleQuotedString
 whether the string was specified with double quotes
 
bool hasBackRef_
 whether this is contains a back reference to a matched subexpression
 

Detailed Description

represent a string for a language definition file's element

Constructor & Destructor Documentation

srchilite::StringDef::StringDef ( const std::string &  s,
const std::string &  o 
)
inline

constructs a StringDef and store also the original representation

Parameters
sthe actual content
othe original representation
srchilite::StringDef::StringDef ( const std::string &  s,
bool  doubleQuotes = false 
)
inline

constructs a StringDef and record whether it comes from a double quoted string.

Parameters
sthe actual content
doubleQuotes

Member Function Documentation

StringDef * srchilite::StringDef::concat ( const StringDef s1,
const StringDef s2 
)
static

Given two StringDef produces a new StringDef (keeping properties such as hasBackRef)

Parameters
s1
s2
Returns
the new StringDef
bool srchilite::StringDef::hasBackRef ( ) const
inline
Returns
whether this has a back reference
bool srchilite::StringDef::isDoubleQuoted ( ) const
inline

whether this comes from a double quoted string

Returns
whether this comes from a double quoted string
void srchilite::StringDef::setBackRef ( bool  b)
inline
Parameters
b
const std::string srchilite::StringDef::toString ( ) const

return the string representation (after preprocessing)

Returns
the string representation
const std::string srchilite::StringDef::toStringOriginal ( ) const
inline

return the original representation (without any preprocessing); this is useful for printing errors

Returns
the original representation

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