-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathenvironment.hpp
58 lines (45 loc) · 1.27 KB
/
environment.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* win32/environment.hpp
*
* Copyright (C) 2007 Antonio Di Monaco
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#pragma once
#ifndef __WIN32_ENVIRONMENT_HPP__
#define __WIN32_ENVIRONMENT_HPP__
#include <list>
#include <map>
#include <iostream>
#include <string>
#include <windows.h>
#include "util/string.hpp"
#include "util/singleton.hpp"
namespace Windows
{
namespace Environment
{
class Manager
{
struct CIWideLess
{
bool operator()(const std::wstring &s1,const std::wstring &s2) const
{
return icasecmp(s1,s2) < 0;
}
};
std::map< std::wstring,std::wstring,CIWideLess > _vars;
explicit Manager();
friend std::ostream &operator<<(std::ostream &out, const Manager &m);
friend class Singleton< Manager >;
public:
bool has(const std::wstring &key) const;
std::wstring get(const std::wstring &key, const std::wstring &sDefault = std::wstring()) const;
void set(const std::wstring &key, const std::wstring &value);
void remove(const std::wstring &key);
std::list< std::wstring > keys() const;
};
std::ostream &operator<<(std::ostream &out, const Manager &m);
}
}
#endif