XJ music engine  1.9.6
In-game runtime engine for XJ music.
Public Member Functions | Static Public Member Functions | List of all members
XJ::ConfigParser Class Reference

#include <ConfigParser.h>

Inheritance diagram for XJ::ConfigParser:
XJ::InstrumentConfig XJ::ProgramConfig XJ::TemplateConfig

Public Member Functions

 ConfigParser (const std::string &input)
 
 ConfigParser (const std::string &input, const ConfigParser &defaults)
 
ConfigSingleValue getSingleValue (const std::string &key)
 
ConfigListValue getListValue (const std::string &key)
 
ConfigObjectValue getObjectValue (const std::string &key)
 
bool operator== (const ConfigParser &other) const
 
void operator= (const ConfigParser &other)
 

Static Public Member Functions

static std::string format (const bool &value)
 
static std::string format (const int &value)
 
static std::string format (const float &value)
 
static std::string format (const std::string &value)
 
static std::string format (const std::vector< std::string > &values)
 
static std::string format (const std::set< std::string > &values)
 
static std::vector< std::string > splitCsvTopLevel (const std::string &basicString)
 

Detailed Description

A lightweight HOCON parser and formatter

Constructor & Destructor Documentation

◆ ConfigParser() [1/2]

ConfigParser::ConfigParser ( const std::string &  input)
explicit

Parse a HOCON string into a ConfigMap

Parameters
inputThe HOCON string to parse
Returns
The parsed ConfigMap

◆ ConfigParser() [2/2]

ConfigParser::ConfigParser ( const std::string &  input,
const ConfigParser defaults 
)

Parse a HOCON string into a ConfigMap

Parameters
inputThe HOCON string to parse
defaultsThe default values to use
Returns
The parsed ConfigMap

Member Function Documentation

◆ format() [1/6]

std::string ConfigParser::format ( const bool &  value)
static

Format a bool value as a string

Parameters
valueThe bool value
Returns
The string representation of the bool value

◆ format() [2/6]

std::string ConfigParser::format ( const float &  value)
static

Format a float value as a string

Parameters
valueThe float value
Returns
The string representation of the float value

◆ format() [3/6]

std::string ConfigParser::format ( const int &  value)
static

Format an integer value as a string

Parameters
valueThe integer value
Returns
The string representation of the integer value

◆ format() [4/6]

std::string ConfigParser::format ( const std::set< std::string > &  values)
static

Format a list of strings as a comma-separated list of quoted strings in square brackets

Parameters
values
Returns

◆ format() [5/6]

std::string ConfigParser::format ( const std::string &  value)
static

Format a string value as a (quoted) string

Parameters
valueThe string value
Returns
The string representation of the quoted string value

◆ format() [6/6]

std::string ConfigParser::format ( const std::vector< std::string > &  values)
static

Format a list of strings as a comma-separated list of quoted strings in square brackets

Parameters
values
Returns

◆ getListValue()

ConfigListValue ConfigParser::getListValue ( const std::string &  key)

Get a list value from a ConfigMap

Parameters
keyThe key of the value to get
Returns
The list value

◆ getObjectValue()

ConfigObjectValue ConfigParser::getObjectValue ( const std::string &  key)

Get a object value from a ConfigMap

Parameters
keyThe key of the value to get
Returns
The object value

◆ getSingleValue()

ConfigSingleValue ConfigParser::getSingleValue ( const std::string &  key)

Get a single value from a ConfigMap

Parameters
keyThe key of the value to get
Returns
The single value

◆ operator=()

void ConfigParser::operator= ( const ConfigParser other)

Set a ConfigParser value to another

◆ operator==()

bool ConfigParser::operator== ( const ConfigParser other) const

Compare two ConfigParsers for equality

Parameters
otherThe ConfigParser to compare
Returns
true if equal

◆ splitCsvTopLevel()

std::vector< std::string > ConfigParser::splitCsvTopLevel ( const std::string &  basicString)
static

Split a CSV string into top-level pieces

Parameters
basicStringThe string to split
Returns
The pieces

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