Rudiments
|
Public Member Functions | |
sensitivevalue () | |
~sensitivevalue () | |
void | setIncludeStart (const char *delimiter) |
void | setIncludeStart (const char *delimiter, uint64_t len) |
void | setIncludeEnd (const char *delimiter) |
void | setIncludeEnd (const char *delimiter, uint64_t len) |
void | setVerbatimFormat (sensitivevalue_format_t format) |
void | setFileFormat (sensitivevalue_format_t format) |
void | setChompTextFile (bool chomptextfile) |
void | setPath (const char *path) |
void | setPath (const char *path, uint64_t len) |
void | setTextExtension (const char *ext) |
void | setTextExtension (const char *ext, uint64_t len) |
void | setBinaryExtension (const char *ext) |
void | setBinaryExtension (const char *ext, uint64_t len) |
void | setHexExtension (const char *ext) |
void | setHexExtension (const char *ext, uint64_t len) |
const char * | getIncludeStart () |
uint64_t | getIncludeStartLength () |
const char * | getIncludeEnd () |
uint64_t | getIncludeEndLength () |
sensitivevalue_format_t | getVerbatimFormat () |
sensitivevalue_format_t | getFileFormat () |
bool | getChompTextFile () |
const char * | getPath () |
uint64_t | getPathLength () |
const char * | getTextExtension () |
uint64_t | getTextExtensionLength () |
const char * | getBinaryExtension () |
uint64_t | getBinaryExtensionLength () |
const char * | getHexExtension () |
uint64_t | getHexExtensionLength () |
void | parse (const char *in) |
void | parse (const char *in, uint64_t inlen) |
const byte_t * | getValue () |
byte_t * | detachValue () |
uint64_t | getValueSize () |
const char * | getTextValue () |
char * | detachTextValue () |
uint64_t | getTextValueLength () |
bool | clear () |
bool | reset () |
sensitivevalue::sensitivevalue | ( | ) |
Creates an instance of the sensitivevalue class.
sensitivevalue::~sensitivevalue | ( | ) |
Deletes this instance of the sensitivevalue class.
bool sensitivevalue::clear | ( | ) |
Clears the internal buffer containing the value.
Subsequent calls to getValue(), detachValue(), getTextValue(), and detachTextValue() will return NULL until parse() is called again. Similarly, subsequent calls to getValueSize() and getTextValueLength() will return 0 until parse() is called again.
Does not reset properties such as include delimiters, chomp behavior, etc. to defaults.
Always returns true.
char* sensitivevalue::detachTextValue | ( | ) |
Returns the value stored by a previous call to parse().
Subsequent calls to getValue() or detachValue() will return NULL until parse() is called again.
The calling program must deallocate the string returned from this method.
byte_t* sensitivevalue::detachValue | ( | ) |
Returns the value stored by a previous call to parse().
Subsequent calls to getValue() or detachValue() will return NULL until parse() is called again.
The calling program must deallocate the string returned from this method.
const char* sensitivevalue::getBinaryExtension | ( | ) |
Returns the extension that will be used when searching for binary files.
uint64_t sensitivevalue::getBinaryExtensionLength | ( | ) |
Returns the length of the extension that will be used when searching for binary files.
bool sensitivevalue::getChompTextFile | ( | ) |
Returns whether or not trailing carriage returns and line feeds will be trimmed from values retrieved from text files.
sensitivevalue_format_t sensitivevalue::getFileFormat | ( | ) |
Returns whether values retrieved from files will be interpreted as text, binary, or hex data.
const char* sensitivevalue::getHexExtension | ( | ) |
Returns the extension that will be used when searching for hex files.
uint64_t sensitivevalue::getHexExtensionLength | ( | ) |
Returns the length of the extension that will be used when searching for hex files.
const char* sensitivevalue::getIncludeEnd | ( | ) |
Returns the delimiter that ends a file include, either the delimiter set by setIncludeEnd() or the default if no delimiter was set.
uint64_t sensitivevalue::getIncludeEndLength | ( | ) |
Returns the length of the delimiter that ends a file include, either the length of the delimiter set by setIncludeEnd() or the length of the default if no delimiter was set.
const char* sensitivevalue::getIncludeStart | ( | ) |
Returns the delimiter that starts a file include, either the delimiter set by setIncludeStart() or the default if no delimiter was set.
uint64_t sensitivevalue::getIncludeStartLength | ( | ) |
Returns the length of the delimiter that starts a file include, either the length of the delimiter set by setIncludeStart() or the length of the default if no delimiter was set.
const char* sensitivevalue::getPath | ( | ) |
Returns the file search path.
uint64_t sensitivevalue::getPathLength | ( | ) |
Returns the file search path length.
const char* sensitivevalue::getTextExtension | ( | ) |
Returns the extension that will be used when searching for text files.
uint64_t sensitivevalue::getTextExtensionLength | ( | ) |
Returns the length of the extension that will be used when searching for text files.
const char* sensitivevalue::getTextValue | ( | ) |
Returns the value stored by a previous call to parse().
uint64_t sensitivevalue::getTextValueLength | ( | ) |
Returns the number of characters that getTextValue() or detachTextValue() would return.
Note that in most cases, this should be called prior to calling detachTextValue() as calling it after the value has been detached will return 0.
const byte_t* sensitivevalue::getValue | ( | ) |
Returns the value stored by a previous call to parse().
uint64_t sensitivevalue::getValueSize | ( | ) |
Returns the number of bytes that getValue() or detachValue() would return.
Note that in most cases, this should be called prior to calling detachValue() as calling it after the value has been detached will return 0.
sensitivevalue_format_t sensitivevalue::getVerbatimFormat | ( | ) |
Returns whether values passed directly into parse() will be interpreted as text, binary, or hex data.
void sensitivevalue::parse | ( | const char * | in | ) |
Parses "in".
If "in" does not begin and end with the delimiters set by setIncludeStart()/setIncludeEnd() (or square brackets by default) then:
If setVerbatimFormat() was set to FORMAT_BINARY then subsequent calls to getValue()/detachValue() will return "in" verbatim and subsequent calls to getValueSize() will return the size (in bytes) of "in".
Subsequent calls to getTextValue()/detachTextValue() will also return "in" verbatim, and subsequent calls to getTextValueLength() will return the length (in characters) of "in", but may be unreliable, as "in" may contain NULLs which would be interpreted as string terminators.
If setVerbatimFormat() was set to FORMAT_HEX, then the contents of "in" will be interpreted as a string representation of hex values and converted to the corresponding binary data. Subsequent calls to getValue()/detachValue() will return this binary data and subsequent calls to getValueSize() will return the size (in bytes) of this binary data.
Subsequent calls to getTextValue()/detachTextValue() will also return this binary data, and subsequent calls to getTextValueLength() will return the length (in characters) of this binary data, but may be unreliable, as the data may contain NULLs which would be interpreted as string terminators.
If "in" begins and ends with the delimiters set by setIncludeStart()/setIncludeEnd() (or square brackets by default) then:
If the file format was FORMAT_BINARY, then subsequent calls to getValue()/detachValue() will return the contents of the file and subsequent calls to getValueSize() will return the size (in bytes) of the contents of the file.
Subsequent calls to getTextValue()/detachTextValue() will also return the contents of the file, and subsequent calls to getTextValueLength() will return the length (in characters) of the contents of the file, but may be unreliable, as the contents of the file may contain NULLs which would be interpreted as string terminators.
If the file format was FORMAT_HEX, then subsequent calls to getValue()/detachValue() will return the processed contents of the file and subsequent calls to getValueSize() will return the size (in bytes) of the processed contents of the file.
Subsequent calls to getTextValue()/detachTextValue() will also return the processed contents of the file, and subsequent calls to getTextValueLength() will return the length (in characters) of the processed contents of the file, but may be unreliable, as the data may contain NULLs which would be interpreted as string terminators.
void sensitivevalue::parse | ( | const char * | in, |
uint64_t | inlen | ||
) |
Parses the first "inlen" bytes of "in". See parse() for details.
bool sensitivevalue::reset | ( | ) |
Clears the internal buffer containing the value and resets properties such as include delimiters, chomp behavior, etc. to defaults.
Always returns true.
void sensitivevalue::setBinaryExtension | ( | const char * | ext | ) |
Sets the extension to use when searching for binary files. Defaults to NULL. See parse() for details.
void sensitivevalue::setBinaryExtension | ( | const char * | ext, |
uint64_t | len | ||
) |
Sets the extension to use when searching for binary files. Defaults to NULL, 0. See parse() for details.
void sensitivevalue::setChompTextFile | ( | bool | chomptextfile | ) |
Sets whether or not to trim trailing carriage returns and line feeds will be trimmed from text files. Defaults to true. See parse() for details.
void sensitivevalue::setFileFormat | ( | sensitivevalue_format_t | format | ) |
Sets whether values retrieved from files will be interpreted as text, binary, or hex data. Defaults to text. See parse() for details.
void sensitivevalue::setHexExtension | ( | const char * | ext | ) |
Sets the extension to use when searching for hex files. Defaults to NULL. See parse() for details.
void sensitivevalue::setHexExtension | ( | const char * | ext, |
uint64_t | len | ||
) |
Sets the extension to use when searching for hex files. Defaults to NULL, 0. See parse() for details.
void sensitivevalue::setIncludeEnd | ( | const char * | delimiter | ) |
Sets the delimiter that ends a file include to "delimiter". Defaults to a right square bracket - "]". See parse() for details.
void sensitivevalue::setIncludeEnd | ( | const char * | delimiter, |
uint64_t | len | ||
) |
Sets the delimiter that ends a file include to "delimiter" of length "len". Defaults to a right square bracket - "]". See parse() for details.
void sensitivevalue::setIncludeStart | ( | const char * | delimiter | ) |
Sets the delimiter that starts a file include to "delimiter". Defaults to a left square bracket - "[". See parse() for details.
void sensitivevalue::setIncludeStart | ( | const char * | delimiter, |
uint64_t | len | ||
) |
Sets the delimiter that starts a file include to "delimiter" of length "len". Defaults to a left square bracket - "[". See parse() for details.
void sensitivevalue::setPath | ( | const char * | path | ) |
Sets the file search path. Defaults to NULL. See parse() for details.
void sensitivevalue::setPath | ( | const char * | path, |
uint64_t | len | ||
) |
Sets the file search path. Defaults to NULL, 0. See parse() for details.
void sensitivevalue::setTextExtension | ( | const char * | ext | ) |
Sets the extension to use when searching for text files. Defaults to NULL. See parse() for details.
void sensitivevalue::setTextExtension | ( | const char * | ext, |
uint64_t | len | ||
) |
Sets the extension to use when searching for text files. Defaults to NULL, 0. See parse() for details.