582099c0ccee4b16d70cb090568afd9d29d7dbd8
[cacao.git] / src / vm / properties.hpp
1 /* src/vm/properties.hpp - handling commandline properties
2
3    Copyright (C) 1996-2005, 2006, 2007, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #ifndef _PROPERTIES_HPP
27 #define _PROPERTIES_HPP
28
29 #include "config.h"
30
31 #include <stdint.h>
32
33 #ifdef __cplusplus
34
35 #include <map>
36
37 #include "vm/os.hpp"
38
39
40 class ltstr {
41 public:
42         bool operator()(const char* s1, const char* s2) const
43         {
44                 return os::strcmp(s1, s2) < 0;
45         }
46 };
47
48
49 /**
50  * Commandline properties.
51  */
52 class Properties {
53 private:
54         std::map<const char*, const char*, ltstr> _properties;
55
56 public:
57         Properties();
58
59         // Static function.
60         static void put(java_handle_t* p, const char* key, const char* value);
61
62         void        put(const char* key, const char* value);
63         const char* get(const char* key);
64         void        fill(java_handle_t* p);
65 #if !defined(NDEBUG)
66         void        dump();
67 #endif
68 };
69
70 #else
71
72 typedef struct Properties Properties;
73
74 void        Properties_put(const char *key, const char *value);
75 const char *Properties_get(const char *key);
76
77 #endif
78
79 #endif // _PROPERTIES_HPP
80
81
82 /*
83  * These are local overrides for various environment variables in Emacs.
84  * Please do not remove this and leave it at the end of the file, where
85  * Emacs will automagically detect them.
86  * ---------------------------------------------------------------------
87  * Local variables:
88  * mode: c++
89  * indent-tabs-mode: t
90  * c-basic-offset: 4
91  * tab-width: 4
92  * End:
93  * vim:noexpandtab:sw=4:ts=4:
94  */