KVIrc  4.9.2
DeveloperAPIs
KviEnvironment.h
Go to the documentation of this file.
1 #ifndef _KVI_ENV_H_
2 #define _KVI_ENV_H_
3 
4 //=============================================================================
5 //
6 // File : KviEnvironment.h
7 // Creation date : Sat May 05 2002 02:15:21 CEST by Szymon Stefanek
8 //
9 // This file is part of the KVIrc IRC client distribution
10 // Copyright (C) 2002-2010 Szymon Stefanek (pragma@kvirc.net)
11 //
12 // This program is FREE software. You can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the HOPE that it will be USEFUL,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 // See the GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program. If not, write to the Free Software Foundation,
24 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 //
26 //=============================================================================
27 
34 #include "kvi_settings.h"
35 
36 #include <stdlib.h>
37 
38 #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
39 #include <windows.h>
40 #endif
41 
42 namespace KviEnvironment
43 {
44 
50  inline char * getVariable(const char * name)
51  {
52  return getenv(name);
53  }
54 
55 #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
56 
57  inline void setVariable(const char * szName, const char * szValue)
58  {
59  SetEnvironmentVariable(szName, szValue);
60  }
61 
62  inline void unsetVariable(const char * name)
63  {
64  SetEnvironmentVariable(name, NULL);
65  }
66 #else
67 
73  KVILIB_API bool setVariable(const char * name, const char * value);
74 
80  KVILIB_API void unsetVariable(const char * name);
81 #endif
82 }
83 
84 #endif //_KVI_ENV_H_
char * getVariable(const char *name)
Gets environment variable.
Definition: KviEnvironment.h:50
char * NULL
Definition: KviIrcNumericCodes.h:391
void unsetVariable(const char *)
Unsets environment variable.
Definition: KviEnvironment.cpp:95
bool setVariable(const char *, const char *)
Sets environment variable.
Definition: KviEnvironment.cpp:59
QString name()
Definition: KviRuntimeInfo.cpp:655
This file contains compile time settings.
#define KVILIB_API
Definition: kvi_settings.h:125