~ubuntu-branches/ubuntu/oneiric/codelite/oneiric

« back to all changes in this revision

Viewing changes to Plugin/environmentconfig.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-04-09 02:03:19 UTC
  • mfrom: (0.1.3 sid) (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100409020319-302693n3vroavxwe
Tags: 2.5.2.4031~dfsg-1
* New upstream release.
* Refresh patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
//
23
23
//////////////////////////////////////////////////////////////////////////////
24
24
//////////////////////////////////////////////////////////////////////////////
25
 
 #ifndef __environmentconfig__
 
25
#ifndef __environmentconfig__
26
26
#define __environmentconfig__
27
27
 
28
28
#include "configurationtoolbase.h"
29
29
#include "archive.h"
30
30
#include "evnvarlist.h"
31
31
 
32
 
class EnvironmentConfig : public ConfigurationToolBase {
 
32
class EnvSetter;
 
33
class EnvironmentConfig : public ConfigurationToolBase
 
34
{
 
35
        // Allow access to Apply/UnApply Env
 
36
        friend class EnvSetter;
33
37
 
34
38
        static EnvironmentConfig* ms_instance;
35
39
        StringMap m_envSnapshot;
 
40
        int       m_envApplied;
 
41
 
 
42
protected:
 
43
        wxString    DoExpandVariables(const wxString &in);
 
44
        void        ApplyEnv(StringMap *overrideMap);
 
45
        void        UnApplyEnv();
36
46
 
37
47
public:
38
48
        static EnvironmentConfig* Instance();
39
49
        static void Release();
40
 
        bool Load();
41
 
        wxString ExpandVariables(const wxString &in);
42
 
        void ApplyEnv(StringMap *overrideMap);
43
 
        void UnApplyEnv();
44
 
        EvnVarList GetSettings();
45
 
        void       SetSettings(EvnVarList &vars);
 
50
        bool        Load();
 
51
        wxString    ExpandVariables(const wxString &in, bool applyEnvironment);
 
52
        EvnVarList  GetSettings();
 
53
        void        SetSettings(EvnVarList &vars);
 
54
 
46
55
private:
47
56
        EnvironmentConfig();
48
57
        virtual ~EnvironmentConfig();
60
69
        }
61
70
 
62
71
        EnvSetter(EnvironmentConfig *conf, StringMap *om = NULL) : m_env(conf) {
63
 
                if(m_env) {
 
72
                if (m_env) {
64
73
                        m_env->ApplyEnv(om);
65
74
                }
66
75
        }
67
76
        ~EnvSetter() {
68
 
                if(m_env) {
 
77
                if (m_env) {
69
78
                        m_env->UnApplyEnv();
70
79
                        m_env = NULL;
71
80
                }