• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDevelop Platform Libraries
  • Sitemap
  • Contact Us
 

util

KDevelop::EnvironmentGroupList

KDevelop::EnvironmentGroupList Class Reference

#include <environmentgrouplist.h>

List of all members.


Detailed Description

This class manages a list of environment groups, each group containing a number of environment variables and their values.

The class is constructed from a KConfig object for easy usage in the plugins.

The methods to change the environments is protected to disallow access to those methods from plugins, only the environment widget is allowed to change them.

Example Usage

   KSharedConfigPtr config = KGlobal::config();
   EnvironmentGroupList env(config);
   KConfigGroup cfg(config, "QMake Builder");
   QMap<QString,QString> myenvVars = env.variables( cfg.readEntry("QMake Environment") );

Two entries are used by this class: "Default Environment Group" and "Environment Variables".

"Default Environment Variables" stores the default group that should be used if the user didn't select a group via a plugins configuration dialog.

"Environment Variables" entry stores the actual list of <groupnamevarname=varvalue>. The groupname can't contain '' or '='. For example, suppose that two configuration, say "release" and "debug" exist. Then the actual contents of .kdev4 project file will be

 [Environment Settings]
 Default Environment Group=debug
 Environment Variables=debug_PATH=/home/kde-devel/usr/bin,release_PATH=/usr/bin

Definition at line 69 of file environmentgrouplist.h.


Public Member Functions

QStringList createEnvironment (const QString &group, const QStringList &defaults) const
QString defaultGroup () const
 EnvironmentGroupList (KConfig *config)
 EnvironmentGroupList (KSharedConfigPtr config)
QStringList groups () const
const QMap< QString, QString > variables (const QString &group) const

Protected Member Functions

void loadSettings (KConfig *config)
void removeGroup (const QString &group)
void saveSettings (KConfig *config) const
void setDefaultGroup (const QString &group)
QMap< QString, QString > & variables (const QString &group)

Constructor & Destructor Documentation

KDevelop::EnvironmentGroupList::EnvironmentGroupList ( KSharedConfigPtr  config  ) 

Creates an a list of EnvironmentGroups from a KConfig object.

Parameters:
config the KConfig object to read the environment groups from

Definition at line 76 of file environmentgrouplist.cpp.


Member Function Documentation

QStringList KDevelop::EnvironmentGroupList::createEnvironment ( const QString &  group,
const QStringList &  defaults 
) const

Creates a merged environment between the defaults specified by defaultEnvironment and those saved in group.

Definition at line 148 of file environmentgrouplist.cpp.

QString KDevelop::EnvironmentGroupList::defaultGroup (  )  const

returns the default group The default group should be used by plugins unless the user chooses a different group

Returns:
the name of the default group, defaults to "default"

Definition at line 107 of file environmentgrouplist.cpp.

QStringList KDevelop::EnvironmentGroupList::groups (  )  const

Fetch the list of known groups from the list.

Returns:
the list of groups

Definition at line 133 of file environmentgrouplist.cpp.

void KDevelop::EnvironmentGroupList::saveSettings ( KConfig *  config  )  const [protected]

Stores the environment groups in this list to the given KConfig object.

Parameters:
config a KConfig object to which the environment settings should be stored

Definition at line 120 of file environmentgrouplist.cpp.

void KDevelop::EnvironmentGroupList::setDefaultGroup ( const QString &  group  )  [protected]

Changes the default group.

Parameters:
group a new groupname, if a group of this name doesn't exist the default group is not changed

Definition at line 112 of file environmentgrouplist.cpp.

QMap< QString, QString > & KDevelop::EnvironmentGroupList::variables ( const QString &  group  )  [protected]

returns the variables that are set for a given group.

This function provides write access to the environment, so new variables can be inserted, existing ones changed or deleted

If a non-existing group is specified this returns a new empty map and that way this function can be used to add a new group to the list of environment groups

Parameters:
group the name of the group for which the environment should be returned
Returns:
a map containing the environment variables for this group, or an empty map if the group doesn't exist in this list

Definition at line 101 of file environmentgrouplist.cpp.

const QMap< QString, QString > KDevelop::EnvironmentGroupList::variables ( const QString &  group  )  const

returns the variables that are set for a given group.

This function provides read-only access to the environment

Parameters:
group the name of the group for which the environment should be returned
Returns:
a map containing the environment variables for this group, or an empty map if the group doesn't exist in this list

Definition at line 96 of file environmentgrouplist.cpp.


The documentation for this class was generated from the following files:
  • environmentgrouplist.h
  • environmentgrouplist.cpp

util

Skip menu "util"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDevelop Platform Libraries

Skip menu "KDevelop Platform Libraries"
  • interfaces
  • language
  •   codegen
  •   duchain
  •   editor
  • outputview
  •     interfaces
  • project
  • shell
  • sublime
  • util
  • vcs
Generated for KDevelop Platform Libraries by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal