Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

IniFile.h

Go to the documentation of this file.
00001 /* IniFile - Reading and writing .INI files. */ 00002 00003 #ifndef INIFILE_H 00004 #define INIFILE_H 00005 00006 #include "XmlFile.h" 00007 using namespace std; 00008 00009 class RageFileBasic; 00010 00011 class IniFile : public XNode 00012 { 00013 private: 00014 CString m_sPath; 00015 00016 mutable CString m_sError; 00017 00018 public: 00019 IniFile(); 00020 00021 /* Retrieve the filename of the last file loaded. */ 00022 CString GetPath() const { return m_sPath; } 00023 const CString &GetError() const { return m_sError; } 00024 00025 bool ReadFile( const CString &sPath ); 00026 bool ReadFile( RageFileBasic &sFile ); 00027 bool WriteFile( const CString &sPath ) const; 00028 bool WriteFile( RageFileBasic &sFile ) const; 00029 00030 bool GetValue( const CString &key, const CString &valuename, CString& value ) const; 00031 bool GetValue( const CString &key, const CString &valuename, int& value ) const; 00032 bool GetValue( const CString &key, const CString &valuename, unsigned& value ) const; 00033 bool GetValue( const CString &key, const CString &valuename, float& value ) const; 00034 bool GetValue( const CString &key, const CString &valuename, bool& value ) const; 00035 00036 void SetValue( const CString &key, const CString &valuename, const CString &value ); 00037 void SetValue( const CString &key, const CString &valuename, int value ); 00038 void SetValue( const CString &key, const CString &valuename, unsigned value ); 00039 void SetValue( const CString &key, const CString &valuename, float value ); 00040 void SetValue( const CString &key, const CString &valuename, bool value ); 00041 00042 bool DeleteKey( const CString &keyname ); 00043 bool DeleteValue( const CString &keyname, const CString &valuename ); 00044 00045 /* Rename a key. For example, call RenameKey("foo", "main") after 00046 * reading an INI where [foo] is an alias to [main]. If to already 00047 * exists, nothing happens. */ 00048 bool RenameKey( const CString &from, const CString &to ); 00049 }; 00050 00051 #endif 00052 00053 /* 00054 * (c) 2001-2004 Adam Clauss, Chris Danford 00055 * 00056 * All rights reserved. 00057 * 00058 * Permission is hereby granted, free of charge, to any person obtaining a 00059 * copy of this software and associated documentation files (the 00060 * "Software"), to deal in the Software without restriction, including 00061 * without limitation the rights to use, copy, modify, merge, publish, 00062 * distribute, and/or sell copies of the Software, and to permit persons to 00063 * whom the Software is furnished to do so, provided that the above 00064 * copyright notice(s) and this permission notice appear in all copies of 00065 * the Software and that both the above copyright notice(s) and this 00066 * permission notice appear in supporting documentation. 00067 * 00068 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00069 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00070 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00071 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00072 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00073 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00074 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00075 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00076 * PERFORMANCE OF THIS SOFTWARE. 00077 */

Generated on Thu Jan 27 20:57:21 2005 for StepMania by doxygen 1.3.7