Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Functions
ConfigFileUtils Namespace Reference

Functions

std::string readValue (const std::string &path, const std::string &key)
 
std::string readValueFromString (const std::string &str, const std::string &key)
 
int writeValue (const std::string &file, const std::string &key, const std::string &value, IoUtils::Mode mode=IoUtils::TRUNCATE)
 

Detailed Description

Utilities to read and write config files with one KEY=VALUE pair per lin.

Function Documentation

std::string ConfigFileUtils::readValue ( const std::string &  path,
const std::string &  key 
)

Read the value corresponding to key from path.

Parameters
pathpath to the file to read from.
keythe key to find.
Returns
The read value, or an empty string if the key was not found.
std::string ConfigFileUtils::readValueFromString ( const std::string &  str,
const std::string &  key 
)

Read the value corresponding to key from the string in str.

Parameters
strthe string the parse.
keythe key to find.
Returns
The read value, or an empty string if the key was not found.
int ConfigFileUtils::writeValue ( const std::string &  file,
const std::string &  key,
const std::string &  value,
IoUtils::Mode  mode = IoUtils::TRUNCATE 
)

Write the key-value pair to path.

Parameters
pathpath to the file to write.
keythe key
valuethe value
modewhether to truncate or append to the path.
Returns
0 on success, or an error code otherwise.