MProperties.h
1 /*****************************************************************************
2 **
3 ** Header file for Virtual Vertex MProperties class
4 **
5 ** Name : MProperties.h
6 ** Author : Leonardo Bernardini
7 ** Version : Alpha 9.0 Wed May 17th 2017
8 **
9 ** Copyright 2000-2017, 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 
52  struct itemAttribute;
53 
59  typedef std::map <std::string, itemAttribute> itemAttributesMap;
65  class MCLIENTLIB_API MPropertiesMap {
66 
67  public:
68 
74  kNotModified = 0,
75  kModified = 1,
76  kNew = 2
77  } ;
78 
79  MPropertiesMap();
80  ~MPropertiesMap();
82  void clear();
83  size_t getSize();
84  bool isEmpty();
85  bool removeKey(const char* key);
86  std::vector<std::string> getKeys();
87  itemAttributesMap& getMap();
89  bool getFloat(const char* key, float& dest, bool* state = 0);
90  bool getInt(const char* key, int& dest, bool* state= 0);
91  bool getBool(const char* key, bool& dest, bool* state= 0);
92  bool getString(const char* key, std::string& dest, bool* state= 0, bool* subst = 0);
93  bool getTimet(const char* key, time_t& dest, bool* state= 0);
94  bool getLong(const char* key, long& dest, bool* state= 0);
95  bool getInt64(const char* key, long long int& dest, bool* state= 0);
96  std::string getString(const char* key);
98  void setFloat(const char* key, float value, bool state = true, bool notModified=false);
99  void setInt(const char* key, int value, bool state = true, bool notModified=false);
100  void setBool(const char* key, bool value, bool state = true, bool notModified=false);
101  void setString(const char* key, std::string value, bool state = true, bool subst = false, bool notModified=false);
102  void setTimet(const char* key, time_t* value, bool state = true, bool notModified=false);
103  void setLong(const char* key, long value, bool state = true, bool notModified=false);
104  void setInt64(const char* key, long long int value, bool state = true, bool notModified=false);
106  bool isEnabled(const char* key);
108  private:
109  itemAttributesMap map;
110 
111  };
112 
117  typedef struct itemAttribute
118  {
119  std::string value;
120  bool state;
121  bool subst;
123  } itemAttribute;
124 
126 };
127 
128 #endif
MPropertiesMap::kItemModifiedStatus modified
Definition: MProperties.h:122
itemAttribute structure that holds the status of an item inside the MPropertiesMap ...
Definition: MProperties.h:117
Class holding a set of properties of a MJob.
Definition: MProperties.h:65
struct MClientLib::itemAttribute itemAttribute
itemAttribute structure that holds the status of an item inside the MPropertiesMap ...
kItemModifiedStatus
Enumerates the modification status of an item in the properties map.
Definition: MProperties.h:73
std::map< std::string, itemAttribute > itemAttributesMap
Definition: MProperties.h:52