Qpid Management Framework  0.24
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Value.h
Go to the documentation of this file.
1 #ifndef _QmfEngineValue_
2 #define _QmfEngineValue_
3 
4 /*
5  * Licensed to the Apache Software Foundation (ASF) under one
6  * or more contributor license agreements. See the NOTICE file
7  * distributed with this work for additional information
8  * regarding copyright ownership. The ASF licenses this file
9  * to you under the Apache License, Version 2.0 (the
10  * "License"); you may not use this file except in compliance
11  * with the License. You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing,
16  * software distributed under the License is distributed on an
17  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  * KIND, either express or implied. See the License for the
19  * specific language governing permissions and limitations
20  * under the License.
21  */
22 
23 #include <qmf/engine/ObjectId.h>
24 #include <qmf/engine/Typecode.h>
25 
26 namespace qmf {
27 namespace engine {
28 
29  class Object;
30  struct ValueImpl;
31 
32  class Value {
33  public:
34  // Value();
35  Value(const Value& from);
37  ~Value();
38 
39  Typecode getType() const;
40  bool isNull() const;
41  void setNull();
42 
43  bool isObjectId() const;
44  const ObjectId& asObjectId() const;
45  void setObjectId(const ObjectId& oid);
46 
47  bool isUint() const;
48  uint32_t asUint() const;
49  void setUint(uint32_t val);
50 
51  bool isInt() const;
52  int32_t asInt() const;
53  void setInt(int32_t val);
54 
55  bool isUint64() const;
56  uint64_t asUint64() const;
57  void setUint64(uint64_t val);
58 
59  bool isInt64() const;
60  int64_t asInt64() const;
61  void setInt64(int64_t val);
62 
63  bool isString() const;
64  const char* asString() const;
65  void setString(const char* val);
66 
67  bool isBool() const;
68  bool asBool() const;
69  void setBool(bool val);
70 
71  bool isFloat() const;
72  float asFloat() const;
73  void setFloat(float val);
74 
75  bool isDouble() const;
76  double asDouble() const;
77  void setDouble(double val);
78 
79  bool isUuid() const;
80  const uint8_t* asUuid() const;
81  void setUuid(const uint8_t* val);
82 
83  bool isObject() const;
84  const Object* asObject() const;
85  void setObject(Object* val);
86 
87  bool isMap() const;
88  bool keyInMap(const char* key) const;
89  Value* byKey(const char* key);
90  const Value* byKey(const char* key) const;
91  void deleteKey(const char* key);
92  void insert(const char* key, Value* val);
93  uint32_t keyCount() const;
94  const char* key(uint32_t idx) const;
95 
96  bool isList() const;
97  uint32_t listItemCount() const;
98  Value* listItem(uint32_t idx);
99  void appendToList(Value* val);
100  void deleteListItem(uint32_t idx);
101 
102  bool isArray() const;
103  Typecode arrayType() const;
104  uint32_t arrayItemCount() const;
105  Value* arrayItem(uint32_t idx);
106  void appendToArray(Value* val);
107  void deleteArrayItem(uint32_t idx);
108 
109  private:
110  friend struct ValueImpl;
111  friend class BrokerProxyImpl;
112  friend struct ObjectImpl;
113  friend struct EventImpl;
114  friend class AgentImpl;
115  Value(ValueImpl* impl);
116  ValueImpl* impl;
117  };
118 }
119 }
120 
121 #endif
122