Add SaveEntries() and LoadEntries(). (#233)

These allow saving and loading non-persistent entries in the persistent
file format.
This commit is contained in:
Peter Johnson
2017-10-01 09:13:43 -07:00
committed by GitHub
parent e68a71022c
commit 1f18cc5416
17 changed files with 352 additions and 26 deletions

View File

@@ -430,7 +430,7 @@ class NetworkTableInstance final {
/** @} */
/**
* @defgroup PersistentFunctions Persistent Functions
* @defgroup FileFunctions File Save/Load Functions
* @{
*/
@@ -455,6 +455,27 @@ class NetworkTableInstance final {
StringRef filename,
std::function<void(size_t line, const char* msg)> warn);
/**
* Save table values to a file. The file format used is identical to
* that used for SavePersistent.
* @param filename filename
* @param prefix save only keys starting with this prefix
* @return error string, or nullptr if successful
*/
const char* SaveEntries(StringRef filename, StringRef prefix) const;
/**
* Load table values from a file. The file format used is identical to
* that used for SavePersistent / LoadPersistent.
* @param filename filename
* @param prefix load only keys starting with this prefix
* @param warn callback function for warnings
* @return error string, or nullptr if successful
*/
const char* LoadEntries(
StringRef filename, StringRef prefix,
std::function<void(size_t line, const char* msg)> warn);
/** @} */
/**