Skip to content

Commit d9b8f5f

Browse files
authored
Merge pull request #27 from Microsoft/subscriptionargs
Add argument matching to subscription fields
2 parents 451caec + 28574f9 commit d9b8f5f

File tree

9 files changed

+558
-122
lines changed

9 files changed

+558
-122
lines changed

GraphQLResponse.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
4047
Value::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+
132183
Type Value::type() const
133184
{
134185
return _type;

0 commit comments

Comments
 (0)