![]() ![]() |
![]() |
1 mike 1.2 //%///////////////////////////////////////////////////////////////////////////// 2 // | ||
3 kumpf 1.3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, | ||
4 mike 1.2 // The Open Group, Tivoli Systems 5 // 6 // Permission is hereby granted, free of charge, to any person obtaining a copy 7 // of this software and associated documentation files (the "Software"), to 8 // deal in the Software without restriction, including without limitation the 9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 // sell copies of the Software, and to permit persons to whom the Software is 11 // furnished to do so, subject to the following conditions: | ||
12 kumpf 1.3 // | ||
13 mike 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED 15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 // 22 //============================================================================== 23 // 24 // Author: Nag Boranna (nagaraja_boranna@hp.com) 25 // 26 // Modified By: 27 // 28 //%///////////////////////////////////////////////////////////////////////////// 29 30 #ifndef Pegasus_ConfigFile_h 31 #define Pegasus_ConfigFile_h 32 33 #include <Pegasus/Common/Config.h> 34 mike 1.2 #include <Pegasus/Config/Linkage.h> 35 #include <Pegasus/Common/String.h> | ||
36 kumpf 1.5 #include <Pegasus/Common/ArrayInternal.h> | ||
37 kumpf 1.4 #include <Pegasus/Common/InternalException.h> | ||
38 mike 1.2 #include <Pegasus/Config/ConfigExceptions.h> 39 40 PEGASUS_NAMESPACE_BEGIN 41 42 //////////////////////////////////////////////////////////////////////////////// 43 // ConfigFile Class 44 //////////////////////////////////////////////////////////////////////////////// 45 46 struct ConfigTable; 47 48 /** 49 This class provides methods to read/write configuration properties from the 50 config file. 51 */ 52 class PEGASUS_CONFIG_LINKAGE ConfigFile 53 { 54 public: 55 56 /** 57 Constructor. 58 59 mike 1.2 @exception FileNotReadable if the specified file is not readable. 60 */ 61 ConfigFile(const String& fileName); 62 //throw (FileNotReadable); 63 64 65 /** Destructor. */ 66 ~ConfigFile( ); 67 68 69 /** 70 Get the name of the configuration file. 71 72 @return String name of the config file. 73 */ 74 String getFileName(); 75 76 77 /** 78 Load the properties from the config file. 79 80 mike 1.2 @param confTable hash table containing the config properties. 81 @exception ConfigFileSyntaxError if config file contains a syntax error. 82 83 Note: Original code was taken from OptionManager::mergeFile() 84 */ 85 void load(ConfigTable* confTable); 86 //throw (ConfigFileSyntaxError); 87 88 89 /** 90 Save the properties to the config file. 91 92 @param confTable hash table containing the config properties. 93 @exception ConnotRenameFile if failed to create the backup file. 94 */ 95 void save(ConfigTable* confTable); 96 //throw (CannotRenameFile); 97 98 99 /** 100 Replace the properties in the config file with the properties from 101 mike 1.2 the given file 102 103 @param fileName the config file name to be copied. 104 @exception NoSuchFile if the specified file cannot be opened. 105 @exception FileNotReadable if the specified file is not readable. 106 @exception CannotRenameFile if failed to create the backup file. 107 */ 108 void replace(const String& fileName); 109 //throw (FileNotReadable, CannotRenameFile); 110 111 112 private: 113 114 String _configFile; 115 String _configBackupFile; 116 117 }; 118 119 120 PEGASUS_NAMESPACE_END 121 122 mike 1.2 #endif /* Pegasus_ConfigFile_h */ |
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |