/* * * ProLinga-Validate * * Copyright (C) 2002-2008 Xobas Software. * All rights reserved. * * This file is part of ProLinga-Validate. * * ProLinga-Validate is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ProLinga-Validate is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ProLinga-Validate. If not, see . * * More information is available at the following addresses: * * Website : http://www.prolinga.org * * Email : prolinga-list@prolinga.org * * */ #ifndef __VAL_CONFIG_HPP #define __VAL_CONFIG_HPP #define PRODUCT_NAME "Validate" /* Default configuration settings */ #define DEF_CONFIG_FILE SYSCONFDIR"/prolingavalcfg.xml" /* Config file name */ #define DEF_SYNTAX_FILE PROLINGADATADIR"/langvalid.xml" /* Language Definition file name */ #define DEF_LOG_FILE "prolinga.log" /* Log file name */ #define DEF_LOG_LEVEL 2 /* Log Level */ #define DEF_CLIENT_HOST "localhost" /* Client Hostname or IP */ #define DEF_CLIENT_PORT 8003 /* Client TCP port */ #define DEF_CLIENT_COMP_LEVEL 6 /* Client TCP port */ #define DEF_SERVER_HOST "localhost" /* Server Hostname or IP */ #define DEF_SERVER_PORT 8003 /* Server TCP port */ #define DEF_THREADS 5 /* Number of Threads */ #define DEF_SERVER_COMP_LEVEL 6 /* Compression Level (range 0-9) */ #define DEF_REPOSITORY_HOST "localhost" /* Repository Hostname or IP */ #define DEF_REPOSITORY_PORT 8001 /* Repository TCP port */ #define DEF_REPOSITORY_COMP_LEVEL 6 /* Compression Level (range 0-9) */ #define DEF_TRANSFORM_ONLY "False" /* Transform and include Syntax check */ /* XML Config keys */ #define ENV_KEY_LOGFILE "LogFile" #define ENV_KEY_LOGLEVEL "LogLevel" #define ENV_KEY_THREADS "NumberOfThreads" #define ENV_KEY_CLIENT_HOST "ClientHost" #define ENV_KEY_CLIENT_PORT "ClientPort" #define ENV_KEY_CLIENT_COMP "ClientCompressionLevel" #define ENV_KEY_SERVER_HOST "ServerHost" #define ENV_KEY_SERVER_PORT "ServerPort" #define ENV_KEY_SERVER_COMP "ServerCompressionLevel" #define ENV_KEY_REPOSITORY_HOST "RepositoryHost" #define ENV_KEY_REPOSITORY_PORT "RepositoryPort" #define ENV_KEY_TRANSFORM_ONLY "TransformOnly" /* Log Levels */ #define LOG_LEVEL_0 0 /* No logging */ #define LOG_LEVEL_1 1 /* Free */ #define LOG_LEVEL_2 2 /* + Messages/Errors */ #define LOG_LEVEL_3 3 /* Free */ #define LOG_LEVEL_4 4 /* + Soap request/response info */ #define LOG_LEVEL_5 5 /* Free */ class ConfigValSetting { friend class ConfigVal; public: ConfigValSetting(); ~ConfigValSetting(); private: char *getStringValue(ConfigValSetting *confsetPtr, const char *name, const char *defValue); int getNumberValue(ConfigValSetting *confsetPtr, const char *name, const int defValue); void putStringValue(ConfigValSetting **confsetPtr, const char *name, const char *value); void putNumberValue(ConfigValSetting **confsetPtr, const char *name, const int value); void deleteList(ConfigValSetting **confsetPtr); void printList(ConfigValSetting *confsetPtr) const; char confsetName[32]; char *confsetStringValue; int confsetNumberValue; ConfigValSetting *nextPtr; }; typedef ConfigValSetting *ConfigValSettingPtr; class ConfigVal { public: ConfigVal(const char *configFileName); ~ConfigVal(); char *getStringValue(const char *name, const char *defValue); int getNumberValue(const char *name, const int defValue); void putStringValue(const char *name, const char *value); void putNumberValue(const char *name, const int value); void writeConfig(const char *logFileName) const; void printList(void) const; private: ConfigValSetting *startPtr; }; typedef ConfigVal *ConfigValPtr; #endif /* __VAL_CONFIG_HPP */