00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "CEGUIConfig_xmlHandler.h"
00027 #include "CEGUIExceptions.h"
00028 #include "CEGUISystem.h"
00029 #include "CEGUIXMLAttributes.h"
00030
00031
00032
00033 namespace CEGUI
00034 {
00035
00036
00037
00038 const String Config_xmlHandler::CEGUIConfigElement( (utf8*)"CEGUIConfig" );
00039 const char Config_xmlHandler::ConfigLogfileAttribute[] = "Logfile";
00040 const char Config_xmlHandler::ConfigSchemeAttribute[] = "Scheme";
00041 const char Config_xmlHandler::ConfigLayoutAttribute[] = "Layout";
00042 const char Config_xmlHandler::ConfigDefaultFontAttribute[] = "DefaultFont";
00043 const char Config_xmlHandler::ConfigInitScriptAttribute[] = "InitScript";
00044 const char Config_xmlHandler::ConfigTerminateScriptAttribute[] = "TerminateScript";
00045 const char Config_xmlHandler::ConfigDefaultResourceGroupAttribute[] = "DefaultResourceGroup";
00046 const char Config_xmlHandler::ConfigLoggingLevelAttribute[] = "LoggingLevel";
00047
00048 void Config_xmlHandler::elementStart(const String& element, const XMLAttributes& attributes)
00049 {
00050
00051 if (element == CEGUIConfigElement)
00052 {
00053 d_logFilename = attributes.getValueAsString(ConfigLogfileAttribute);
00054 d_schemeFilename = attributes.getValueAsString(ConfigSchemeAttribute);
00055 d_layoutFilename = attributes.getValueAsString(ConfigLayoutAttribute);
00056 d_initScriptFilename = attributes.getValueAsString(ConfigInitScriptAttribute);
00057 d_termScriptFilename = attributes.getValueAsString(ConfigTerminateScriptAttribute);
00058 d_defaultFontName = attributes.getValueAsString(ConfigDefaultFontAttribute);
00059 d_defaultResourceGroup = attributes.getValueAsString(ConfigDefaultResourceGroupAttribute);
00060
00061
00062 String logLevelStr = attributes.getValueAsString(ConfigLoggingLevelAttribute, "Standard");
00063
00064 if (logLevelStr == "Errors")
00065 {
00066 d_logLevel = Errors;
00067 }
00068 else if (logLevelStr == "Informative")
00069 {
00070 d_logLevel = Informative;
00071 }
00072 else if (logLevelStr == "Insane")
00073 {
00074 d_logLevel = Insane;
00075 }
00076 else
00077 {
00078 d_logLevel = Standard;
00079 }
00080 }
00081
00082 else
00083 {
00084 String message("Config_xmlHandler::startElement - Unexpected data was found while parsing the configuration file: '" + element + "' is unknown.");
00085
00086
00087 throw message.c_str();
00088 }
00089
00090 }
00091
00092 }