diff options
author | Michele Calgaro <[email protected]> | 2025-02-10 15:10:13 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2025-02-10 15:10:13 +0900 |
commit | 203fcb8d90752b546c672c625927a136b959fcfb (patch) | |
tree | a899621e4cb63e2cdd9b94f889ee9d0ae8561bf0 /src/ksquirrelpart/sq_config.h | |
parent | 98c274834c63c7fa4a9a494fdf7cd483336714d5 (diff) | |
download | ksquirrel-203fcb8d90752b546c672c625927a136b959fcfb.tar.gz ksquirrel-203fcb8d90752b546c672c625927a136b959fcfb.zip |
Rename 'ksquirrel' folder to 'src'
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/ksquirrelpart/sq_config.h')
-rw-r--r-- | src/ksquirrelpart/sq_config.h | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/src/ksquirrelpart/sq_config.h b/src/ksquirrelpart/sq_config.h new file mode 100644 index 0000000..73cf0c4 --- /dev/null +++ b/src/ksquirrelpart/sq_config.h @@ -0,0 +1,136 @@ +/*************************************************************************** + sq_config.h - description + ------------------- + begin : ??? ??? 14 2004 + copyright : (C) 2004 by Baryshev Dmitry + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef SQ_CONFIG_H +#define SQ_CONFIG_H + +#include <tqobject.h> +#include <tdeconfig.h> + +class TDEConfig; + +/* + * Class for reading/writing config file + */ + +class SQ_Config : public TQObject +{ + public: + SQ_Config(TQObject *parent = 0); + ~SQ_Config(); + + static SQ_Config* instance() { return m_instance; } + + void sync(); + + void setGroup(const TQString &group); + bool hasGroup(const TQString &group) const; + bool deleteGroup( const TQString& group, bool bDeep = true, bool bGlobal = false ); + TQString readEntry(const TQString& pKey, const TQString& aDefault = TQString() ) const; + TQStringList readListEntry( const TQString& pKey, char sep = ',' ) const; + int readNumEntry( const TQString& pKey, int nDefault = 0 ) const; + bool readBoolEntry( const TQString& pKey, bool bDefault = false ) const; + TQRect readRectEntry( const TQString& pKey, const TQRect* pDefault = 0L ) const; + TQPoint readPointEntry( const TQString& pKey, const TQPoint* pDefault = 0L ) const; + TQSize readSizeEntry( const TQString& pKey, const TQSize* pDefault = 0L ) const; + double readDoubleNumEntry( const TQString& pKey, double nDefault = 0.0 ) const; + TQValueList<int> readIntListEntry( const TQString& pKey ) const; + + void writeEntry( const TQString& pKey, const TQString& pValue, bool bPersistent = true, bool bGlobal = false, bool bNLS = false ); + void writeEntry( const TQString& pKey, const TQStringList &rValue, char sep = ',', bool bPersistent = true, bool bGlobal = false, bool bNLS = false ); + void writeEntry( const TQString& pKey, int nValue, bool bPersistent = true, bool bGlobal = false, bool bNLS = false ); + void writeEntry( const TQString& pKey, bool bValue, bool bPersistent = true, bool bGlobal = false, bool bNLS = false ); + void writeEntry( const TQString& pKey, const TQRect& rValue, bool bPersistent = true, bool bGlobal = false, bool bNLS = false ); + void writeEntry( const TQString& pKey, const TQPoint& rValue, bool bPersistent = true, bool bGlobal = false, bool bNLS = false ); + void writeEntry( const TQString& pKey, const TQSize& rValue, bool bPersistent = true, bool bGlobal = false, bool bNLS = false ); + void writeEntry( const TQString& pKey, double nValue, bool bPersistent = true, bool bGlobal = false, char format = 'g', int precision = 6, bool bNLS = false ); + void writeEntry( const TQString& pKey, const TQValueList<int>& rValue, bool bPersistent = true, bool bGlobal = false, bool bNLS = false ); + + private: + TDEConfig *tdeconf; + static SQ_Config *m_instance; +}; + +inline +void SQ_Config::sync() { tdeconf->sync(); } + +inline +void SQ_Config::setGroup(const TQString &group) { tdeconf->setGroup(group) ; } + +inline +bool SQ_Config::hasGroup(const TQString &group) const { return tdeconf->hasGroup(group) ; } + +inline +bool SQ_Config::deleteGroup(const TQString& group, bool bDeep, bool bGlobal) { return tdeconf->deleteGroup(group, bDeep, bGlobal) ; } + +inline +TQString SQ_Config::readEntry(const TQString& pKey, const TQString& aDefault) const { return tdeconf->readEntry(pKey, aDefault) ; } + +inline +TQStringList SQ_Config::readListEntry(const TQString& pKey, char sep) const { return tdeconf->readListEntry(pKey, sep) ; } + +inline +int SQ_Config::readNumEntry(const TQString& pKey, int nDefault) const { return tdeconf->readNumEntry(pKey, nDefault) ; } + +inline +bool SQ_Config::readBoolEntry(const TQString& pKey, bool bDefault) const { return tdeconf->readBoolEntry(pKey, bDefault ) ; } + +inline +TQRect SQ_Config::readRectEntry(const TQString& pKey, const TQRect* pDefault) const { return tdeconf->readRectEntry(pKey, pDefault) ; } + +inline +TQPoint SQ_Config::readPointEntry(const TQString& pKey, const TQPoint* pDefault) const { return tdeconf->readPointEntry(pKey, pDefault) ; } + +inline +TQSize SQ_Config::readSizeEntry(const TQString& pKey, const TQSize* pDefault) const { return tdeconf->readSizeEntry(pKey, pDefault) ; } + +inline +double SQ_Config::readDoubleNumEntry(const TQString& pKey, double nDefault) const { return tdeconf->readDoubleNumEntry(pKey, nDefault); } + +inline +TQValueList<int> SQ_Config::readIntListEntry( const TQString& pKey ) const { return tdeconf->readIntListEntry(pKey); } + +/**********************************************/ + +inline +void SQ_Config::writeEntry(const TQString& pKey, const TQString& pValue, bool bPersistent, bool bGlobal, bool bNLS) { tdeconf->writeEntry( pKey, pValue, bPersistent, bGlobal, bNLS ) ; } + +inline +void SQ_Config::writeEntry(const TQString& pKey, const TQStringList &rValue, char sep, bool bPersistent, bool bGlobal, bool bNLS ) { tdeconf->writeEntry(pKey, rValue, sep, bPersistent, bGlobal, bNLS ) ; } + +inline +void SQ_Config::writeEntry(const TQString& pKey, int nValue, bool bPersistent, bool bGlobal, bool bNLS ) { tdeconf->writeEntry(pKey, nValue, bPersistent, bGlobal, bNLS ) ; } + +inline +void SQ_Config::writeEntry(const TQString& pKey, bool bValue, bool bPersistent, bool bGlobal, bool bNLS ) { tdeconf->writeEntry(pKey, bValue, bPersistent, bGlobal, bNLS ) ; } + +inline +void SQ_Config::writeEntry(const TQString& pKey, const TQRect& rValue, bool bPersistent, bool bGlobal, bool bNLS ) { tdeconf->writeEntry(pKey, rValue, bPersistent, bGlobal, bNLS ) ; } + +inline +void SQ_Config::writeEntry(const TQString& pKey, const TQPoint& rValue, bool bPersistent, bool bGlobal, bool bNLS ) { tdeconf->writeEntry(pKey, rValue, bPersistent, bGlobal, bNLS ) ; } + +inline +void SQ_Config::writeEntry(const TQString& pKey, const TQSize& rValue, bool bPersistent, bool bGlobal, bool bNLS ) { tdeconf->writeEntry(pKey,rValue, bPersistent, bGlobal, bNLS ) ; } + +inline +void SQ_Config::writeEntry( const TQString& pKey, double nValue, bool bPersistent, bool bGlobal, char format, int precision, bool bNLS) { tdeconf->writeEntry(pKey, nValue, bPersistent, bGlobal, format, precision, bNLS); } + +inline +void SQ_Config::writeEntry( const TQString& pKey, const TQValueList<int>& rValue, bool bPersistent, bool bGlobal, bool bNLS) { tdeconf->writeEntry(pKey, rValue, bPersistent, bGlobal, bNLS); } + +#endif |