|
pianod2
multisource multiuser scriptable networked music player
|
Read/write JSON documents. More...


Go to the source code of this file.
Functions | |
| const std::string & | setupConfigDirectory (const char *location, const char *package, const char *nobody_name, const char *nobody_groups_list) |
| Choose and configure a directory for configuration files. More... | |
| bool | carefullyWriteFile (std::string filename, Parsnip::Data &data) |
| Write a document into a file. More... | |
| const Parsnip::Data | retrieveJsonFile (std::string filename, int minimumVersion=0) |
| Restore from a file. More... | |
Read/write JSON documents.
| bool carefullyWriteFile | ( | std::string | filename, |
| Parsnip::Data & | document | ||
| ) |
Write a document into a file.
Write into a temporary file, and when complete, then rename files so as to keep as backup while moving the new file into place. If compression is supported, writes compressed file; otherwise, writes uncompressed JSON. This is set at compile time, with no run-time choice.
| filename | The filename, without path. |
| document | The document to write. Top level must be a document. |
document parameter is altered to contain authoring package identification. 

| const Parsnip::Data retrieveJsonFile | ( | std::string | filename, |
| int | minimum_version | ||
| ) |
Restore from a file.
Tries .gz (if supported) first, then falls back to uncompressed version.
| filename | The filename, without path. |
| minimum_version | The lowest file format version number supported. If the input file has a version number lower than this, a DataFormatException is thrown. |
| bad_alloc,io_base::failure,or | a Parsnip serialization exception. |


| const std::string& setupConfigDirectory | ( | const char * | location, |
| const char * | package, | ||
| const char * | nobody_name, | ||
| const char * | nobody_groups_list | ||
| ) |
Choose and configure a directory for configuration files.
| location | Pathname to use, or nullptr to use default. |
| package | Name of this package. |
| nobody_name | Name of user to run as, if running as root. |
| nobody_groups_list | List of groups to adopt before giving up root privs. |

