boost::property_tree::ptree_errorError indicating that translation from given value to the property tree data_type (or vice versa) failed. Derives from ptree_error. TRetrieve the data associated with this error. This is the source value that failed to be translated. You need to explicitly specify its type. const std::string &The message to associate with this error. const T &The value associated with this error that was the source of the translation failure. Instantiate a ptree_bad_data instance with the given message and data. boost::property_tree::ptree_errorError indicating that specified path does not exist. Derives from ptree_error. TRetrieve the invalid path. You need to explicitly specify the type of path. const std::string &The message to associate with this error. const T &The path that could not be found in the property_tree. Instantiate a ptree_bad_path with the given message and path data. runtime_errorBase class for all property tree errors. Derives from std::runtime_error. Call member function what to get human readable message associated with the error. const std::string &The message to associate with this error. Instantiate a ptree_error instance with the given message.
std::basic_string< ChTraitsAlloc >std::basic_string< ChTraitsAlloc >id_translator< std::basic_string< Ch, Traits, Alloc > > TTid_translator< T >
voidstd::basic_istream< Ch > &Ptree &Read INFO from a the given stream and translate it to a property tree. Replaces the existing contents. Strong exception guarantee. info_parser_error If the stream cannot be read, doesn't contain valid INFO, or a conversion fails. voidstd::basic_istream< Ch > &Ptree &const Ptree &If parsing fails, pt is set to a copy of this tree. Read INFO from a the given stream and translate it to a property tree. Replaces the existing contents. Strong exception guarantee. voidconst std::string &Ptree &const std::locale &std::locale()Read INFO from a the given file and translate it to a property tree. The tree's key type must be a string type, i.e. it must have a nested value_type typedef that is a valid parameter for basic_ifstream. Replaces the existing contents. Strong exception guarantee. info_parser_error If the file cannot be read, doesn't contain valid INFO, or a conversion fails. voidconst std::string &Ptree &const Ptree &If parsing fails, pt is set to a copy of this tree. const std::locale &std::locale()Read INFO from a the given file and translate it to a property tree. The tree's key type must be a string type, i.e. it must have a nested value_type typedef that is a valid parameter for basic_ifstream. Replaces the existing contents. Strong exception guarantee. voidstd::basic_ostream< Ch > &const Ptree &const info_writer_settings< Ch > &info_writer_settings< Ch >()The settings to use when writing the INFO data. Writes a tree to the stream in INFO format. info_parser_error If the stream cannot be written to, or a conversion fails. voidconst std::string &const Ptree &const std::locale &std::locale()const info_writer_settings< typename Ptree::key_type::value_type > &info_writer_make_settings< typename Ptree::key_type::value_type >()The settings to use when writing the INFO data. Writes a tree to the file in INFO format. The tree's key type must be a string type, i.e. it must have a nested value_type typedef that is a valid parameter for basic_ofstream. info_parser_error If the file cannot be written to, or a conversion fails.
file_parser_errorIndicates an error parsing INI formatted data. const std::string &Message describing the parser error. const std::string &The name of the file being parsed containing the error. unsigned longThe line in the given file where an error was encountered. Construct an ini_parser_error boolintvalue to check for validity as flags to ini_parser. Determines whether the flags are valid for use with the ini_parser. true if the flags are valid, false otherwise. voidstd::basic_istream< typename Ptree::key_type::value_type > &Stream from which to read in the property tree. Ptree &The property tree to populate. Read INI from a the given stream and translate it to a property tree. Clears existing contents of property tree. In case of error the property tree is not modified. ini_parser_error If a format violation is found. voidconst std::string &Name of file from which to read in the property tree. Ptree &The property tree to populate. const std::locale &std::locale()The locale to use when reading in the file contents. Read INI from a the given file and translate it to a property tree. Clears existing contents of property tree. In case of error the property tree unmodified. ini_parser_error In case of error deserializing the property tree. voidstd::basic_ostream< typename Ptree::key_type::value_type > &The stream to which to write the INI representation of the property tree. const Ptree &The property tree to tranlsate to INI and output. int0The flags to use when writing the INI file. No flags are currently supported. Translates the property tree to INI and writes it the given output stream. pt cannot have data in its root. pt cannot have keys both data and children. pt cannot be deeper than two levels. There cannot be duplicate keys on any given level of pt. ini_parser_error In case of error translating the property tree to INI or writing to the output stream. voidconst std::string &The name of the file to which to write the INI representation of the property tree. const Ptree &The property tree to tranlsate to INI and output. int0The flags to use when writing the INI file. The following flags are supported: skip_ini_validity_check – Skip check if ptree is a valid ini. The validity check covers the preconditions but takes O(n log n) time. const std::locale &std::locale()The locale to use when writing the file. Translates the property tree to INI and writes it the given file. pt cannot have data in its root. pt cannot have keys both data and children. pt cannot be deeper than two levels. There cannot be duplicate keys on any given level of pt. info_parser_error In case of error translating the property tree to INI or writing to the file.
voidstd::basic_istream< typename Ptree::key_type::value_type > &Stream from which to read in the property tree. Ptree &The property tree to populate. Read JSON from a the given stream and translate it to a property tree. Clears existing contents of property tree. In case of error the property tree unmodified. Items of JSON arrays are translated into ptree keys with empty names. Members of objects are translated into named keys. JSON data can be a string, a numeric value, or one of literals "null", "true" and "false". During parse, any of the above is copied verbatim into ptree data string. json_parser_error In case of error deserializing the property tree. voidconst std::string &Name of file from which to read in the property tree. Ptree &The property tree to populate. const std::locale &std::locale()The locale to use when reading in the file contents. Read JSON from a the given file and translate it to a property tree. Clears existing contents of property tree. In case of error the property tree unmodified. Items of JSON arrays are translated into ptree keys with empty names. Members of objects are translated into named keys. JSON data can be a string, a numeric value, or one of literals "null", "true" and "false". During parse, any of the above is copied verbatim into ptree data string. json_parser_error In case of error deserializing the property tree. voidstd::basic_ostream< typename Ptree::key_type::value_type > &The stream to which to write the JSON representation of the property tree. const Ptree &The property tree to tranlsate to JSON and output. booltrueWhether to pretty-print. Defaults to true for backward compatibility. Translates the property tree to JSON and writes it the given output stream. Any property tree key containing only unnamed subkeys will be rendered as JSON arrays. pt cannot contain keys that have both subkeys and non-empty data. json_parser_error In case of error translating the property tree to JSON or writing to the output stream. voidconst std::string &The name of the file to which to write the JSON representation of the property tree. const Ptree &The property tree to translate to JSON and output. const std::locale &std::locale()The locale to use when writing out to the output file. booltrueWhether to pretty-print. Defaults to true and last place for backward compatibility. Translates the property tree to JSON and writes it the given file. Any property tree key containing only unnamed subkeys will be rendered as JSON arrays. pt cannot contain keys that have both subkeys and non-empty data. json_parser_error In case of error translating the property tree to JSON or writing to the file.
Property tree main structure. A property tree is a hierarchical data structure which has one element of type Data in each node, as well as an ordered sequence of sub-nodes, which are additionally identified by a non-unique key of type Key.Key equivalency is defined by KeyCompare, a predicate defining a strict weak ordering.Property tree defines a Container-like interface to the (key-node) pairs of its direct sub-nodes. The iterators are bidirectional. The sequence of nodes is held in insertion order, not key order. voidself_type &Swap with other tree. Only constant-time and nothrow if the data type's swap is. size_typeThe number of direct children of this node. size_type boolWhether there are any direct children. iterator const_iterator iterator const_iterator reverse_iterator const_reverse_iterator reverse_iterator const_reverse_iterator value_type & const value_type & value_type & const value_type & iteratoriteratorconst value_type &Insert a copy of the given tree with its key just before the given position in this node. This operation invalidates no iterators. An iterator to the newly created child. voiditeratorItItRange insert. Equivalent to: for(; first != last; ++first) insert(where, *first); iteratoriteratorErase the child pointed at by the iterator. This operation invalidates the given iterator, as well as its equivalent assoc_iterator. A valid iterator pointing to the element after the erased. iteratoriteratoriteratorRange erase. Equivalent to: while(first != last;) first = erase(first); iteratorconst value_type &Equivalent to insert(begin(), value). iteratorconst value_type &Equivalent to insert(end(), value). voidEquivalent to erase(begin()). voidEquivalent to erase(boost::prior(end())). voidReverses the order of direct children in the property tree. voidCompareSorts the direct children of this node according to the predicate. The predicate is passed the whole pair of key and child. voidSorts the direct children of this node according to key order. boolconst self_type &Two property trees are the same if they have the same data, the keys and order of their children are the same, and the children compare equal, recursively. boolconst self_type & assoc_iteratorReturns an iterator to the first child, in key order. const_assoc_iteratorReturns an iterator to the first child, in key order. assoc_iteratorReturns the not-found iterator. Equivalent to end() in a real associative container. const_assoc_iteratorReturns the not-found iterator. Equivalent to end() in a real associative container. assoc_iteratorconst key_type &Find a child with the given key, or not_found() if there is none. There is no guarantee about which child is returned if multiple have the same key. const_assoc_iteratorconst key_type &Find a child with the given key, or not_found() if there is none. There is no guarantee about which child is returned if multiple have the same key. std::pair< assoc_iterator, assoc_iterator >const key_type &Find the range of children that have the given key. std::pair< const_assoc_iterator, const_assoc_iterator >const key_type &Find the range of children that have the given key. size_typeconst key_type &Count the number of direct children with the given key. size_typeconst key_type &Erase all direct children with the given key and return the count. iteratorassoc_iteratorGet the iterator that points to the same element as the argument. A valid assoc_iterator range (a, b) does not imply that (to_iterator(a), to_iterator(b)) is a valid range. const_iteratorconst_assoc_iteratorGet the iterator that points to the same element as the argument. A valid const_assoc_iterator range (a, b) does not imply that (to_iterator(a), to_iterator(b)) is a valid range. data_type &Reference to the actual data in this node. const data_type &Reference to the actual data in this node. voidClear this tree completely, of both data and children. self_type &const path_type &Get the child at the given path, or throw ptree_bad_path. Depending on the path, the result at each level may not be completely deterministic, i.e. if the same key appears multiple times, which child is chosen is not specified. This can lead to the path not being resolved even though there is a descendant with this path. Example: a -> b -> c -> b The path "a.b.c" will succeed if the resolution of "b" chooses the first such node, but fail if it chooses the second. const self_type &const path_type &Get the child at the given path, or throw ptree_bad_path. self_type &const path_type &self_type &Get the child at the given path, or return default_value. const self_type &const path_type &const self_type &Get the child at the given path, or return default_value. optional< self_type & >const path_type &Get the child at the given path, or return boost::null. optional< const self_type & >const path_type &Get the child at the given path, or return boost::null. self_type &const path_type &const self_type &Set the node at the given path to the given value. Create any missing parents. If the node at the path already exists, replace it. Because of the way paths work, it is not generally guaranteed that a node newly created can be accessed using the same path. If the path could refer to multiple nodes, it is unspecified which one gets replaced. A reference to the inserted subtree. self_type &const path_type &Path to the child. The last fragment must not have an index. const self_type &Add the node at the given path. Create any missing parents. If there already is a node at the path, add another one with the same key. Because of the way paths work, it is not generally guaranteed that a node newly created can be accessed using the same path. A reference to the inserted subtree. unspecifiedTranslatorTake the value of this node and attempt to translate it to a Type object using the supplied translator. ptree_bad_data if the conversion fails. TypeTake the value of this node and attempt to translate it to a Type object using the default translator. ptree_bad_data if the conversion fails. Typeconst Type &TranslatorTake the value of this node and attempt to translate it to a Type object using the supplied translator. Return default_value if this fails. unspecifiedconst Ch *TranslatorMake get_value do the right thing for string literals. unspecifiedconst Type &Take the value of this node and attempt to translate it to a Type object using the default translator. Return default_value if this fails. unspecifiedconst Ch *Make get_value do the right thing for string literals. optional< Type >TranslatorTake the value of this node and attempt to translate it to a Type object using the supplied translator. Return boost::null if this fails. optional< Type >Take the value of this node and attempt to translate it to a Type object using the default translator. Return boost::null if this fails. voidconst Type &TranslatorReplace the value at this node with the given value, translated to the tree's data type using the supplied translator. ptree_bad_data if the conversion fails. voidconst Type &Replace the value at this node with the given value, translated to the tree's data type using the default translator. ptree_bad_data if the conversion fails. unspecifiedconst path_type &TranslatorShorthand for get_child(path).get_value(tr). Typeconst path_type &Shorthand for get_child(path).get_value<Type>(). Typeconst path_type &const Type &TranslatorShorthand for get_child(path, empty_ptree()) .get_value(default_value, tr). That is, return the translated value if possible, and the default value if the node doesn't exist or conversion fails. unspecifiedconst path_type &const Ch *TranslatorMake get do the right thing for string literals. unspecifiedconst path_type &const Type &Shorthand for get_child(path, empty_ptree()) .get_value(default_value). That is, return the translated value if possible, and the default value if the node doesn't exist or conversion fails. unspecifiedconst path_type &const Ch *Make get do the right thing for string literals. optional< Type >const path_type &TranslatorShorthand for: if(optional\<self_type&\> node = get_child_optional(path)) return node->get_value_optional(tr); return boost::null; That is, return the value if it exists and can be converted, or nil. optional< Type >const path_type &Shorthand for: if(optional\<const self_type&\> node = get_child_optional(path)) return node->get_value_optional(); return boost::null; That is, return the value if it exists and can be converted, or nil. self_type &const path_type &const Type &TranslatorSet the value of the node at the given path to the supplied value, translated to the tree's data type. If the node doesn't exist, it is created, including all its missing parents. The node that had its value changed. ptree_bad_data if the conversion fails. self_type &const path_type &const Type &Set the value of the node at the given path to the supplied value, translated to the tree's data type. If the node doesn't exist, it is created, including all its missing parents. The node that had its value changed. ptree_bad_data if the conversion fails. self_type &const path_type &Path to the child. The last fragment must not have an index. const Type &The value to add. TranslatorThe translator to use. If the node identified by the path does not exist, create it, including all its missing parents. If the node already exists, add a sibling with the same key. Set the newly created node's value to the given paremeter, translated with the supplied translator. The node that was added. ptree_bad_data if the conversion fails. self_type &const path_type &Path to the child. The last fragment must not have an index. const Type &The value to add. If the node identified by the path does not exist, create it, including all its missing parents. If the node already exists, add a sibling with the same key. Set the newly created node's value to the given paremeter, translated with the supplied translator. The node that was added. ptree_bad_data if the conversion fails. Creates a node with no children and default-constructed data. const data_type &Creates a node with no children and a copy of the given data. const self_type & self_type &const self_type &Basic guarantee only. self_type *path_type & self_type &path_type & Simple implementation of the Translator concept. It does no translation. boost::optional< T >const T & boost::optional< T >const T & If you want to use a custom key type, specialize this struct for it and give it a 'type' typedef that specifies your path type. The path type must conform to the Path concept described in the documentation. This is already specialized for std::basic_string. Specialize this struct to specify a default translator between the data in a tree whose data_type is Internal, and the external data_type specified in a get_value, get, put_value or put operation. This is already specialized for Internal being std::basic_string. Implements a path using a std::string as the key. string_path< std::string, id_translator< std::string > > A property tree with std::string for key and data, and default comparison. basic_ptree< std::string, std::string > A property tree with std::string for key and data, and case-insensitive comparison. unspecified Implements a path using a std::wstring as the key. string_path< std::wstring, id_translator< std::wstring > > A property tree with std::wstring for key and data, and default comparison. The type only exists if the platform supports wchar_t. basic_ptree< std::wstring, std::wstring > A property tree with std::wstring for key and data, and case-insensitive comparison. The type only exists if the platform supports wchar_t. unspecified voidbasic_ptree< K, D, C > &basic_ptree< K, D, C > &Swap two property tree instances.
voidArchive &The archive to which to save the serialized property tree. This archive should conform to the concept laid out by the Boost.Serialization library. const basic_ptree< K, D, C > &The property tree to serialize. const unsigned intfile_version for the archive. Serialize the property tree to the given archive. In addition to serializing to regular archives, this supports serializing to archives requiring name-value pairs, e.g. XML archives. However, the output format in the XML archive is not guaranteed to be the same as that when using the Boost.PropertyTree library's boost::property_tree::xml_parser::write_xml. ar will contain the serialized form of t. voidArchive &The archive from which to load the serialized property tree. This archive should conform to the concept laid out by the Boost.Serialization library. basic_ptree< K, D, C > &The property tree to de-serialize. const unsigned intfile_version for the archive. De-serialize the property tree to the given archive. In addition to de-serializing from regular archives, this supports loading from archives requiring name-value pairs, e.g. XML archives. The format should be that used by boost::property_tree::save. t will contain the de-serialized data from ar. voidArchive &The archive from which to load or save the serialized property tree. The type of this archive will determine whether saving or loading is performed. basic_ptree< K, D, C > &The property tree to load or save. const unsigned intfile_version for the archive. Load or store the property tree using the given archive.
voidstd::basic_ostream< Ch, Traits > &const E & voidstd::basic_istream< Ch, Traits > &E & ChTraitsboolvoid voidstd::basic_ostream< Ch, Traits > &bool voidstd::basic_istream< Ch, Traits > &bool & ChTraitsChvoid voidstd::basic_ostream< Ch, Traits > &Ch voidstd::basic_istream< Ch, Traits > &Ch & ChTraitsFtypename boost::enable_if< detail::is_inexact< F > >::type voidstd::basic_ostream< Ch, Traits > &const F & voidstd::basic_istream< Ch, Traits > &F & ChTraitssigned charvoid voidstd::basic_ostream< Ch, Traits > &signed char voidstd::basic_istream< Ch, Traits > &signed char & ChTraitsunsigned charvoid voidstd::basic_ostream< Ch, Traits > &unsigned char voidstd::basic_istream< Ch, Traits > &unsigned char & Implementation of Translator that uses the stream overloads. std::basic_string< Ch, Traits, Alloc > E boost::optional< E >const internal_type & boost::optional< internal_type >const E & std::localestd::locale() std::basic_string< ChTraitsAlloc >Estream_translator< Ch, Traits, Alloc, E >
std::basic_string< ChTraitsAlloc >std::basic_string< Ch, Traits, Alloc > string_path< _string, id_translator< _string > > Default path class. A path is a sequence of values. Groups of values are separated by the separator value, which defaults to '.' cast to the sequence's value type. The group of values is then passed to the translator to get a key. If instantiated with std::string and id_translator<std::string>, it accepts paths of the form "one.two.three.four". Translator::external_type String::value_type (is_same< String, typename Translator::internal_type >::value) s_c_iter key_typeTake a single element off the path at the front and return it. boolTest if the path is empty. boolTest if the path contains a single element, i.e. no separators. char_typeGet the separator used by this path. std::string string_path &const string_path &Append a second path to this one. o's separator is the same as this one's, or o has no separators char_typechar_type('.')Create an empty path. const String &A sequence, possibly with separators, that describes the path, e.g. "one.two.three". char_typechar_type('.')The separator used in parsing. Defaults to '.'. TranslatorTranslator()The translator used by this path to convert the individual parts to keys. Create a path by parsing the given string. const char_type *A zero-terminated array of values. Only use if zero- termination makes sense for your type, and your sequence supports construction from it. Intended for string literals. char_typechar_type('.')The separator used in parsing. Defaults to '.'. TranslatorTranslator()The translator used by this path to convert the individual parts to keys. Create a path by parsing the given string. const string_path & string_path &const string_path & string_path< String, Translator >string_path< String, Translator >const string_path< String, Translator > & string_path< String, Translator >string_path< String, Translator >const typename String::value_type * string_path< String, Translator >const typename String::value_type *const string_path< String, Translator > &
voidstd::basic_istream< typename Ptree::key_type::value_type > &Stream from which to read in the property tree. Ptree &The property tree to populate. int0Flags controlling the behaviour of the parser. The following flags are supported: no_concat_text – Prevents concatenation of text nodes into datastring of property tree. Puts them in separate <xmltext> strings instead. no_comments – Skip XML comments. trim_whitespace – Trim leading and trailing whitespace from text, and collapse sequences of whitespace. Reads XML from an input stream and translates it to property tree. Clears existing contents of property tree. In case of error the property tree unmodified. XML attributes are placed under keys named <xmlattr>. xml_parser_error In case of error deserializing the property tree. voidconst std::string &The file from which to read in the property tree. Ptree &The property tree to populate. int0Flags controlling the bahviour of the parser. The following flags are supported: no_concat_text – Prevents concatenation of text nodes into datastring of property tree. Puts them in separate <xmltext> strings instead. no_comments – Skip XML comments. const std::locale &std::locale()The locale to use when reading in the file contents. Reads XML from a file using the given locale and translates it to property tree. Clears existing contents of property tree. In case of error the property tree unmodified. XML attributes are placed under keys named <xmlattr>. xml_parser_error In case of error deserializing the property tree. voidstd::basic_ostream< typename Ptree::key_type::value_type > &The stream to which to write the XML representation of the property tree. const Ptree &The property tree to tranlsate to XML and output. const xml_writer_settings< typename Ptree::key_type > &xml_writer_settings< typename Ptree::key_type >()The settings to use when writing out the property tree as XML. Translates the property tree to XML and writes it the given output stream. xml_parser_error In case of error translating the property tree to XML or writing to the output stream. voidconst std::string &The file to which to write the XML representation of the property tree. const Ptree &The property tree to tranlsate to XML and output. const std::locale &std::locale()The locale to use when writing the output to file. const xml_writer_settings< typename Ptree::key_type > &xml_writer_settings< typename Ptree::key_type >()The settings to use when writing out the property tree as XML. Translates the property tree to XML and writes it the given file. xml_parser_error In case of error translating the property tree to XML or writing to the output stream.