jamulus/src/settings.h

89 lines
3.4 KiB
C
Raw Normal View History

2006-01-28 12:29:22 +01:00
/******************************************************************************\
* Copyright (c) 2004-2006
*
* Author(s):
* Volker Fischer, Robert Kesterson
2006-01-28 12:29:22 +01:00
*
******************************************************************************
*
* This program 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 2 of the License, or (at your option) any later
* version.
*
* This program 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
* this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
\******************************************************************************/
#if !defined(SETTINGS_H__3B0BA660_DGEG56G456G9876D31912__INCLUDED_)
#define SETTINGS_H__3B0BA660_DGEG56G456G9876D31912__INCLUDED_
#include "global.h"
#include "client.h"
#include <map>
#include <string>
#include <fstream>
/* Definitions ****************************************************************/
// name of the init-file
#define LLCON_INIT_FILE_NAME "llcon.ini"
2006-01-28 12:29:22 +01:00
/* change this if you expect to have huge lines in your INI files. Note that
this is the max size of a single line, NOT the max number of lines */
#define MAX_INI_LINE 500
2006-01-28 12:29:22 +01:00
/* Classes ********************************************************************/
class CSettings
{
public:
CSettings ( CClient* pNCliP ) : pClient ( pNCliP ) {}
2006-01-28 12:29:22 +01:00
void Load ();
void Save ();
2006-01-28 12:29:22 +01:00
protected:
void ReadIniFile ();
void WriteIniFile ();
/* Function declarations for stlini code written by Robert Kesterson */
struct StlIniCompareStringNoCase
{
bool operator () ( const std::string& x, const std::string& y ) const;
};
/* These typedefs just make the code a bit more readable */
typedef std::map<string, string, StlIniCompareStringNoCase > INISection;
typedef std::map<string, INISection , StlIniCompareStringNoCase > INIFile;
string GetIniSetting( INIFile& theINI, const char* pszSection,
const char* pszKey, const char* pszDefaultVal = "" );
void PutIniSetting ( INIFile &theINI, const char *pszSection,
const char* pszKey = NULL, const char* pszValue = "" );
void SaveIni ( INIFile& theINI, const char* pszFilename );
INIFile LoadIni ( const char* pszFilename );
void SetNumericIniSet ( INIFile& theINI, string strSection, string strKey,
int iValue );
bool GetNumericIniSet ( INIFile& theINI, string strSection, string strKey,
int iRangeStart, int iRangeStop, int& iValue );
void SetFlagIniSet ( INIFile& theINI, string strSection, string strKey,
bool bValue );
bool GetFlagIniSet ( INIFile& theINI, string strSection, string strKey,
bool& bValue );
/* Pointer to the client object needed for the various settings */
CClient* pClient;
2006-01-28 12:29:22 +01:00
};
#endif // !defined(SETTINGS_H__3B0BA660_DGEG56G456G9876D31912__INCLUDED_)