VideoCodec/Configuration/Configuration.cpp

#include <string> #include <iostream> #include "Configuration.h" #include "../Logger.h" namespace VideoCodec {    Configuration::Configuration(ConfigurationElement* root)    {       this->root = root;    }        Configuration::~Configuration()    {       delete this->root;    }        ConfigurationElement* Configuration::GetConfigurationElement(std::string* name)    {       return this->root->GetValue(*name);    }        ConfigurationElement* Configuration::GetRoot()    {       return this->root;    }        void Configuration::DebugOutput()    {       Logger::BeginIncrementalLogMessage("Configuration Dump");       this->debugOutputConfiguration(this->root);       Logger::EndIncrementalLogMessage("");    }        void Configuration::debugOutputConfiguration(ConfigurationElement* element)    {       // Recursively print out the configuration elements.       if (element->GetType() == CONFIGURATION_PAIRS)       {          Logger::IncrementalLogMessage(" ([");          configurationPairs* pairs = element->GetPairs();          for (configurationPairs::iterator i = pairs->begin(); i != pairs->end(); i++)          {             if (i->second == NULL)                Logger::IncrementalLogMessage("Empty ");             else                debugOutputConfiguration(i->second);                          Logger::IncrementalLogMessage(": ");             Logger::IncrementalLogMessage(i->first->c_str());          }          Logger::IncrementalLogMessage("] : Pairs) ");       }       else if (element->GetType() == CONFIGURATION_LIST)       {          Logger::IncrementalLogMessage(" ([");          configurationList* list = element->GetList();          for (unsigned int i = 0; i < list->size(); i++)          {             debugOutputConfiguration((*list)[i]);          }          Logger::IncrementalLogMessage("] : List) ");       }       else if (element->GetType() == CONFIGURATION_INTEGER)       {          Logger::IncrementalLogMessage(" (");          Logger::IncrementalLogMessage(*element->GetInteger());          Logger::IncrementalLogMessage(" : Integer) ");       }       else if (element->GetType() == CONFIGURATION_FLOAT)       {          Logger::IncrementalLogMessage(" (");          Logger::IncrementalLogMessage(*element->GetFloat());          Logger::IncrementalLogMessage(" : Float) ");       }       else if (element->GetType() == CONFIGURATION_STRING)       {          Logger::IncrementalLogMessage(" (");          Logger::IncrementalLogMessage(element->GetString()->c_str());          Logger::IncrementalLogMessage(" : String) ");       }    } }