Muster SDK  8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MProperties.h
Go to the documentation of this file.
1 /*****************************************************************************
2 **
3 ** Header file for Virtual Vertex MProperties class
4 **
5 ** Name : MProperties.h
6 ** Author : Leonardo Bernardini
7 ** Version : Alpha 0.1, Sun Aug 15th 2006
8 **
9 ** Copyright 2000-2014, Virtual Vertex
10 ** All Rights Reserved.
11 **
12 ** This file contains UNPUBLISHED PROPRIETARY SOURCE CODE.
13 ** The contents of this file may not be disclosed to third parties, copied
14 ** or duplicated in any form, in whole or in part, without the prior written
15 ** permission of the author.
16 **
17 *****************************************************************************/
18 
19 #ifndef MPROPERTIES_H
20 #define MPROPERTIES_H
21 
22 #ifdef WIN32
23 // Windows definitions
24 #ifdef MCLIENTLIB_EXPORTS
25 #define MCLIENTLIB_API __declspec(dllexport)
26 #else
27 #define MCLIENTLIB_API __declspec(dllimport)
28 #endif
29 #else
30 
31 #ifndef MCLIENTLIB_EXPORTS
32 #ifdef LINUX
33 #define MCLIENTLIB_API
34 #else
35 #define MCLIENTLIB_API
36 #endif
37 #else
38 #define MCLIENTLIB_API
39 #endif
40 #endif
41 
42 #if defined(_WIN32)
43 #pragma warning(disable: 4251)
44 #endif // _WIN32
45 
46 #include <map>
47 #include <vector>
48 #include <string>
49 
50 namespace MClientLib {
51 
55  typedef struct itemAttribute
56  {
57  std::string value;
58  bool state;
59  bool subst;
60  int modified;
61  } itemAttribute;
62 
63  typedef std::map <std::string,itemAttribute> itemAttributesMap;
64 
69 
70  public:
71 
76  kNotModified = 0,
77  kModified = 1,
78  kNew = 2
79  } ;
80 
82  ~MPropertiesMap();
83 
84  void clear();
85  size_t getSize();
86  bool isEmpty();
87  bool removeKey(const char* key);
88  std::vector<std::string> getKeys();
89  itemAttributesMap& getMap();
90 
91  bool getFloat(const char* key, float& dest, bool* state = 0);
92  bool getInt(const char* key, int& dest, bool* state= 0);
93  bool getBool(const char* key, bool& dest, bool* state= 0);
94  bool getString(const char* key, std::string& dest, bool* state= 0, bool* subst = 0);
95  bool getTimet(const char* key, time_t& dest, bool* state= 0);
96  bool getLong(const char* key, long& dest, bool* state= 0);
97  bool getInt64(const char* key, long long int& dest, bool* state= 0);
98 
99  void setFloat(const char* key, float value, bool state = true, bool notModified=false);
100  void setInt(const char* key, int value, bool state = true, bool notModified=false);
101  void setBool(const char* key, bool value, bool state = true, bool notModified=false);
102  void setString(const char* key, std::string value, bool state = true, bool subst = false, bool notModified=false);
103  void setTimet(const char* key, time_t* value, bool state = true, bool notModified=false);
104  void setLong(const char* key, long value, bool state = true, bool notModified=false);
105  void setInt64(const char* key, long long int value, bool state = true, bool notModified=false);
106 
107  std::string getString(const char* key);
108  bool isEnabled(const char* key);
109 
110  private:
111  itemAttributesMap map;
112 
113  };
114 
115 };
116 
117 #endif