EscapedString Class Reference

Back to the index.

Public Member Functions | Static Public Member Functions | List of all members
EscapedString Class Reference

A helper class for escaping strings using C-style escapes. More...

#include <EscapedString.h>

Inheritance diagram for EscapedString:
UnitTestable

Public Member Functions

 EscapedString (const string &str)
 Constructs an EscapedString helper. More...
 
string Generate () const
 Generates an escaped string, from the original string. More...
 
string Decode (bool &success) const
 Decodes an escaped string, from the original string. More...
 

Static Public Member Functions

static void RunUnitTests (int &nSucceeded, int &nFailures)
 
- Static Public Member Functions inherited from UnitTestable
static void RunUnitTests (int &nSucceeded, int &nFailures)
 Runs unit test cases. More...
 

Detailed Description

A helper class for escaping strings using C-style escapes.

TODO: It is ugly to use this for conversions in both directions! Should be fixed some day.

Definition at line 42 of file EscapedString.h.

Constructor & Destructor Documentation

◆ EscapedString()

EscapedString::EscapedString ( const string &  str)

Constructs an EscapedString helper.

Parameters
strA string, either escaped or not escaped.

Definition at line 31 of file EscapedString.cc.

Member Function Documentation

◆ Decode()

string EscapedString::Decode ( bool &  success) const

Decodes an escaped string, from the original string.

The original string should be a C-style escaped string, with or without surrounding quote (") characters.

Parameters
successSet to true if decoding was successful, false if there was an error.
Returns
A decoded (unescaped) string. (Only valid if success was set to true.)

Definition at line 71 of file EscapedString.cc.

Referenced by StateVariable::SetValue().

◆ Generate()

string EscapedString::Generate ( ) const

Generates an escaped string, from the original string.

Returns
an escaped string

Definition at line 37 of file EscapedString.cc.

Referenced by Component::AddChild(), and StateVariable::SerializeValue().

◆ RunUnitTests()

static void EscapedString::RunUnitTests ( int &  nSucceeded,
int &  nFailures 
)
static

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

Generated on Tue Mar 24 2020 14:04:48 for GXemul by doxygen 1.8.17