Envision
A visual programming IDE for object-oriented languages
List of all members | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes
FilePersistence::Parser Class Reference

Static Public Member Functions

static bool labelComparator (GenericNode *const node1, GenericNode *const node2)
 This comparator is used to sort children lists by label. More...
 
static GenericNodeload (const char *data, int dataLength, bool lazy, GenericPersistentUnit &persistentUnit)
 
static GenericNodeload (const QString &filename, bool lazy, GenericPersistentUnit &persistentUnit)
 
static void parseLine (GenericNode *node, const char *line, int lineLength)
 
static QList< GenericNode * > save (QTextStream &stream, GenericNode *node, const QStringList &persistentUnitTypes={}, int tabLevel=0)
 Saves the generic node and its children recursively to a text stream. More...
 

Static Public Attributes

static const QString PREFIX_DOUBLE {"D_"}
 
static const QString PREFIX_INTEGER {"I_"}
 
static const QString PREFIX_STRING {"S_"}
 

Static Private Member Functions

static int countTabs (const char *data, int lineStart, int lineEnd)
 
static QString escape (const QString &line)
 
static uchar hexDigitToChar (char d, bool &ok)
 
static int indexOf (const char c, const char *data, int start, int endInclusive)
 
static bool nextHeaderPart (const char *data, int &start, int &endInclusive, int lineEnd)
 
static bool nextNonEmptyLine (const char *data, int dataSize, int &lineStart, int &lineEnd)
 
static QString rawStringToQString (const char *data, int start, int endInclusive)
 
static Model::NodeIdType toId (const char *data, int start, int endInclusive, bool &ok)
 

Static Private Attributes

static constexpr bool SORT_BY_LABEL = true
 If true, sort children by label when writing encoding. More...
 

Member Function Documentation

◆ countTabs()

int FilePersistence::Parser::countTabs ( const char *  data,
int  lineStart,
int  lineEnd 
)
inlinestaticprivate

◆ escape()

QString FilePersistence::Parser::escape ( const QString &  line)
staticprivate

◆ hexDigitToChar()

uchar FilePersistence::Parser::hexDigitToChar ( char  d,
bool &  ok 
)
staticprivate

◆ indexOf()

int FilePersistence::Parser::indexOf ( const char  c,
const char *  data,
int  start,
int  endInclusive 
)
staticprivate

◆ labelComparator()

bool FilePersistence::Parser::labelComparator ( GenericNode *const  node1,
GenericNode *const  node2 
)
static

This comparator is used to sort children lists by label.

◆ load() [1/2]

GenericNode * FilePersistence::Parser::load ( const char *  data,
int  dataLength,
bool  lazy,
GenericPersistentUnit persistentUnit 
)
static

◆ load() [2/2]

GenericNode * FilePersistence::Parser::load ( const QString &  filename,
bool  lazy,
GenericPersistentUnit persistentUnit 
)
static

◆ nextHeaderPart()

bool FilePersistence::Parser::nextHeaderPart ( const char *  data,
int &  start,
int &  endInclusive,
int  lineEnd 
)
staticprivate

◆ nextNonEmptyLine()

bool FilePersistence::Parser::nextNonEmptyLine ( const char *  data,
int  dataSize,
int &  lineStart,
int &  lineEnd 
)
staticprivate

◆ parseLine()

void FilePersistence::Parser::parseLine ( GenericNode node,
const char *  line,
int  lineLength 
)
static

◆ rawStringToQString()

QString FilePersistence::Parser::rawStringToQString ( const char *  data,
int  start,
int  endInclusive 
)
staticprivate

◆ save()

QList< GenericNode * > FilePersistence::Parser::save ( QTextStream &  stream,
GenericNode node,
const QStringList &  persistentUnitTypes = {},
int  tabLevel = 0 
)
static

Saves the generic node and its children recursively to a text stream.

If any persistentUnitTypes are provided, they are saved as new peristent unit reference only and are returned in the output list.

◆ toId()

Model::NodeIdType FilePersistence::Parser::toId ( const char *  data,
int  start,
int  endInclusive,
bool &  ok 
)
staticprivate

Member Data Documentation

◆ PREFIX_DOUBLE

const QString FilePersistence::Parser::PREFIX_DOUBLE {"D_"}
static

◆ PREFIX_INTEGER

const QString FilePersistence::Parser::PREFIX_INTEGER {"I_"}
static

◆ PREFIX_STRING

const QString FilePersistence::Parser::PREFIX_STRING {"S_"}
static

◆ SORT_BY_LABEL

constexpr bool FilePersistence::Parser::SORT_BY_LABEL = true
staticconstexprprivate

If true, sort children by label when writing encoding.

This is to ensure consistency between all methods used to produce Envision encodings.