/*! \brief Converts BaseTypeEnum to Config. \details Defined in dmzRuntimeConfigWrite.h. \note Unlike the config_to_* functions, the \a Name parameter can not be scoped. The \a Name parameter should not contain "." characters. \param[in] Name String containing name of config context to create. \param[in] AttrName String containing name of attribute to store the Boolean. \param[in] Value BaseTypeEnum to convert to Config. \return Returns a Config object containing the converted BaseTypeEnum. */ dmz::Config dmz::base_type_enum_to_config ( const String &Name, const String &AttrName, const BaseTypeEnum Value) { Config result (Name); String val (base_type_enum_to_string (Value)); result.store_attribute (AttrName, val); return result; }
/*! \brief Converts Data to Config. \details Defined in dmzRuntimeConfigWrite.h. \note Unlike the config_to_* functions, the \a Name parameter can not be scoped. The \a Name parameter should not contain "." characters. \param[in] Source Data object to convert. \param[in] context Pointer to the runtime context. \param[in] log Pointer to the Log to be used for log messages. \return Returns a Config object containing the converted Data object. \sa config_to_data(const String &Name, const Config &Source, RuntimeContext *context, Data &target, Log *log) */ dmz::Config dmz::data_to_config ( const String &Name, const Data &Source, RuntimeContext *context, Log *log) { Config result (Name); Definitions defs (context); RuntimeIterator it; Handle handle (Source.get_first_attribute (it)); while (handle) { Config attr ("attribute"); attr.store_attribute ("name", defs.lookup_named_handle_name (handle)); attr.store_attribute ( "type", base_type_enum_to_string (Source.lookup_attribute_base_type_enum (handle))); result.add_config (attr); const Int32 ElementCount (Source.lookup_attribute_element_count (handle)); for (Int32 ix = 0; ix < ElementCount; ix++) { Config element ("element"); String value; Source.lookup_string (handle, ix, value); element.store_attribute ("value", value); attr.add_config (element); } handle = Source.get_next_attribute (it); } return result; }
State (RuntimeContext *context) : handle (0) { Definitions defs (context); handle = defs.create_named_handle (base_type_enum_to_string (BaseTypeString)); }