Source Code (Use browser search to find items of interest.)

Class Index

kdelibs'KConfigBackEnd (./kdelibs/kdecore/kconfigbackend.h:46)

class KConfigBackEnd
{
public:
  /**
   * Construct a configuration back end.
   *
   * @param _config Specifies the configuration object which values
   *        will be passed to as they are read, or from where values
   *        to be written to will be obtained from.
   * @param _fileName The name of the file in which config
   *        data is stored.  All registered configuration directories
   *        will be looked in in order of decreasing relevance.
   * @param _resType the resource type of the fileName specified, _if_
   *        it is not an absolute path (otherwise this parameter is ignored).
   * @param _useKDEGlobals If true, the user's system-wide kdeglobals file 
   *        will be imported into the config object.  If false, only 
   *        the filename specified will be dealt with.
   */
  KConfigBackEnd(KConfigBase *_config, const QString &_fileName,
		 const QString &_resType, bool _useKDEGlobals);
  
  /**
   * Destructor.
   */
  virtual ~KConfigBackEnd() {};

  /** 
   * Parse all configuration files for a configuration object.  This
   * method must be reimplemented by the derived classes.
   * 
   * @returns Whether or not parsing was successful.  
   */
  virtual bool parseConfigFiles() = 0;

  /**
   * Write configuration data to file(s).  This method must be
   * reimplemented by the derived classes.
   *
   * @param bMerge Specifies whether the old config file already
   *        on disk should be merged in with the data in memory.  If true,
   *        data is read off the disk and merged.  If false, the on-disk
   *        file is removed and only in-memory data is written out.
   */
  virtual void sync(bool bMerge = true) = 0;

  /**
   * change the filenames associated with this back end.  You should
   * probably reparse your config info after doing this.
   *
   * @param _fileName the new filename to use
   * @param _resType the resource type of the fileName specified, _if_
   *        it is not an absolute path (otherwise this parameter is ignored).
   * @param _useKDEGlobals specifies whether or not to also parse the
   *        global KDE configuration files.
   */
  void changeFileName(const QString &_fileName, const QString &_resType,
		      bool _useKDEGlobals)
      { 
	fileName = _fileName; resType = _resType;
	useKDEGlobals = _useKDEGlobals;
      }

  /**
   * Retrieve the state of the app-config object.
   *
   * @see KConfig::getConfigState
   */
  virtual KConfigBase::ConfigState getConfigState() const
    { return KConfigBase::NoAccess; }

  /**
   * @return the filename as passed to the constructor.
   */
  QString filename() const { return fileName; }
  
  /**
   * @return the resource type as passed to the constructor.
   */
  QString resource() const { return resType; }

protected:
  KConfigBase *pConfig;

  QString fileName;
  QString resType;
  bool useKDEGlobals;

  KConfigBackEndPrivate *d;
};


kdelibs'KConfigBackEnd::KConfigBackEnd() (./kdelibs/kdecore/kconfigbackend.cpp:92)

KConfigBackEnd::KConfigBackEnd(KConfigBase *_config,
			       const QString &_fileName,
			       const QString &_resType,
			       bool _useKDEGlobals)
  : pConfig(_config), fileName(_fileName),
    resType(_resType), useKDEGlobals(_useKDEGlobals)
{
}