Skip to content
Snippets Groups Projects

Workaround to return non-string values, according to the specified DataType.

Merged Daniel Hornung requested to merge f-parse-string-values into dev
2 unresolved threads
2 files
+ 131
7
Compare changes
  • Side-by-side
  • Inline

Files

+ 19
1
@@ -454,7 +454,9 @@ class Property {
@@ -454,7 +454,9 @@ class Property {
public:
public:
explicit inline Property(ProtoProperty *other)
explicit inline Property(ProtoProperty *other)
: value(Value(other->mutable_value())), data_type(DataType(other->mutable_data_type())),
: value(Value(other->mutable_value())), data_type(DataType(other->mutable_data_type())),
wrapped(other){};
wrapped(other) {
 
FixValue();
Please register or sign in to reply
 
};
Property();
Property();
/**
/**
@@ -551,6 +553,12 @@ public:
@@ -551,6 +553,12 @@ public:
friend class RepeatedPtrFieldWrapper<Property, ProtoProperty>;
friend class RepeatedPtrFieldWrapper<Property, ProtoProperty>;
private:
private:
 
/**
 
* Workaround until non-string values are supported by the server.
 
*
 
* Only has an effect if there is a DataType.
 
*/
 
auto FixValue() -> void;
static auto CreateProtoProperty() -> ProtoProperty *;
static auto CreateProtoProperty() -> ProtoProperty *;
Value value;
Value value;
DataType data_type;
DataType data_type;
@@ -602,6 +610,7 @@ public:
@@ -602,6 +610,7 @@ public:
errors.wrapped = CreateMessagesField();
errors.wrapped = CreateMessagesField();
warnings.wrapped = CreateMessagesField();
warnings.wrapped = CreateMessagesField();
infos.wrapped = CreateMessagesField();
infos.wrapped = CreateMessagesField();
 
FixValue();
};
};
explicit Entity(IdResponse *id_response);
explicit Entity(IdResponse *id_response);
explicit Entity(ProtoEntity *other)
explicit Entity(ProtoEntity *other)
@@ -614,11 +623,13 @@ public:
@@ -614,11 +623,13 @@ public:
errors.wrapped = CreateMessagesField();
errors.wrapped = CreateMessagesField();
warnings.wrapped = CreateMessagesField();
warnings.wrapped = CreateMessagesField();
infos.wrapped = CreateMessagesField();
infos.wrapped = CreateMessagesField();
 
FixValue();
};
};
explicit inline Entity(EntityResponse *response) : Entity(response->release_entity()) {
explicit inline Entity(EntityResponse *response) : Entity(response->release_entity()) {
errors.wrapped->Swap(response->mutable_errors());
errors.wrapped->Swap(response->mutable_errors());
warnings.wrapped->Swap(response->mutable_warnings());
warnings.wrapped->Swap(response->mutable_warnings());
infos.wrapped->Swap(response->mutable_infos());
infos.wrapped->Swap(response->mutable_infos());
 
FixValue();
};
};
[[nodiscard]] inline auto GetId() const noexcept -> const std::string & { return wrapped->id(); };
[[nodiscard]] inline auto GetId() const noexcept -> const std::string & { return wrapped->id(); };
@@ -744,6 +755,13 @@ private:
@@ -744,6 +755,13 @@ private:
auto SetId(const std::string &id) -> void;
auto SetId(const std::string &id) -> void;
auto SetVersionId(const std::string &id) -> void;
auto SetVersionId(const std::string &id) -> void;
 
/**
 
* Workaround until non-string values are supported by the server.
 
*
 
* Only has an effect if there is a DataType.
 
*/
 
auto FixValue() -> void;
 
private:
private:
FileDescriptor file_descriptor;
FileDescriptor file_descriptor;
ProtoEntity *wrapped;
ProtoEntity *wrapped;
Loading