File tree Expand file tree Collapse file tree 4 files changed +364
-121
lines changed
Expand file tree Collapse file tree 4 files changed +364
-121
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ Value::Value(Type type /*= Type::Null*/)
3737 }
3838}
3939
40+ Value::~Value ()
41+ {
42+ // The default destructor gets inlined and may use a different allocator to free Value's member
43+ // variables than the graphqlservice module used to allocate them. So even though this could be
44+ // omitted, declare it explicitly and define it in graphqlservice.
45+ }
46+
4047Value::Value (StringType&& value)
4148 : _type(Type::String)
4249 , _string(new StringType(std::move(value)))
@@ -129,6 +136,50 @@ Value& Value::operator=(Value&& rhs) noexcept
129136 return *this ;
130137}
131138
139+ bool Value::operator ==(const Value& rhs) const noexcept
140+ {
141+ if (rhs.type () != _type)
142+ {
143+ return false ;
144+ }
145+
146+ switch (_type)
147+ {
148+ case Type::Map:
149+ return *_map == *rhs._map ;
150+
151+ case Type::List:
152+ return *_list == *rhs._list ;
153+
154+ case Type::String:
155+ case Type::EnumValue:
156+ return _string == rhs._string ;
157+
158+ case Type::Null:
159+ return true ;
160+
161+ case Type::Boolean:
162+ return _boolean == rhs._boolean ;
163+
164+ case Type::Int:
165+ return _int == rhs._int ;
166+
167+ case Type::Float:
168+ return _float == rhs._float ;
169+
170+ case Type::Scalar:
171+ return *_scalar == *rhs._scalar ;
172+
173+ default :
174+ return false ;
175+ }
176+ }
177+
178+ bool Value::operator !=(const Value& rhs) const noexcept
179+ {
180+ return !(*this == rhs);
181+ }
182+
132183Type Value::type () const
133184{
134185 return _type;
You can’t perform that action at this time.
0 commit comments