strusBase
0.17
|
Wrapper to structures needed for atomic counters. More...
Namespaces | |
platform | |
utils | |
Classes | |
class | atomic |
class | AtomicCounter |
class | AtomicFlag |
struct | BitOperations |
struct | bitset_hi_bitmask |
struct | bitset_hi_bitmask< 0 > |
class | bitset |
class | DataRecordFile |
Basic portable file type for collections of equal sized records with random access. More... | |
class | dynamic_bitset |
struct | enable_if |
class | ByteOrder |
class | ByteOrder< uint8_t > |
class | ByteOrder< int8_t > |
class | ByteOrder< uint16_t > |
class | ByteOrder< int16_t > |
class | ByteOrder< uint32_t > |
class | ByteOrder< int32_t > |
class | ByteOrder< uint64_t > |
class | ByteOrder< int64_t > |
class | ByteOrder< float > |
class | ByteOrder< double > |
class | InputStream |
Abstraction of input stream. More... | |
class | local_ptr |
class | LocalErrorBuffer |
Error buffer implementation for a context transforming the error message into an exceptions at the end of its scope. More... | |
struct | numstring_conv |
Inlined version of string to number conversion functions throwing an exception instead of setting an error code on failure. More... | |
class | PeriodicTimerEvent |
Periodic timer event. More... | |
class | ProgramLexem |
Class for a lexem in a domain specific programming language with the following properties. More... | |
class | ProgramLexer |
Class for a lexer used for implementing domain specific languages of strus. More... | |
class | ProgramOptions |
Program options parser. More... | |
class | PseudoRandom |
Pseudo random generator. Fast generator for series of pseudo random numbers where the security is not an issue and the quality of the distribution has not to be guaranteed. More... | |
class | RegexSearch |
Class to search for a regular expression. More... | |
class | RegexSubst |
Class to replace a regular expression by a string with sub-matches as substitute. More... | |
class | shared_ptr |
struct | string_conv |
Inlined version of string conversion functions throwing an exception instead of setting an error code on failure. More... | |
class | BlockAllocator |
class | SymbolTable |
Map of strings to indices not freed till end of table life time. More... | |
class | ThreadId |
struct | is_arithmetic |
struct | is_same |
struct | DefaultDeleter |
class | unique_ptr |
class | unordered_map |
class | DebugTraceMessage |
One item of a debug trace. More... | |
class | DebugTraceContextInterface |
Interface for reporting debug trace messages in a uniform way. More... | |
class | DebugTraceInterface |
Managing interface for reporting debug trace messages in a uniform way. More... | |
class | ErrorBufferInterface |
Interface for reporting and catching errors in modules. More... | |
class | FileLocatorInterface |
Interface for locating resource files and working directory. More... | |
class | NumericVariant |
Atomic type that can hold numeric values of different type. More... | |
class | Reference |
Shared pointer template with non thread-safe reference counting. More... | |
Typedefs | |
typedef uint32_t | float_net_t |
typedef uint64_t | double_net_t |
typedef boost::mutex | mutex |
typedef boost::recursive_mutex | recursive_mutex |
typedef boost::mutex::scoped_lock | scoped_lock |
typedef boost::unique_lock < boost::mutex > | unique_lock |
typedef boost::unique_lock < boost::recursive_mutex > | recursive_unique_lock |
typedef boost::condition_variable | condition_variable |
typedef boost::thread | thread |
Functions | |
void | printIndentMultilineString (std::ostream &out, std::size_t indentsize, const char *descr, ErrorBufferInterface *errorhnd) |
Print a multiline string with indentiation. More... | |
bool | extractStringFromConfigString (std::string &val, std::string &config, const char *key, ErrorBufferInterface *errorhnd) |
bool | extractStringArrayFromConfigString (std::vector< std::string > &val, std::string &config, const char *key, char separator, ErrorBufferInterface *errorhnd) |
bool | extractBooleanFromConfigString (bool &val, std::string &config, const char *key, ErrorBufferInterface *errorhnd) |
bool | extractUIntFromConfigString (unsigned int &val, std::string &config, const char *key, ErrorBufferInterface *errorhnd) |
bool | extractFloatFromConfigString (double &val, std::string &config, const char *key, ErrorBufferInterface *errorhnd) |
void | removeKeysFromConfigString (std::string &config, const char **keys, ErrorBufferInterface *errorhnd) |
bool | addConfigStringItem (std::string &config, const std::string &key, const std::string &value, ErrorBufferInterface *errorhnd) |
std::vector< std::pair < std::string, std::string > > | getAssignmentListItems (const std::string &config, ErrorBufferInterface *errorhnd) |
std::vector< std::pair < std::string, std::string > > | getConfigStringItems (const std::string &config, ErrorBufferInterface *errorhnd) |
std::vector< std::pair < std::string, std::string > > | getSubConfigStringItems (const std::string &configelem, ErrorBufferInterface *errorhnd) |
int | getenv (const std::string &var, std::string &output) |
Read an environment variable value as string. More... | |
int | getenv_list (const std::string &var, char sep, std::vector< std::string > &output) |
Read an environment variable value as array of strings, separated by a separator character. More... | |
char | separatorPathList () |
Separator character used for separating file paths in environment variables. More... | |
int | execv_tostring (const char *filename, const char *const argv[], std::string &output) |
Execution of a command appending the output to a string. More... | |
int | execve_tostring (const char *filename, const char *const argv[], const std::map< std::string, std::string > &env, std::string &output) |
Execution of a command with some environment variables set, appending the output to a string. More... | |
int | readFileSize (const std::string &filename, std::size_t &size) |
Evaluate the size of a file in bytes. More... | |
int | readFile (const std::string &filename, std::string &res) |
Reads the complete content of a file to a string. More... | |
int | readStdin (std::string &res) |
Reads the complete input of stdin to a string. More... | |
int | writeFile (const std::string &filename, const std::string &content) |
Writes a string to a file creating the file if it does not exist. More... | |
int | appendFile (const std::string &filename, const std::string &content) |
Appends a string to a file creating the file if it does not exist. More... | |
int | removeFile (const std::string &filename, bool fail_ifnofexist=false) |
Removes a file. More... | |
int | removeDir (const std::string &dirname, bool fail_ifnofexist=false) |
Removes an empty directory. More... | |
int | removeDirRecursive (const std::string &dirname, bool fail_ifnofexist=false) |
Removes a directory with all its contents. More... | |
int | renameFile (const std::string &old_filename, const std::string &new_filename) |
Moves (renames) a file. More... | |
int | createDir (const std::string &dirname, bool fail_ifexist=true) |
Creates a directory if it does not exist yet. More... | |
int | mkdirp (const std::string &dirname) |
Creates a directory path (mkdir -p) More... | |
int | changeDir (const std::string &dirname) |
Change current directory of the process. More... | |
int | readDirFiles (const std::string &path, const std::string &ext, std::vector< std::string > &res) |
Reads all file names matching to the extension ext of a directory to an array of strings. More... | |
int | readDirSubDirs (const std::string &path, std::vector< std::string > &res) |
Reads all subdirectories of a directory to an array of strings. More... | |
int | readDirItems (const std::string &path, std::vector< std::string > &res) |
Reads all items (directory or file) of a directory to an array of strings. More... | |
int | expandFilePattern (const std::string &pathPattern, std::vector< std::string > &res) |
Get all items matching a file path pattern (with '?' and '*' as substitutes) More... | |
bool | isFile (const std::string &path) |
Check if a file system path points to a file. More... | |
bool | isDir (const std::string &path) |
Check if a file system path points to a directory. More... | |
bool | isRelativePath (const std::string &path) |
Check if a file system path is a path starting with a name and not with a directive referencing the current path './' or the file system root '/'. More... | |
bool | isAbsolutePath (const std::string &path) |
Check if a file system path is a path starting the file system root '/'. More... | |
bool | isExplicitPath (const std::string &path) |
Check if a file path is explicit (relative path or absolute path) More... | |
bool | isTextFile (const std::string &path) |
Check if a file system path points to a file with text content (not binary) More... | |
int | getParentPath (const std::string &path, std::string &dest) |
Get the parent (containing) path of a file or directory. More... | |
int | getAncestorPath (const std::string &path, int level, std::string &dest) |
Get an ancestor (containing) path of a file or directory. More... | |
int | getFileName (const std::string &path, std::string &dest, bool withExtension=true) |
Get the file name without parent path of a file or directory. More... | |
int | getFileExtension (const std::string &path, std::string &ext) |
Get the extension (including '.') of a file or directory. More... | |
char | dirSeparator () |
Get the OS path element separator. More... | |
bool | hasUpdirReference (const std::string &path) |
Return true, if the path contains an upper directory reference '..'. More... | |
std::string | joinFilePath (const std::string &parentpath, const std::string &childpath) |
Join two path with directory separator. More... | |
int | resolveUpdirReferences (std::string &path) |
Resolve upper directory references in a path, e.g. replace "/home/john/../jack" by "/home/jack". More... | |
void | aligned_free (void *ptr) |
void * | aligned_malloc (std::size_t size, std::size_t alignment) |
const char * | numstring_error (NumParseError errcode) |
Convert string conversion error code into an error message string. More... | |
std::runtime_error | numstring_exception (NumParseError errcode) |
Convert string conversion error code into an exception. More... | |
double | doubleFromString (const std::string &numstr, NumParseError &err) |
Parsing a double precision floating point number from an Ascii string. More... | |
double | doubleFromString (const char *numstr, std::size_t numsize, NumParseError &err) |
Parsing a double precision floating point number from an Ascii string. More... | |
int64_t | intFromString (const std::string &numstr, int64_t maxvalue, NumParseError &err) |
Parsing an integer number from an Ascii string. More... | |
int64_t | intFromString (const char *numstr, std::size_t numsize, int64_t maxvalue, NumParseError &err) |
Parsing an integer number from an Ascii string. More... | |
uint64_t | uintFromString (const std::string &numstr, uint64_t maxvalue, NumParseError &err) |
Parsing an unsigned integer number from an Ascii string. More... | |
uint64_t | uintFromString (const char *numstr, std::size_t numsize, uint64_t maxvalue, NumParseError &err) |
Parsing an unsigned integer number from an Ascii string. More... | |
void | sleep (int nofsecs) |
std::runtime_error | stringconv_exception (StringConvError errcode) |
Convert string conversion error code into an exception. More... | |
std::string | tolower (const char *val, StringConvError &err) |
Convert ASCII letters in string to lowercase. More... | |
std::string | tolower (const char *val, std::size_t size, StringConvError &err) |
Convert ASCII letters in string to lowercase. More... | |
std::string | tolower (const std::string &val, StringConvError &err) |
Convert ASCII letters in string to lowercase. More... | |
std::string | trim (const std::string &val, StringConvError &err) |
Trim trailing and heading whitespace and control characters. More... | |
std::string | trim (const char *val, std::size_t size, StringConvError &err) |
Trim trailing and heading whitespace and control characters. More... | |
bool | isEmptyString (const char *val, std::size_t size) |
Evaluate if a string is empty or contains only space characters. More... | |
bool | isEmptyString (const std::string &val) |
Evaluate if a string is empty or contains only space characters. More... | |
bool | caseInsensitiveEquals (const std::string &val1, const std::string &val2) |
Compare on Ascii letter caseinsensitive equality. More... | |
bool | caseInsensitiveStartsWith (const std::string &val, const std::string &prefix) |
Test prefix on Ascii letter caseinsensitive equality. More... | |
bool | stringStartsWith (const std::string &val, const std::string &prefix) |
Test prefix on equality. More... | |
std::string | utf8clean (const std::string &name, StringConvError &err) |
Convert possibly broken UTF-8 to valid UTF-8. More... | |
std::string | unescape (const std::string &val, StringConvError &err) |
Convert excaped control characters to their unescaped form (e.g. \n to ) More... | |
std::string | string_format (const char *fmt, va_list ap) |
Get a string built from a format string and arguments. More... | |
std::string | string_format (const char *fmt,...) |
Get a string built from a format string and arguments. More... | |
static bool | utf8midchr (unsigned char ch) |
Return true, if the character passed as argument is a non start character of a multi byte encoded unicode character. More... | |
static const char * | utf8prev (char const *end) |
Skip to the begin of an UTF-8 encoded character from a pointer into it. More... | |
static unsigned char | utf8charlen (unsigned char ch) |
Get the lenght of an UTF-8 encoded character from its first byte. More... | |
int32_t | utf8decode (const char *itr, unsigned int charsize) |
Decoding of a single UTF-8 character in a string. More... | |
std::size_t | utf8encode (char *buf, int32_t chr) |
Encoding of a single UTF-8 character into a string buffer. More... | |
DebugTraceInterface * | createDebugTrace_standard (std::size_t maxNofThreads_) |
Create an debug trace interface. More... | |
bool | dumpDebugTrace (DebugTraceInterface *debugTrace, const char *filename) |
Dump the trace content in a convenient form to a file specified. More... | |
ErrorBufferInterface * | createErrorBuffer_standard (FILE *logfilehandle, std::size_t maxNofThreads_, DebugTraceInterface *debugTrace) |
Create an error buffer interface. More... | |
int | errorCodeFromMessage (char const *&msgitr) |
Get the next error code in an error message printed by the standard error buffer implementation provided here. More... | |
void | removeErrorCodesFromMessage (char *msg) |
Remove all error codes in an error message printed by the standard error buffer implementation provided here. More... | |
const char * | errorCodeToString (int errcode) |
Get the error message as string. More... | |
FileLocatorInterface * | createFileLocator_std (ErrorBufferInterface *errorhnd) |
Create a file locator interface. More... | |
Wrapper to structures needed for atomic counters.
Wrapper to hash table implementation.
Wrapper to std or boost type traits.
Wrapper to structures needed for multithreading.
Map of strings to indices not freed till end of table life time.
Get a string built by a format string.
Some string conversion functions.
Sleep function (mainly for testing)
Definition of strus::shared_ptr.
Regular expression matching.
Fast generator for series of pseudo random numbers where the security is not an issue and the quality of the distribution has not to be guaranteed.
Class for a lexer used for implementing domain specific languages of strus.
Periodic timer event.
Some functions to parse a number from a string and to print a number to a string.
Some malloc wrappers.
strus toplevel namespace
Definition of strus::local_ptr a substitute for std::auto_ptr used in a local scope without copying or std::unique_ptr for C++ >= 11.
Basic portable file read/write and related filesystem functions.
Execution of a command appending results to string.
Accessing environment variables.
Wrapper to std::enable_if/boost::enable_if_c.
Wrapper to dynamic bitset implementation.
Basic portable file type for collections of equal sized records with random access.
Method to calculate CRC32 values that can be used for hashing or checksums in messages.
Some functions to parse a configuration string (e.g. strus storage configuration)
Some helpers for command line processing.
Bitset implementation.
PF:HACK: Bad solution, need probing of atomic as C++ feature as for regex
PF:HACK: Bad solution, need probing of dynamic_bitset as C++ feature as for regex
PF:HACK: Bad solution, need probing of enable_if as C++ feature as for regex
PF:HACK: Bad solution, need probing of thead and mutex as C++ features as for regex
PF:HACK: Bad solution, need probing of unordered_map as C++ feature as for regex
typedef boost::condition_variable strus::condition_variable |
typedef uint64_t strus::double_net_t |
typedef uint32_t strus::float_net_t |
typedef boost::mutex strus::mutex |
typedef boost::recursive_mutex strus::recursive_mutex |
typedef boost::unique_lock<boost::recursive_mutex> strus::recursive_unique_lock |
typedef boost::mutex::scoped_lock strus::scoped_lock |
typedef boost::thread strus::thread |
typedef boost::unique_lock<boost::mutex> strus::unique_lock |
anonymous enum |
enum strus::ErrorCode |
Application error codes beyond errno (>= 200)
enum strus::NumParseError |
bool strus::addConfigStringItem | ( | std::string & | config, |
const std::string & | key, | ||
const std::string & | value, | ||
ErrorBufferInterface * | errorhnd | ||
) |
void strus::aligned_free | ( | void * | ptr | ) |
void* strus::aligned_malloc | ( | std::size_t | size, |
std::size_t | alignment | ||
) |
int strus::appendFile | ( | const std::string & | filename, |
const std::string & | content | ||
) |
Appends a string to a file creating the file if it does not exist.
[in] | filename | the name of the file to append to |
[out] | content | content of the string to write |
bool strus::caseInsensitiveEquals | ( | const std::string & | val1, |
const std::string & | val2 | ||
) |
Compare on Ascii letter caseinsensitive equality.
[in] | val1 | input string |
[in] | val2 | other input string |
bool strus::caseInsensitiveStartsWith | ( | const std::string & | val, |
const std::string & | prefix | ||
) |
Test prefix on Ascii letter caseinsensitive equality.
[in] | val | input string |
[in] | prefix | prefix to check |
int strus::changeDir | ( | const std::string & | dirname | ) |
Change current directory of the process.
[in] | dirname | path of directory to create |
DebugTraceInterface* strus::createDebugTrace_standard | ( | std::size_t | maxNofThreads_ | ) |
Create an debug trace interface.
[in] | maximum | number of threads simultaneously writing to and reading from the error buffer interface |
int strus::createDir | ( | const std::string & | dirname, |
bool | fail_ifexist = true |
||
) |
Creates a directory if it does not exist yet.
[in] | dirname | path of directory to create |
[in] | fail_ifexist | return an error if the directory already exists |
ErrorBufferInterface* strus::createErrorBuffer_standard | ( | FILE * | logfilehandle, |
std::size_t | maxNofThreads_, | ||
DebugTraceInterface * | debugTrace | ||
) |
Create an error buffer interface.
[in] | logfilehandle | where to log error messages |
[in] | maximum | number of threads simultaneously writing to and reading from the error buffer interface |
[in] | debugTrace | debug trace interface to use or NULL if undefined, (passed with ownership) |
FileLocatorInterface* strus::createFileLocator_std | ( | ErrorBufferInterface * | errorhnd | ) |
Create a file locator interface.
[in] | errorhnd | error buffer interface |
char strus::dirSeparator | ( | ) |
Get the OS path element separator.
double strus::doubleFromString | ( | const std::string & | numstr, |
NumParseError & | err | ||
) |
Parsing a double precision floating point number from an Ascii string.
[in] | numstr | the number to parse as Ascii string |
[out] | err | error code in case of an error, unchanged in case of success |
double strus::doubleFromString | ( | const char * | numstr, |
std::size_t | numsize, | ||
NumParseError & | err | ||
) |
Parsing a double precision floating point number from an Ascii string.
[in] | numstr | the pointer to the number to parse as Ascii string |
[in] | numsize | the size of numstr in bytes |
[out] | err | error code in case of an error, unchanged in case of success |
bool strus::dumpDebugTrace | ( | DebugTraceInterface * | debugTrace, |
const char * | filename | ||
) |
Dump the trace content in a convenient form to a file specified.
[in] | debugTrace | debug trace to dump for the current thread |
[in] | filename | name of file to dump to, stderr if NULL is specified |
int strus::errorCodeFromMessage | ( | char const *& | msgitr | ) |
Get the next error code in an error message printed by the standard error buffer implementation provided here.
[in,out] | msgitr | pointer to error message in, pointer to position after the error code extracted |
const char* strus::errorCodeToString | ( | int | errcode | ) |
Get the error message as string.
[in] | errcode | error number (errno or strus::ErrorCode) |
int strus::execv_tostring | ( | const char * | filename, |
const char *const | argv[], | ||
std::string & | output | ||
) |
Execution of a command appending the output to a string.
[in] | filename | path of program to execute |
[in] | argv | NULL terminated list of arguments to pass to program |
[out] | output | where to append the standard output to |
int strus::execve_tostring | ( | const char * | filename, |
const char *const | argv[], | ||
const std::map< std::string, std::string > & | env, | ||
std::string & | output | ||
) |
Execution of a command with some environment variables set, appending the output to a string.
[in] | filename | path of program to execute |
[in] | argv | NULL terminated list of arguments to pass to program |
[in] | env | map of environment variables to set for the command execution |
[out] | output | where to append the standard output to |
int strus::expandFilePattern | ( | const std::string & | pathPattern, |
std::vector< std::string > & | res | ||
) |
Get all items matching a file path pattern (with '?' and '*' as substitutes)
[in] | pathPattern | file path pattern |
[out] | res | the returned matching paths |
bool strus::extractBooleanFromConfigString | ( | bool & | val, |
std::string & | config, | ||
const char * | key, | ||
ErrorBufferInterface * | errorhnd | ||
) |
bool strus::extractFloatFromConfigString | ( | double & | val, |
std::string & | config, | ||
const char * | key, | ||
ErrorBufferInterface * | errorhnd | ||
) |
bool strus::extractStringArrayFromConfigString | ( | std::vector< std::string > & | val, |
std::string & | config, | ||
const char * | key, | ||
char | separator, | ||
ErrorBufferInterface * | errorhnd | ||
) |
bool strus::extractStringFromConfigString | ( | std::string & | val, |
std::string & | config, | ||
const char * | key, | ||
ErrorBufferInterface * | errorhnd | ||
) |
bool strus::extractUIntFromConfigString | ( | unsigned int & | val, |
std::string & | config, | ||
const char * | key, | ||
ErrorBufferInterface * | errorhnd | ||
) |
int strus::getAncestorPath | ( | const std::string & | path, |
int | level, | ||
std::string & | dest | ||
) |
Get an ancestor (containing) path of a file or directory.
[in] | path | file system path to get the containing path |
[in] | level | how many levels to step back (level == 1 => getParentPath) |
[out] | dest | the containing path |
std::vector<std::pair<std::string,std::string> > strus::getAssignmentListItems | ( | const std::string & | config, |
ErrorBufferInterface * | errorhnd | ||
) |
std::vector<std::pair<std::string,std::string> > strus::getConfigStringItems | ( | const std::string & | config, |
ErrorBufferInterface * | errorhnd | ||
) |
int strus::getenv | ( | const std::string & | var, |
std::string & | output | ||
) |
Read an environment variable value as string.
[in] | var | environment variable name |
[out] | output | where to write the value to |
int strus::getenv_list | ( | const std::string & | var, |
char | sep, | ||
std::vector< std::string > & | output | ||
) |
Read an environment variable value as array of strings, separated by a separator character.
[in] | var | environment variable name |
[in] | sep | separator character separating the list elements |
[out] | output | where to append the values to |
int strus::getFileExtension | ( | const std::string & | path, |
std::string & | ext | ||
) |
Get the extension (including '.') of a file or directory.
[in] | path | file system path to get the extension from |
[out] | ext | the extension |
int strus::getFileName | ( | const std::string & | path, |
std::string & | dest, | ||
bool | withExtension = true |
||
) |
Get the file name without parent path of a file or directory.
[in] | path | file system path to get the file name from |
[out] | dest | the file name |
int strus::getParentPath | ( | const std::string & | path, |
std::string & | dest | ||
) |
Get the parent (containing) path of a file or directory.
[in] | path | file system path to get the containing path |
[out] | dest | the containing path |
std::vector<std::pair<std::string,std::string> > strus::getSubConfigStringItems | ( | const std::string & | configelem, |
ErrorBufferInterface * | errorhnd | ||
) |
bool strus::hasUpdirReference | ( | const std::string & | path | ) |
Return true, if the path contains an upper directory reference '..'.
[in] | path | file system path |
int64_t strus::intFromString | ( | const std::string & | numstr, |
int64_t | maxvalue, | ||
NumParseError & | err | ||
) |
Parsing an integer number from an Ascii string.
[in] | numstr | the number to parse as Ascii string |
[in] | maxvalue | the maximum value accepted for the result |
[out] | err | error code in case of an error, unchanged in case of success |
int64_t strus::intFromString | ( | const char * | numstr, |
std::size_t | numsize, | ||
int64_t | maxvalue, | ||
NumParseError & | err | ||
) |
Parsing an integer number from an Ascii string.
[in] | numstr | the pointer to the number to parse as Ascii string |
[in] | numsize | the size of numstr in bytes |
[in] | maxvalue | the maximum value accepted for the result |
[out] | err | error code in case of an error, unchanged in case of success |
bool strus::isAbsolutePath | ( | const std::string & | path | ) |
Check if a file system path is a path starting the file system root '/'.
[in] | path | file system path to check |
bool strus::isDir | ( | const std::string & | path | ) |
Check if a file system path points to a directory.
[in] | path | file system path to check |
bool strus::isEmptyString | ( | const char * | val, |
std::size_t | size | ||
) |
Evaluate if a string is empty or contains only space characters.
[in] | val | pointer to input string |
[in] | size | size of to input string in bytes |
bool strus::isEmptyString | ( | const std::string & | val | ) |
Evaluate if a string is empty or contains only space characters.
[in] | val | input string |
bool strus::isExplicitPath | ( | const std::string & | path | ) |
Check if a file path is explicit (relative path or absolute path)
[in] | path | file system path to check |
bool strus::isFile | ( | const std::string & | path | ) |
Check if a file system path points to a file.
[in] | path | file system path to check |
bool strus::isRelativePath | ( | const std::string & | path | ) |
Check if a file system path is a path starting with a name and not with a directive referencing the current path './' or the file system root '/'.
[in] | path | file system path to check |
bool strus::isTextFile | ( | const std::string & | path | ) |
Check if a file system path points to a file with text content (not binary)
[in] | path | file system path to check |
std::string strus::joinFilePath | ( | const std::string & | parentpath, |
const std::string & | childpath | ||
) |
Join two path with directory separator.
[in] | parentpath | left part of the resulting file system path |
[in] | childpath | right part of the resulting file system path |
int strus::mkdirp | ( | const std::string & | dirname | ) |
Creates a directory path (mkdir -p)
[in] | dirname | path of directory to create |
const char* strus::numstring_error | ( | NumParseError | errcode | ) |
Convert string conversion error code into an error message string.
[in] | errcode | error code |
std::runtime_error strus::numstring_exception | ( | NumParseError | errcode | ) |
Convert string conversion error code into an exception.
[in] | errcode | error code |
void strus::printIndentMultilineString | ( | std::ostream & | out, |
std::size_t | indentsize, | ||
const char * | descr, | ||
ErrorBufferInterface * | errorhnd | ||
) |
Print a multiline string with indentiation.
[in,out] | out | print target |
[in] | indentsize | number of steps to indent |
[in] | descr | what to print |
[in,out] | errorhnd | buffer for exception error messages |
int strus::readDirFiles | ( | const std::string & | path, |
const std::string & | ext, | ||
std::vector< std::string > & | res | ||
) |
Reads all file names matching to the extension ext of a directory to an array of strings.
[in] | path | the name of director to read |
[in] | ext | the file extension the accepted files must have (empty if all extensions are accepted) |
[out] | res | the returned matching file names of the directory read |
int strus::readDirItems | ( | const std::string & | path, |
std::vector< std::string > & | res | ||
) |
Reads all items (directory or file) of a directory to an array of strings.
[in] | path | the name of director to read |
[out] | res | the returned matching items of the directory read |
int strus::readDirSubDirs | ( | const std::string & | path, |
std::vector< std::string > & | res | ||
) |
Reads all subdirectories of a directory to an array of strings.
[in] | path | the name of director to read |
[out] | res | the returned matching sub directories of the directory read |
int strus::readFile | ( | const std::string & | filename, |
std::string & | res | ||
) |
Reads the complete content of a file to a string.
[in] | filename | the name of file to read |
[out] | res | the returned content of the file read |
int strus::readFileSize | ( | const std::string & | filename, |
std::size_t & | size | ||
) |
Evaluate the size of a file in bytes.
[in] | filename | the name of file to get the filesize of |
[out] | size | the returned size |
int strus::readStdin | ( | std::string & | res | ) |
Reads the complete input of stdin to a string.
[out] | res | the returned content of the file read |
int strus::removeDir | ( | const std::string & | dirname, |
bool | fail_ifnofexist = false |
||
) |
Removes an empty directory.
[in] | dirname | the name of the directory to remove |
[in] | fail_ifnofexist | return an error if the directory does not exist |
int strus::removeDirRecursive | ( | const std::string & | dirname, |
bool | fail_ifnofexist = false |
||
) |
Removes a directory with all its contents.
[in] | dirname | the name of the directory to remove |
[in] | fail_ifnofexist | return an error if the directory does not exist |
void strus::removeErrorCodesFromMessage | ( | char * | msg | ) |
Remove all error codes in an error message printed by the standard error buffer implementation provided here.
[in] | msg | error message string to process |
int strus::removeFile | ( | const std::string & | filename, |
bool | fail_ifnofexist = false |
||
) |
Removes a file.
[in] | filename | the name of the file to remove |
[in] | fail_ifnofexist | return an error if the directory does not exist |
void strus::removeKeysFromConfigString | ( | std::string & | config, |
const char ** | keys, | ||
ErrorBufferInterface * | errorhnd | ||
) |
int strus::renameFile | ( | const std::string & | old_filename, |
const std::string & | new_filename | ||
) |
Moves (renames) a file.
[in] | old_filename | the name of the file to rename |
[in] | new_filename | the new name of the file |
int strus::resolveUpdirReferences | ( | std::string & | path | ) |
Resolve upper directory references in a path, e.g. replace "/home/john/../jack" by "/home/jack".
[in,out] | path | path to resolve updir references in |
char strus::separatorPathList | ( | ) |
Separator character used for separating file paths in environment variables.
void strus::sleep | ( | int | nofsecs | ) |
std::string strus::string_format | ( | const char * | fmt, |
va_list | ap | ||
) |
Get a string built from a format string and arguments.
[in] | fmt | C printf format string |
[in] | ap | argument list |
std::string strus::string_format | ( | const char * | fmt, |
... | |||
) |
Get a string built from a format string and arguments.
[in] | fmt | C printf format string |
[in] | ... | argument list |
std::runtime_error strus::stringconv_exception | ( | StringConvError | errcode | ) |
Convert string conversion error code into an exception.
[in] | errcode | error code |
bool strus::stringStartsWith | ( | const std::string & | val, |
const std::string & | prefix | ||
) |
Test prefix on equality.
[in] | val | input string |
[in] | prefix | prefix to check |
std::string strus::tolower | ( | const char * | val, |
StringConvError & | err | ||
) |
Convert ASCII letters in string to lowercase.
[in] | val | input string |
[out] | err | error code in case of error (not set on success) |
std::string strus::tolower | ( | const char * | val, |
std::size_t | size, | ||
StringConvError & | err | ||
) |
Convert ASCII letters in string to lowercase.
[in] | val | input string |
[in] | size | input string size in bytes |
[out] | err | error code in case of error (not set on success) |
std::string strus::tolower | ( | const std::string & | val, |
StringConvError & | err | ||
) |
Convert ASCII letters in string to lowercase.
[in] | val | input string |
[out] | err | error code in case of error (not set on success) |
std::string strus::trim | ( | const std::string & | val, |
StringConvError & | err | ||
) |
Trim trailing and heading whitespace and control characters.
[in] | val | input string |
[out] | err | error code in case of error (not set on success) |
std::string strus::trim | ( | const char * | val, |
std::size_t | size, | ||
StringConvError & | err | ||
) |
Trim trailing and heading whitespace and control characters.
[in] | val | input string |
[in] | size | input string size in bytes |
[out] | err | error code in case of error (not set on success) |
uint64_t strus::uintFromString | ( | const std::string & | numstr, |
uint64_t | maxvalue, | ||
NumParseError & | err | ||
) |
Parsing an unsigned integer number from an Ascii string.
[in] | numstr | the number to parse as Ascii string |
[in] | maxvalue | the maximum value accepted for the result |
[out] | err | error code in case of an error, unchanged in case of success |
uint64_t strus::uintFromString | ( | const char * | numstr, |
std::size_t | numsize, | ||
uint64_t | maxvalue, | ||
NumParseError & | err | ||
) |
Parsing an unsigned integer number from an Ascii string.
[in] | numstr | the pointer to the number to parse as Ascii string |
[in] | numsize | the size of numstr in bytes |
[in] | maxvalue | the maximum value accepted for the result |
[out] | err | error code in case of an error, unchanged in case of success |
std::string strus::unescape | ( | const std::string & | val, |
StringConvError & | err | ||
) |
Convert excaped control characters to their unescaped form (e.g. \n to
)
[in] | val | input string |
[out] | err | error code in case of error (not set on success) |
|
inlinestatic |
Get the lenght of an UTF-8 encoded character from its first byte.
[in] | the | first byte of the character |
std::string strus::utf8clean | ( | const std::string & | name, |
StringConvError & | err | ||
) |
Convert possibly broken UTF-8 to valid UTF-8.
[in] | val | input string |
[out] | err | error code in case of error (not set on success) |
int32_t strus::utf8decode | ( | const char * | itr, |
unsigned int | charsize | ||
) |
Decoding of a single UTF-8 character in a string.
std::size_t strus::utf8encode | ( | char * | buf, |
int32_t | chr | ||
) |
Encoding of a single UTF-8 character into a string buffer.
|
inlinestatic |
Return true, if the character passed as argument is a non start character of a multi byte encoded unicode character.
|
inlinestatic |
Skip to the begin of an UTF-8 encoded character from a pointer into it.
[in] | pointer | into the UTF-8 encoded character |
int strus::writeFile | ( | const std::string & | filename, |
const std::string & | content | ||
) |
Writes a string to a file creating the file if it does not exist.
[in] | filename | the name of the file to write |
[out] | content | content of the string to write |