AWS SDK for C++  0.12.9
AWS SDK for C++
AttributeValueValue.h
Go to the documentation of this file.
1 /*
2 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15 #pragma once
16 
19 
23 
24 #include <cassert>
25 
26 namespace Aws
27 {
28 namespace DynamoDB
29 {
30 namespace Model
31 {
32 
33 class AttributeValue;
34 
36 {
37 public:
38  virtual const Aws::String& GetS() const { return DEFAULT_STRING; }
39 
40  virtual const Aws::String& GetN() const { return DEFAULT_STRING; }
41 
42  virtual const Aws::Utils::ByteBuffer& GetB() const { return DEFAULT_BYTEBUFFER; }
43 
44  virtual const Aws::Vector<Aws::String>& GetSS() const { return DEFAULT_STRING_SET; }
45 
46  virtual void AddSItem(const Aws::String& ) { assert(false); }
47 
48  virtual const Aws::Vector<Aws::String>& GetNS() const { return DEFAULT_STRING_SET; }
49 
50  virtual void AddNItem(const Aws::String& ) { assert(false); }
51 
53 
54  virtual void AddBItem(const Aws::Utils::ByteBuffer&) { assert(false); }
55 
57 
58  virtual void AddMEntry(const Aws::String& , const std::shared_ptr<AttributeValue>& ) { assert(false); }
59 
61 
62  virtual void AddLItem(const std::shared_ptr<AttributeValue>& ) { assert(false); }
63 
64  virtual bool GetBool() const { return false; }
65 
66  virtual bool GetNull() const { return false; }
67 
68  virtual bool IsDefault() const = 0;
69 
70  virtual bool operator == (const AttributeValueValue& other) const = 0;
71 
72  virtual Aws::Utils::Json::JsonValue Jsonize() const = 0;
73 
80 
82  virtual ValueType GetType() const = 0;
83 };
84 
87 {
88 public:
89  explicit AttributeValueString(const Aws::String& value) : m_s(value) {}
90  explicit AttributeValueString(const Aws::Utils::Json::JsonValue& jsonValue) : m_s(jsonValue.GetString("S")) {}
91  const Aws::String& GetS() const override { return m_s; }
92  bool IsDefault() const override { return m_s == DEFAULT_STRING; }
93  bool operator == (const AttributeValueValue& other) const override { return GetType() == other.GetType() && m_s == other.GetS(); }
94  Aws::Utils::Json::JsonValue Jsonize() const override;
95  ValueType GetType() const override { return ValueType::STRING; }
96 
97 private:
98  Aws::String m_s;
99 };
100 
103 {
104 public:
105  explicit AttributeValueNumeric(const Aws::String& value) : m_n(value) {}
106  explicit AttributeValueNumeric(const Aws::Utils::Json::JsonValue& jsonValue) : m_n(jsonValue.GetString("N")) {}
107  const Aws::String& GetN() const override { return m_n; }
108  bool IsDefault() const override { return m_n == DEFAULT_STRING; }
109  bool operator == (const AttributeValueValue& other) const override { return GetType() == other.GetType() && m_n == other.GetN(); };
110  Aws::Utils::Json::JsonValue Jsonize() const override;
111  ValueType GetType() const override { return ValueType::NUMBER; }
112 
113 private:
114  Aws::String m_n;
115 };
116 
119 {
120 public:
121  explicit AttributeValueByteBuffer(const Aws::Utils::ByteBuffer& value) : m_b(value) {}
122  explicit AttributeValueByteBuffer(const Aws::Utils::Json::JsonValue& jsonValue);
123  const Aws::Utils::ByteBuffer& GetB() const override { return m_b; }
124  bool IsDefault() const override { return m_b == DEFAULT_BYTEBUFFER; }
125  bool operator == (const AttributeValueValue& other) const override { return GetType() == other.GetType() && m_b == other.GetB(); }
126  Aws::Utils::Json::JsonValue Jsonize() const override;
127  ValueType GetType() const override { return ValueType::BYTEBUFFER; }
128 
129 private:
131 };
132 
135 {
136 public:
137  explicit AttributeValueStringSet(const Aws::Vector<Aws::String>& value) : m_sS(value) {}
138  explicit AttributeValueStringSet(const Aws::Utils::Json::JsonValue& jsonValue);
139  const Aws::Vector<Aws::String>& GetSS() const override { return m_sS; }
140  void AddSItem(const Aws::String& sItem) override { m_sS.push_back(sItem); }
141  bool IsDefault() const override { return m_sS == DEFAULT_STRING_SET; }
142  bool operator == (const AttributeValueValue& other) const override;
143  Aws::Utils::Json::JsonValue Jsonize() const override;
144  ValueType GetType() const override { return ValueType::STRING_SET; }
145 
146 private:
148 };
149 
152 {
153 public:
154  explicit AttributeValueNumberSet(const Aws::Vector<Aws::String>& value) : m_nS(value) {}
155  explicit AttributeValueNumberSet(const Aws::Utils::Json::JsonValue& jsonValue);
156  const Aws::Vector<Aws::String>& GetNS() const override { return m_nS; }
157  void AddNItem(const Aws::String& nItem) override { m_nS.push_back(nItem); }
158  bool IsDefault() const override { return m_nS == DEFAULT_STRING_SET; }
159  bool operator == (const AttributeValueValue& other) const override;
160  Aws::Utils::Json::JsonValue Jsonize() const override;
161  ValueType GetType() const override { return ValueType::NUMBER_SET; }
162 
163 private:
165 };
166 
169 {
170 public:
171  explicit AttributeValueByteBufferSet(const Aws::Vector<Aws::Utils::ByteBuffer>& value) : m_bS(value) {}
172  explicit AttributeValueByteBufferSet(const Aws::Utils::Json::JsonValue& jsonValue);
173  const Aws::Vector<Aws::Utils::ByteBuffer>& GetBS() const override { return m_bS; }
174  void AddBItem(const Aws::Utils::ByteBuffer& bItem) override { m_bS.push_back(bItem); }
175  bool IsDefault() const override { return m_bS == DEFAULT_BYTEBUFFER_SET; }
176  bool operator == (const AttributeValueValue& other) const override;
177  Aws::Utils::Json::JsonValue Jsonize() const override;
178  ValueType GetType() const override { return ValueType::BYTEBUFFER_SET; }
179 
180 private:
182 };
183 
186 {
187 public:
188  explicit AttributeValueMap(const Aws::Map<Aws::String, const std::shared_ptr<AttributeValue>>& value) : m_m(value) {}
189  explicit AttributeValueMap(const Aws::Utils::Json::JsonValue& jsonValue);
191  void AddMEntry(const Aws::String& key, const std::shared_ptr<AttributeValue>& value) override;
192  bool IsDefault() const override { return m_m == DEFAULT_ATTRIBUTE_MAP; }
193  bool operator == (const AttributeValueValue& other) const override;
194  Aws::Utils::Json::JsonValue Jsonize() const override;
195  ValueType GetType() const override { return ValueType::ATTRIBUTE_MAP; }
196 
197 private:
199 };
200 
203 {
204 public:
205  explicit AttributeValueList(const Aws::Vector<std::shared_ptr<AttributeValue>>& value) : m_l(value) {}
206  explicit AttributeValueList(const Aws::Utils::Json::JsonValue& jsonValue);
207  const Aws::Vector<std::shared_ptr<AttributeValue>>& GetL() const override { return m_l; }
208  void AddLItem(const std::shared_ptr<AttributeValue>& listItem) override { m_l.push_back(listItem); }
209  bool IsDefault() const override { return m_l == DEFAULT_ATTRIBUTE_LIST; }
210  bool operator == (const AttributeValueValue& other) const override;
211  Aws::Utils::Json::JsonValue Jsonize() const override;
212  ValueType GetType() const override { return ValueType::ATTRIBUTE_LIST; }
213 
214 private:
216 };
217 
220 {
221 public:
222  explicit AttributeValueBool(bool value) : m_bool(value) {}
223  explicit AttributeValueBool(const Aws::Utils::Json::JsonValue& jsonValue) : m_bool(jsonValue.GetBool("BOOL")) {}
224  bool GetBool() const override { return m_bool; }
225  bool IsDefault() const override { return m_bool == false; }
226  bool operator == (const AttributeValueValue& other) const override { return GetType() == other.GetType() && m_bool == other.GetBool(); }
227  Aws::Utils::Json::JsonValue Jsonize() const override;
228  ValueType GetType() const override { return ValueType::BOOL; }
229 
230 private:
231  bool m_bool;
232 };
233 
236 {
237 public:
238  explicit AttributeValueNull(bool value) : m_null(value) {}
239  explicit AttributeValueNull(const Aws::Utils::Json::JsonValue& jsonValue) : m_null(jsonValue.GetBool("NULL")) {}
240  bool GetNull() const override { return m_null; }
241  bool IsDefault() const override { return m_null == false; }
242  bool operator == (const AttributeValueValue& other) const override { return GetType() == other.GetType() && m_null == other.GetNull(); }
243  Aws::Utils::Json::JsonValue Jsonize() const override;
244  ValueType GetType() const override { return ValueType::NULLVALUE; }
245 
246 private:
247  bool m_null;
248 };
249 
250 } // Model
251 } // DynamoDB
252 } // Aws
virtual bool operator==(const AttributeValueValue &other) const =0
const Aws::Map< Aws::String, const std::shared_ptr< AttributeValue > > & GetM() const override
virtual void AddBItem(const Aws::Utils::ByteBuffer &)
virtual const Aws::Vector< Aws::String > & GetNS() const
AttributeValueMap(const Aws::Map< Aws::String, const std::shared_ptr< AttributeValue >> &value)
AttributeValueByteBuffer(const Aws::Utils::ByteBuffer &value)
const Aws::Vector< Aws::Utils::ByteBuffer > & GetBS() const override
std::vector< T, Aws::Allocator< T > > Vector
Definition: AWSVector.h:27
AttributeValueNumberSet(const Aws::Vector< Aws::String > &value)
virtual void AddLItem(const std::shared_ptr< AttributeValue > &)
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
Definition: AWSMap.h:28
const Aws::Vector< Aws::String > & GetSS() const override
static const Aws::Utils::ByteBuffer DEFAULT_BYTEBUFFER
AttributeValueBool(const Aws::Utils::Json::JsonValue &jsonValue)
virtual const Aws::Vector< std::shared_ptr< AttributeValue > > & GetL() const
void AddLItem(const std::shared_ptr< AttributeValue > &listItem) override
virtual const Aws::Map< Aws::String, const std::shared_ptr< AttributeValue > > & GetM() const
virtual const Aws::String & GetS() const
AttributeValueString(const Aws::Utils::Json::JsonValue &jsonValue)
virtual const Aws::String & GetN() const
AttributeValueNumeric(const Aws::Utils::Json::JsonValue &jsonValue)
const Aws::String & GetN() const override
static const Aws::Vector< Aws::String > DEFAULT_STRING_SET
virtual void AddMEntry(const Aws::String &, const std::shared_ptr< AttributeValue > &)
AttributeValueStringSet(const Aws::Vector< Aws::String > &value)
static const Aws::Vector< Aws::Utils::ByteBuffer > DEFAULT_BYTEBUFFER_SET
static const Aws::Vector< std::shared_ptr< AttributeValue > > DEFAULT_ATTRIBUTE_LIST
virtual const Aws::Vector< Aws::Utils::ByteBuffer > & GetBS() const
virtual void AddSItem(const Aws::String &)
virtual void AddNItem(const Aws::String &)
const Aws::Vector< Aws::String > & GetNS() const override
virtual const Aws::Vector< Aws::String > & GetSS() const
void AddSItem(const Aws::String &sItem) override
const Aws::String & GetS() const override
virtual Aws::Utils::Json::JsonValue Jsonize() const =0
AttributeValueByteBufferSet(const Aws::Vector< Aws::Utils::ByteBuffer > &value)
const Aws::Utils::ByteBuffer & GetB() const override
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
void AddNItem(const Aws::String &nItem) override
void AddBItem(const Aws::Utils::ByteBuffer &bItem) override
static const Aws::Map< Aws::String, const std::shared_ptr< AttributeValue > > DEFAULT_ATTRIBUTE_MAP
const Aws::Vector< std::shared_ptr< AttributeValue > > & GetL() const override
virtual ValueType GetType() const =0
AttributeValueNull(const Aws::Utils::Json::JsonValue &jsonValue)
AttributeValueList(const Aws::Vector< std::shared_ptr< AttributeValue >> &value)
virtual const Aws::Utils::ByteBuffer & GetB() const
JSON (JavaScript Object Notation).