KrisLibrary  1.0.0
Public Member Functions | Public Attributes | List of all members
AppUtils::ProgramSettings Class Reference

#include <apputils.h>

Inheritance diagram for AppUtils::ProgramSettings:
AnyCollection

Public Member Functions

 ProgramSettings (const char *applicationName, const char *version="")
 
bool read (const char *fn)
 
bool write (const char *fn)
 
- Public Member Functions inherited from AnyCollection
 AnyCollection (AnyValue value)
 
template<class T >
 AnyCollection (const std::vector< T > &array)
 
template<class T , class T2 >
 AnyCollection (const std::map< T, T2 > &map)
 
template<class T , class T2 >
 AnyCollection (const UNORDERED_MAP_TEMPLATE< T, T2 > &map)
 
size_t size () const
 
bool null () const
 returns true if this is a null
 
bool collection () const
 returns true if it is a non-primitive data type
 
bool isvalue () const
 returns true if this is a primitive data type
 
bool isarray () const
 returns true if this is an array data type
 
bool ismap () const
 returns true if this is a map data type
 
size_t depth () const
 depth of nesting: 0 for a primitive data type, 1 for vector or map etc
 
 operator const AnyValue & () const
 cast to AnyValue, if this is a primitive data type
 
 operator AnyValue & ()
 
template<class T >
 operator T () const
 
template<class T >
bool as (T &value) const
 
template<class T >
bool asvector (std::vector< T > &values) const
 
bool asvector (std::vector< AnyValue > &values) const
 
template<class T >
bool operator== (const T &value) const
 
template<class T >
bool operator!= (const T &value) const
 
void resize (size_t n)
 
void clear ()
 
AnyCollectionPtr find (int i) const
 
AnyCollectionPtr find (const char *str) const
 
AnyCollectionPtr find (AnyKeyable key) const
 
AnyCollectionPtr insert (int i)
 
AnyCollectionPtr insert (const char *str)
 
AnyCollectionPtr insert (AnyKeyable key)
 
AnyCollectionoperator[] (int i)
 
const AnyCollectionoperator[] (int i) const
 
AnyCollectionoperator[] (const char *str)
 
const AnyCollectionoperator[] (const char *str) const
 
AnyCollectionoperator[] (AnyKeyable key)
 
const AnyCollectionoperator[] (AnyKeyable key) const
 
void shallow_copy (const AnyCollection &rhs)
 shallow copy
 
void deep_copy (const AnyCollection &rhs)
 deep copy
 
AnyCollectionoperator= (const AnyCollection &rhs)
 shallow copy
 
AnyCollectionoperator= (AnyValue value)
 set to a value
 
AnyCollectionoperator= (bool v)
 set to a primitive data type that can accidentally be cast to a char*
 
AnyCollectionoperator= (char v)
 
AnyCollectionoperator= (unsigned char v)
 
AnyCollectionoperator= (int v)
 
AnyCollectionoperator= (unsigned int v)
 
AnyCollectionoperator= (float v)
 
AnyCollectionoperator= (double v)
 
AnyCollectionoperator= (const std::string &str)
 
AnyCollectionoperator= (const char *str)
 set to a C-string
 
template<class T >
AnyCollectionoperator= (const std::vector< T > &array)
 set to an array
 
template<class T , class T2 >
AnyCollectionoperator= (const std::map< T, T2 > &map)
 set to a map
 
template<class T , class T2 >
AnyCollectionoperator= (const UNORDERED_MAP_TEMPLATE< T, T2 > &map)
 set to a map
 
AnyCollectionPtr lookup (const std::string &reference, bool insert=false, char delim='.', char lbracket='[', char rbracket=']')
 
AnyCollectionPtr lookup (const std::vector< std::string > &path, bool insert=false)
 
AnyCollectionPtr lookup (const std::vector< AnyKeyable > &path, bool insert=false)
 
bool match_path (const std::vector< std::string > &path, std::vector< AnyKeyable > &key_path) const
 
AnyCollectionPtr slice (const std::string &reference, const char *delims=".[]:,")
 
bool subcollection (const std::vector< std::string > &paths, AnyCollection &subset, const char *delims=".[]:,")
 
void enumerate (std::vector< AnyCollectionPtr > &collections) const
 if this is a collection, returns the list of sub-collections
 
void enumerate_keys (std::vector< AnyKeyable > &elements) const
 returns an enumerated list of keys contained within
 
void enumerate_values (std::vector< AnyValue > &elements) const
 returns an enumerated list of primitive values contained within
 
void enumerate_keys_dfs (std::vector< std::vector< AnyKeyable > > &paths) const
 returns an enumerated list of keys contained within
 
void enumerate_values_dfs (std::vector< AnyValue > &elements) const
 returns an enumerated list of elements contained within
 
void merge (const AnyCollection &other)
 
void deepmerge (const AnyCollection &other)
 
bool fill (AnyCollection &universe, bool checkSuperset=false)
 
bool read (std::istream &in)
 Reads in JSON format.
 
bool read (const char *data)
 
void write (std::ostream &out, int indent=0) const
 Writes in JSON format.
 
void write_inline (std::ostream &out) const
 Same as write, but puts everything onto one line.
 

Public Attributes

std::string applicationName
 
std::string version
 

Additional Inherited Members

- Public Types inherited from AnyCollection
typedef std::shared_ptr< AnyCollectionAnyCollectionPtr
 
- Static Public Member Functions inherited from AnyCollection
static bool parse_reference (const std::string &reference, std::vector< std::string > &path, char delim='.', char lbracket='[', char rbracket=']')
 parse a reference string into a path
 

Detailed Description

A convenience class for reading/writing settings to the application data folder


The documentation for this class was generated from the following files: