CACAO
properties.hpp
Go to the documentation of this file.
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 <map> // for map
30 #include "global.hpp" // for java_handle_t
31 #include "vm/os.hpp" // for os
32 
33 class ltstr {
34 public:
35  bool operator()(const char* s1, const char* s2) const
36  {
37  return os::strcmp(s1, s2) < 0;
38  }
39 };
40 
41 
42 /**
43  * Commandline properties.
44  */
45 class Properties {
46 private:
47  std::map<const char*, const char*, ltstr> _properties;
48 
49 private:
50  // Don't allow to copy the properties.
51  Properties(const Properties&);
52 
53 public:
54  Properties();
55 
56  // Static function.
57  static void put(java_handle_t* p, const char* key, const char* value);
58 
59  void put(const char* key, const char* value);
60  const char* get(const char* key);
61  void fill(java_handle_t* p);
62 #if !defined(NDEBUG)
63  void dump();
64 #endif
65 };
66 
67 
68 #endif // PROPERTIES_HPP_
69 
70 
71 /*
72  * These are local overrides for various environment variables in Emacs.
73  * Please do not remove this and leave it at the end of the file, where
74  * Emacs will automagically detect them.
75  * ---------------------------------------------------------------------
76  * Local variables:
77  * mode: c++
78  * indent-tabs-mode: t
79  * c-basic-offset: 4
80  * tab-width: 4
81  * End:
82  * vim:noexpandtab:sw=4:ts=4:
83  */
bool operator()(const char *s1, const char *s2) const
Definition: properties.hpp:35
Commandline properties.
Definition: properties.hpp:45
void fill(java_handle_t *p)
Fill the given Java system properties with all properties from the internal properties map...
Definition: properties.cpp:611
std::map< const char *, const char *, ltstr > _properties
Definition: properties.hpp:47
Properties()
Constructor fills the properties list with default values.
Definition: properties.cpp:60
int8_t s1
Definition: types.hpp:39
int16_t s2
Definition: types.hpp:42
static void put(java_handle_t *p, const char *key, const char *value)
Add the given property to the given Java system properties.
Definition: properties.cpp:531
static int strcmp(const char *s1, const char *s2)
Definition: os.hpp:636
void dump()
Dump all property entries.
Definition: properties.cpp:642