Samchon Framework for CPP
1.0.0
|
A parameter of an Invoke. More...
#include <InvokeParameter.hpp>
Public Member Functions | |
InvokeParameter () | |
Default Constructor. More... | |
InvokeParameter (const std::string &name, const std::string &type, const std::string &val) | |
Construct from arguments. More... | |
template<typename T > | |
InvokeParameter (const std::string &name, const T &val) | |
Construct with its name and a value. More... | |
InvokeParameter (const std::string &name, std::string &&str) | |
Construct from the name and a moved string. More... | |
InvokeParameter (const std::string &name, ByteArray &&byte_array) | |
Construct from name and a moved ByteArray. More... | |
virtual auto | key () const -> std::string override |
Get a key that can identify the Entity uniquely. More... | |
auto | getName () const -> std::string |
Get name. More... | |
auto | getType () const -> std::string |
Get type. More... | |
template<typename T > | |
auto | getValue () const -> T |
Get value. More... | |
auto | getValueAsXML () const -> std::shared_ptr< library::XML > |
Get value as XML object. More... | |
template<typename T > | |
auto | referValue () const -> const T & |
Reference value. More... | |
template<typename T > | |
auto | moveValue () -> T |
Move value. More... | |
Protected Attributes | |
std::string | name |
A name can represent the parameter. More... | |
std::string | type |
Type of the parameter. More... | |
std::string | str |
A string value if the type is "string" or "number". More... | |
std::shared_ptr< library::XML > | xml |
An XML object if the type is "XML". More... | |
ByteArray | byte_array |
A binary value if the type is "ByteArray". More... | |
A parameter of an Invoke.
A parameter with its name, type and value in an Invoke message.
InvokeParameter supports 4 types pre-defined.
You can specify InvokeParameter to have some type which is not one of the basic 4 types, but values of the custom type must be enable to expressed by one of those types; number, string, XML and ByteArray.
A member variable void* representing any type of value is deprecated.
Since C++11, method of void pointer (Declare a variable as void pointer whose type can not specified. And convert the pointer type to specified one for each case) is recommended to avoid.
As that reason, the void value was a candidate to be deprecated or to be replaced to boost::any. And the void value is really deprecated since version v1.0.
Definition at line 47 of file InvokeParameter.hpp.
|
inline |
Default Constructor.
Definition at line 94 of file InvokeParameter.hpp.
Referenced by InvokeParameter().
|
inline |
Construct from arguments.
Specifies all arguments of an InvokeParameter. You can specify a custom type, that is not one of number or string, but value of the type must be enable to expressed by a string.
If you want to express an object or container group, use XML instead; Invoke::InvokeParameter(string, XML).
name | A name can represent the InvokeParameter |
type | Type of value in the InvokeParameter |
value | A value capsuled by a string |
Definition at line 112 of file InvokeParameter.hpp.
|
inline |
Construct with its name and a value.
Type of the InvokeParameter will be determined automatically.
Type supported in the template constructor:
_Ty | Type of value |
Definition at line 153 of file InvokeParameter.hpp.
References InvokeParameter(), and name.
|
inline |
Construct from the name and a moved string.
Definition at line 172 of file InvokeParameter.hpp.
References name.
|
inline |
Construct from name and a moved ByteArray.
Definition at line 183 of file InvokeParameter.hpp.
References byte_array, name, str, samchon::WeakString::str(), and xml.
|
inlineoverridevirtual |
Get a key that can identify the Entity uniquely.
If identifier of the Entity is not atomic value, returns a string represents the composite identifier. If identifier of the Entity is not string, converts the identifier to string and returns the string.
Reimplemented from samchon::protocol::Entity<>.
Definition at line 266 of file InvokeParameter.hpp.
References name.
|
inline |
|
inline |
|
inline |
Get value.
_Ty | Type of value to get |
Definition at line 292 of file InvokeParameter.hpp.
References byte_array, str, and xml.
|
inline |
Get value as XML object.
Same with getValue< std::shared_ptr<library::XML> >();
Definition at line 319 of file InvokeParameter.hpp.
References byte_array, moveValue(), referValue(), str, and xml.
auto samchon::protocol::InvokeParameter::referValue | ( | ) | const -> const T & |
Reference value.
_Ty | Type of value to reference |
Referenced by getValueAsXML().
auto samchon::protocol::InvokeParameter::moveValue | ( | ) | -> T |
Move value.
_Ty | Type of value to move |
Referenced by getValueAsXML().
|
protected |
A name can represent the parameter.
Definition at line 58 of file InvokeParameter.hpp.
Referenced by getName(), InvokeParameter(), and key().
|
protected |
Type of the parameter.
List of pre-defined types
Definition at line 70 of file InvokeParameter.hpp.
Referenced by getType(), and InvokeParameter().
|
protected |
A string value if the type is "string" or "number".
Definition at line 75 of file InvokeParameter.hpp.
Referenced by getValue(), getValueAsXML(), and InvokeParameter().
|
protected |
An XML object if the type is "XML".
Definition at line 80 of file InvokeParameter.hpp.
Referenced by getValue(), getValueAsXML(), and InvokeParameter().
|
protected |
A binary value if the type is "ByteArray".
Definition at line 85 of file InvokeParameter.hpp.
Referenced by getValue(), getValueAsXML(), and InvokeParameter().