PProperties.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PMap.h>
17 
18 PAPILLON_BEGIN_NAMESPACE
19 
38 class PAPILLON_API_CORE PProperties : public PStringMap
39 {
40 public:
44  static const PProperties& Empty() { static const PProperties EMPTY; return EMPTY; }
45 
49  PProperties();
50 
54  PProperties(const PProperties& other);
55 
66  static PProperties CreateFromKeyValueString(const PString& s);
67 
71  PProperties& operator=(const PProperties& other);
72 
76  PProperties Clone() const;
77 
84  PProperties& Set(const PString& key, const PObject& value);
85 
92  PProperties& SetObject(const PString& key, const PObject& value);
93 
100  PProperties& Set(const PString& key, const char* value);
101 
108  PProperties& SetString(const PString& key, const char* value);
109 
116  PProperties& Set(const PString& key, bool value);
117 
124  PProperties& SetBool(const PString& key, bool value);
125 
132  PProperties& Set(const PString& key, papillon::int32 value);
133 
140  PProperties& SetInt32(const PString& key, papillon::int32 value);
141 
148  PProperties& Set(const PString& key, papillon::int64 value);
149 
156  PProperties& SetInt64(const PString& key, papillon::int64 value);
157 
164  PProperties& Set(const PString& key, float value);
165 
172  PProperties& SetFloat(const PString& key, float value);
173 
180  PProperties& Set(const PString& key, double value);
181 
188  PProperties& SetDouble(const PString& key, double value);
189 
194  bool GetBool(const PString& key, bool* ok = NULL) const;
195 
200  papillon::int32 GetInt32(const PString& key, bool* ok = NULL) const;
201 
206  papillon::int64 GetInt64(const PString& key, bool* ok = NULL) const;
207 
212  float GetFloat(const PString& key, bool* ok = NULL) const;
213 
218  double GetDouble(const PString& key, bool* ok = NULL) const;
219 
224  PString GetAsString(const PString& name) const;
225 
230  int32 RemoveByRegexp(const PString& pattern);
231 
235  PString ToStringLog() const;
236 
257  static PResult Stringify(const PObject& object, PString& propertyType, PString& propertyValue);
258 
268  static PResult Destringify(const PString& propertyType, const PString& propertyValue, PObject& object);
269 };
270 
271 PAPILLON_END_NAMESPACE
The PString class provides an Unicode character strings.
Definition: PString.h:38
static const PProperties & Empty()
Returns the constant holding an empty PProperties container.
Definition: PProperties.h:44
papillon::PMap< papillon::PString, papillon::PObject > PStringMap
Definition: PMap.h:167
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
Class PMap: a generic associative container (map).
The PProperties class represents a container of properties; each property has a name (PString) and a ...
Definition: PProperties.h:38
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27