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
 StringDef (const std::string &s, bool doubleQuotes=false)
 constructs a StringDef and record whether it comes from a double quoted string.
const std::string toString () const
 return the string representation (after preprocessing)
const std::string toStringOriginal () const
 return the original representation (without any preprocessing); this is useful for printing errors
bool isDoubleQuoted () const
 whether this comes from a double quoted string
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).

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

◆ StringDef() [1/2]

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

◆ StringDef() [2/2]

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

◆ concat()

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

◆ hasBackRef()

bool srchilite::StringDef::hasBackRef ( ) const
inline
Returns
whether this has a back reference

◆ isDoubleQuoted()

bool srchilite::StringDef::isDoubleQuoted ( ) const
inline

whether this comes from a double quoted string

Returns
whether this comes from a double quoted string

◆ setBackRef()

void srchilite::StringDef::setBackRef ( bool b)
inline
Parameters
b

◆ toString()

const std::string srchilite::StringDef::toString ( ) const

return the string representation (after preprocessing)

Returns
the string representation

◆ toStringOriginal()

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:
  • /cygdrive/d/a/scallywag/source-highlight/source-highlight-3.1.9-1.x86_64/src/source-highlight-3.1.9/lib/srchilite/stringdef.h
  • /cygdrive/d/a/scallywag/source-highlight/source-highlight-3.1.9-1.x86_64/src/source-highlight-3.1.9/lib/srchilite/stringdef.cpp