Utility functions for parsing, handling files, allocating memory, etc. (implemented in the core library libwolframe) More...
Classes | |
class | ArrayDoublingAllocator |
Interface for an allocator implemented with the strategy of array doubling. More... | |
class | AsciiCharParser |
Class for parsing ascii character by character from a source in an unicode based encoding. More... | |
class | CharTable |
Character table structure for parseNextToken( std::string&,std::string::const_iterator&, std::string::const_iterator, ...);. More... | |
class | FileLineInfo |
Source line info with filename reference for error messages. More... | |
struct | FileType |
Get the file type. More... | |
class | GreedySmallChunkAllocator |
Interface for an allocator for small chunks without a free. Memory is freed in the destructor of the allocator. More... | |
class | IdentifierTable |
Identifier table structure for parseNextIdentifier( std::string::const_iterator&, std::string::const_iterator, ...);. More... | |
class | PrintFormat |
Structure with info for uniform printing for a type of message (log format as compact one liner, text as multi liner) More... | |
class | SourceLineInfo |
Line information for error messages for parser using STL string iterators as source scanners. More... | |
class | TypedArrayDoublingAllocator |
Interface for an array doubling allocator that allocates only one fixed size type of element. More... | |
class | TypeSignature |
Signature of a type for pointer constraint check (disabled) More... | |
Functions | |
std::string | resolvePath (const std::string &path) |
Remove .. and . from a path. More... | |
std::string | getFileExtension (const std::string &path) |
Get the extension of a file. More... | |
std::string | getFileStem (const std::string &path) |
Get the stem of a file. More... | |
std::string | getCanonicalPath (const std::string &path, const std::string &refPath) |
Get the path 'path' relative to 'refpath' if it is not absolute. More... | |
std::string | getParentPath (const std::string &path, unsigned int levels=1) |
Get the parent path of 'path' (skipping /./ as parent path unlike boost::filesystem does) More... | |
std::string | joinPath (const std::string &path, const std::string &item) |
Join path with an item of the path to a combined path. More... | |
bool | fileExists (const std::string &path) |
Returns true, if the file with path 'path' exists. More... | |
std::string | readSourceFileContent (const std::string &filename) |
Reading the content of a source file as one string in UTF-8 (with implicit conversion of other known unicode character encodings to UTF-8) More... | |
std::string | readBinaryFileContent (const std::string &filename) |
Reading the content of a file as one string without any conversions applied. More... | |
types::PropertyTree | readPropertyTreeFile (const std::string &filename) |
Reading the content of a source file as property tree (with property tree syntax) More... | |
types::PropertyTree | readXmlPropertyTreeFile (const std::string &filename) |
Reading the content of an XML source file as property tree (with property tree syntax) More... | |
types::PropertyTree | readInfoPropertyTreeFile (const std::string &filename) |
Reading the content of an Info format source file as property tree (with property tree syntax) More... | |
void | writeFile (const std::string &filename, const std::string &content) |
Writing a file. More... | |
FileType | getFileType (const std::string &filename) |
const CharTable & | identifierCharTable () |
Get the default identifier character table. More... | |
const CharTable & | emptyCharTable () |
Get an empty character set as table. More... | |
const CharTable & | anyCharTable () |
Get the character set containing all characters as table. More... | |
char | parseNextToken (std::string &tok, std::string::const_iterator &itr, std::string::const_iterator end, const CharTable &operatorTable, const CharTable &alphaTable) |
Parsing the next token in a UTF-8 or Isolatin-1 string that is either. More... | |
char | parseNextToken (std::string &tok, std::string::const_iterator &itr, std::string::const_iterator end, const CharTable &operatorTable) |
See utils::parseNextToken(std::string&,std::string::const_iterator&,std::string::const_iterator,const CharTable&,const CharTable&) More... | |
char | parseNextToken (std::string &tok, std::string::const_iterator &itr, std::string::const_iterator end) |
See utils::parseNextToken(std::string&,std::string::const_iterator&,std::string::const_iterator,const CharTable&,const CharTable&) More... | |
char | gotoNextToken (std::string::const_iterator &itr, std::string::const_iterator end) |
Skip to next token (skip white spaces) More... | |
std::string | parseLine (std::string::const_iterator &si, const std::string::const_iterator &se) |
Parse the rest of the line starting. More... | |
int | parseNextIdentifier (std::string::const_iterator &si, const std::string::const_iterator &se, const IdentifierTable &idtab) |
Parse the next identifier if it is in 'idtab' or goto the next token if not. More... | |
std::pair< std::string, std::string > | parseTokenAssignement (std::string::const_iterator &itr, std::string::const_iterator end, const CharTable &alphaTable) |
Parse a token assignement 'identifier = token'. More... | |
std::pair< std::string, std::string > | parseTokenAssignement (std::string::const_iterator &itr, std::string::const_iterator end) |
Parse a token assignement 'identifier = token' with the standard identifier table. More... | |
std::string | parseNextLine (std::string::const_iterator &itr, std::string::const_iterator end) |
const PrintFormat * | logPrintFormat () |
Get the print format for logger output. More... | |
const PrintFormat * | ptreePrintFormat () |
Get the print format for readable multi line output similar to property tree format. More... | |
std::string | getLogString (const types::Variant &val, std::size_t maxsize=60) |
Get a string to log out of a variant structure with a restriction of the size of the atomic elements. More... | |
SourceLineInfo | getSourceLineInfo (const std::string::const_iterator &start, const std::string::const_iterator &pos) |
Get the source line info by scanning the source parsed from 'start' to 'pos', counting lines and characters inbetween. More... | |
void | splitString (std::vector< std::string > &res, const std::string &inp, const char *splitchr) |
Split the string, ingoring empty parts of the result (susequent split characters treated as one) More... | |
void | splitString (std::vector< std::string > &res, std::string::const_iterator begin, std::string::const_iterator end, const char *splitchr) |
Split the string, ingoring empty parts of the result (susequent split characters treated as one) More... | |
Utility functions for parsing, handling files, allocating memory, etc. (implemented in the core library libwolframe)
const CharTable& _Wolframe::utils::anyCharTable | ( | ) |
Get the character set containing all characters as table.
const CharTable& _Wolframe::utils::emptyCharTable | ( | ) |
Get an empty character set as table.
bool _Wolframe::utils::fileExists | ( | const std::string & | path | ) |
Returns true, if the file with path 'path' exists.
std::string _Wolframe::utils::getCanonicalPath | ( | const std::string & | path, |
const std::string & | refPath | ||
) |
Get the path 'path' relative to 'refpath' if it is not absolute.
[in] | path | relative part of the path or absolute path |
[in] | refPath | absolute part of the path if 'path' is relative |
std::string _Wolframe::utils::getFileExtension | ( | const std::string & | path | ) |
Get the extension of a file.
[in] | path | The path to the file to get the extension from |
std::string _Wolframe::utils::getFileStem | ( | const std::string & | path | ) |
Get the stem of a file.
[in] | path | The path to the file to get the stem from |
FileType _Wolframe::utils::getFileType | ( | const std::string & | filename | ) |
std::string _Wolframe::utils::getLogString | ( | const types::Variant & | val, |
std::size_t | maxsize = 60 |
||
) |
Get a string to log out of a variant structure with a restriction of the size of the atomic elements.
std::string _Wolframe::utils::getParentPath | ( | const std::string & | path, |
unsigned int | levels = 1 |
||
) |
Get the parent path of 'path' (skipping /./ as parent path unlike boost::filesystem does)
[in] | path | the path to get the parent path from |
[in] | levels | how many level (1 = parent, 2 = granparent, etc.) |
SourceLineInfo _Wolframe::utils::getSourceLineInfo | ( | const std::string::const_iterator & | start, |
const std::string::const_iterator & | pos | ||
) |
Get the source line info by scanning the source parsed from 'start' to 'pos', counting lines and characters inbetween.
char _Wolframe::utils::gotoNextToken | ( | std::string::const_iterator & | itr, |
std::string::const_iterator | end | ||
) |
Skip to next token (skip white spaces)
const CharTable& _Wolframe::utils::identifierCharTable | ( | ) |
Get the default identifier character table.
std::string _Wolframe::utils::joinPath | ( | const std::string & | path, |
const std::string & | item | ||
) |
Join path with an item of the path to a combined path.
[in] | path | the main path |
[in] | item | the sub path to join to path |
const PrintFormat* _Wolframe::utils::logPrintFormat | ( | ) |
Get the print format for logger output.
std::string _Wolframe::utils::parseLine | ( | std::string::const_iterator & | si, |
const std::string::const_iterator & | se | ||
) |
Parse the rest of the line starting.
[in,out] | si | start of chunk to parse as input and first character after end of line if found or end of chunk to parse as output |
[in] | se | end of chunk to parse |
int _Wolframe::utils::parseNextIdentifier | ( | std::string::const_iterator & | si, |
const std::string::const_iterator & | se, | ||
const IdentifierTable & | idtab | ||
) |
Parse the next identifier if it is in 'idtab' or goto the next token if not.
[in,out] | si | scanning iterator passed as start of the source to parse and returned as source position after the token parsed if it matches or start of the token not matching if not |
[in] | se | iterator marking the end of the source |
[in] | idtab | identifier table |
std::string _Wolframe::utils::parseNextLine | ( | std::string::const_iterator & | itr, |
std::string::const_iterator | end | ||
) |
[in,out] | itr | scanning iterator passed as start of the source to parse and returned as source position after the expression parsed) |
[in] | end | iterator marking the end of the source |
char _Wolframe::utils::parseNextToken | ( | std::string & | tok, |
std::string::const_iterator & | itr, | ||
std::string::const_iterator | end, | ||
const CharTable & | operatorTable, | ||
const CharTable & | alphaTable | ||
) |
Parsing the next token in a UTF-8 or Isolatin-1 string that is either.
[out] | tok | non operator token parsed |
[in,out] | itr | scanning iterator passed as start of the source to parse and returned as source position after the token parsed) |
[in] | end | iterator marking the end of the source |
[in] | operatorTable | (optional) operator table |
[in] | alphaTable | (optional) token alphabet as character table |
char _Wolframe::utils::parseNextToken | ( | std::string & | tok, |
std::string::const_iterator & | itr, | ||
std::string::const_iterator | end, | ||
const CharTable & | operatorTable | ||
) |
char _Wolframe::utils::parseNextToken | ( | std::string & | tok, |
std::string::const_iterator & | itr, | ||
std::string::const_iterator | end | ||
) |
std::pair<std::string,std::string> _Wolframe::utils::parseTokenAssignement | ( | std::string::const_iterator & | itr, |
std::string::const_iterator | end, | ||
const CharTable & | alphaTable | ||
) |
Parse a token assignement 'identifier = token'.
[in,out] | itr | scanning iterator passed as start of the source to parse and returned as source position after the expression parsed |
[in] | end | iterator marking the end of the source |
[in] | alphaTable | table with characters valid in an identifier |
std::pair<std::string,std::string> _Wolframe::utils::parseTokenAssignement | ( | std::string::const_iterator & | itr, |
std::string::const_iterator | end | ||
) |
Parse a token assignement 'identifier = token' with the standard identifier table.
[in,out] | itr | scanning iterator passed as start of the source to parse and returned as source position after the expression parsed |
[in] | end | iterator marking the end of the source |
const PrintFormat* _Wolframe::utils::ptreePrintFormat | ( | ) |
Get the print format for readable multi line output similar to property tree format.
std::string _Wolframe::utils::readBinaryFileContent | ( | const std::string & | filename | ) |
Reading the content of a file as one string without any conversions applied.
types::PropertyTree _Wolframe::utils::readInfoPropertyTreeFile | ( | const std::string & | filename | ) |
Reading the content of an Info format source file as property tree (with property tree syntax)
types::PropertyTree _Wolframe::utils::readPropertyTreeFile | ( | const std::string & | filename | ) |
Reading the content of a source file as property tree (with property tree syntax)
std::string _Wolframe::utils::readSourceFileContent | ( | const std::string & | filename | ) |
Reading the content of a source file as one string in UTF-8 (with implicit conversion of other known unicode character encodings to UTF-8)
types::PropertyTree _Wolframe::utils::readXmlPropertyTreeFile | ( | const std::string & | filename | ) |
Reading the content of an XML source file as property tree (with property tree syntax)
std::string _Wolframe::utils::resolvePath | ( | const std::string & | path | ) |
Remove .. and . from a path.
[in] | path | Path to process |
void _Wolframe::utils::splitString | ( | std::vector< std::string > & | res, |
const std::string & | inp, | ||
const char * | splitchr | ||
) |
Split the string, ingoring empty parts of the result (susequent split characters treated as one)
[out] | res | result of the split |
[in] | inp | string to split |
[in] | splitchr | set of characters to split with (each of them is one separating character) |
void _Wolframe::utils::splitString | ( | std::vector< std::string > & | res, |
std::string::const_iterator | begin, | ||
std::string::const_iterator | end, | ||
const char * | splitchr | ||
) |
Split the string, ingoring empty parts of the result (susequent split characters treated as one)
[out] | res | result of the split |
[in] | begin | begin input iterator |
[in] | end | end input iterator |
[in] | splitchr | set of characters to split with (each of them is one separating character) |
void _Wolframe::utils::writeFile | ( | const std::string & | filename, |
const std::string & | content | ||
) |
Writing a file.
Copyright © 2014 - Project Wolframe - All Rights Reserved