This Helper class contains commonly used function to manipulate protobuf objects. More...
#include <Helper.h>
Static Public Member Functions | |
static Variant::ValueCase | GetBaseType (const Variant &value) |
Get the base type of the variant array, or its type if it is not an array. More... | |
static size_t | GetCount (const Variant &value) |
Get the item count of the variant array, or 1 if it is not an array. More... | |
static discovery::Field | GetFieldDescriptor (const Variant &value, bool includeArraySizes=false) |
Get the schema for an existing map. More... | |
static discovery::Schema | GetSchemaDescriptor (const Map &value, bool includeArraySizes=false) |
Get the schema for an existing map. More... | |
static bool | IsArray (const Variant &value) |
Check whether the variant contains an array type. More... | |
static std::string | ToString (const discovery::Schema &value, bool prettyPrint=true) |
Get a string representation of a schema. More... | |
static std::string | ToString (const Variant &value, bool prettyPrint=true) |
Get a string representation of a variant. More... | |
static std::string | ToString (const Map &value, bool prettyPrint=true) |
Get a string representation of a map. More... | |
static std::string | ToString (const google::protobuf::Map< std::string, swarmio::data::Variant > &value, bool prettyPrint=true) |
Get a string representation of a map. More... | |
static void | WriteToStream (std::ostream &stream, const Variant &value, bool prettyPrint=true, int indentationLevel=0) |
Write a string representation of a variant to the stream. More... | |
static void | WriteToStream (std::ostream &stream, const Map &value, bool prettyPrint=true, int indentationLevel=0) |
Write a string representation of a map to the stream. More... | |
static void | WriteToStream (std::ostream &stream, const google::protobuf::Map< std::string, swarmio::data::Variant > &value, bool prettyPrint=true, int indentationLevel=0) |
Write a string representation of a map to the stream. More... | |
static void | WriteToStream (std::ostream &stream, const discovery::Schema &value, bool prettyPrint=true, int indentationLevel=0) |
Write a string representation of a schema to the stream. More... | |
Private Member Functions | |
Helper () | |
Disable construction. More... | |
Static Private Member Functions | |
static const char * | TypeToString (discovery::Type type) |
Look up the human readable name of a type. More... | |
static void | WriteElementSeparatorToStream (std::ostream &stream, bool &first, bool prettyPrint, int indentationLevel) |
Write the element separator between two elements of an array. More... | |
static void | WriteEscapedAndQuotedStringToStream (std::ostream &stream, const std::string &value) |
Write an escaped and quoted string to the stream. More... | |
This Helper class contains commonly used function to manipulate protobuf objects.
|
inlineprivate |
|
static |
Get the base type of the variant array, or its type if it is not an array.
value | Variant |
Definition at line 53 of file Helper.cpp.
|
static |
Get the item count of the variant array, or 1 if it is not an array.
value | Variant |
Definition at line 26 of file Helper.cpp.
|
static |
Get the schema for an existing map.
value | Value |
includeArraySizes | Mark arrays as fixed size |
Definition at line 91 of file Helper.cpp.
|
static |
Get the schema for an existing map.
value | Value |
includeArraySizes | Mark arrays as fixed size |
Definition at line 80 of file Helper.cpp.
|
static |
Check whether the variant contains an array type.
value | Variant |
Definition at line 10 of file Helper.cpp.
|
static |
Get a string representation of a schema.
value | Schema |
prettyPrint | Add indentation and spacing |
Definition at line 154 of file Helper.cpp.
|
static |
Get a string representation of a variant.
value | Variant |
prettyPrint | Add indentation and spacing |
Definition at line 161 of file Helper.cpp.
|
static |
Get a string representation of a map.
value | Map |
prettyPrint | Add indentation and spacing |
Definition at line 168 of file Helper.cpp.
|
static |
Get a string representation of a map.
value | Map |
prettyPrint | Add indentation and spacing |
Definition at line 175 of file Helper.cpp.
|
staticprivate |
Look up the human readable name of a type.
type | Type |
Definition at line 432 of file Helper.cpp.
|
staticprivate |
Write the element separator between two elements of an array.
stream | Stream |
first | First element marker |
prettyPrint | Add indentation and spacing |
indentationLevel | Current indentation level |
Definition at line 232 of file Helper.cpp.
|
staticprivate |
Write an escaped and quoted string to the stream.
stream | Stream |
value | String |
Definition at line 182 of file Helper.cpp.
|
static |
Write a string representation of a variant to the stream.
stream | Stream |
prettyPrint | Add indentation and spacing |
indentationLevel | Current indentation level |
value | Variant |
Definition at line 255 of file Helper.cpp.
|
static |
Write a string representation of a map to the stream.
stream | Stream |
prettyPrint | Add indentation and spacing |
indentationLevel | Current indentation level |
value | Map |
Definition at line 370 of file Helper.cpp.
|
static |
Write a string representation of a map to the stream.
stream | Stream |
prettyPrint | Add indentation and spacing |
indentationLevel | Current indentation level |
value | Map |
Definition at line 375 of file Helper.cpp.
|
static |
Write a string representation of a schema to the stream.
stream | Stream |
prettyPrint | Add indentation and spacing |
indentationLevel | Current indentation level |
value | Schema |
Definition at line 456 of file Helper.cpp.