BLPAPI C++
3.24.11
|
#include <blpapi_messageformatter.h>
Public Member Functions | |
MessageFormatter (blpapi_MessageFormatter_t *handle) | |
MessageFormatter (const MessageFormatter &original) | |
~MessageFormatter () | |
MessageFormatter & | operator= (const MessageFormatter &rhs) |
void | setElement (const Name &name, bool value) |
void | setElement (const Name &name, char value) |
void | setElement (const Name &name, Int32 value) |
void | setElement (const Name &name, Int64 value) |
void | setElement (const Name &name, Float32 value) |
void | setElement (const Name &name, Float64 value) |
void | setElement (const Name &name, const Datetime &value) |
void | setElement (const Name &name, const Datetime::HighPrecision &value) |
void | setElement (const Name &name, const char *value) |
void | setElement (const Name &name, const std::string &value) |
void | setElement (const Name &name, const Name &value) |
void | setElement (const Name &name, const void *value, size_t length) |
template<typename BYTES , typename std::enable_if< IsByteSequence< BYTES >::value, bool >::type = true> | |
void | setElement (const Name &name, const BYTES &value) |
void | setElementNull (const Name &name) |
void | pushElement (const Name &name) |
void | popElement () |
void | appendValue (bool value) |
void | appendValue (char value) |
void | appendValue (Int32 value) |
void | appendValue (Int64 value) |
void | appendValue (Float32 value) |
void | appendValue (Float64 value) |
void | appendValue (const Datetime &value) |
void | appendValue (const Datetime::HighPrecision &value) |
void | appendValue (const char *value) |
void | appendValue (const std::string &value) |
void | appendValue (const Name &value) |
void | appendElement () |
void | formatMessageJson (const char *message) |
void | formatMessageXml (const char *message) |
blpapi_MessageFormatter_t * | impl () const |
MessageFormatter
is used to populate/format a message. It supports writing once only to each field. Attempting to set an already set element will fail.
Note that the behavior is undefined if
formatMessageJson()
or formatMessageXml()
is further formatted.set...()
or append...()
is further formatted using formatMessageJson()/formatMessageXml()
.
|
explicit |
Creates MessageFormatter
from handle
and takes ownership of the handle
.
MessageFormatter | ( | const MessageFormatter & | original | ) |
Creates MessageFormatter
from original
. Changes made by one copy is visible to the other.
~MessageFormatter | ( | ) |
Destroy this MessageFormatter
and release the d_handle
.
void appendElement | ( | ) |
Create an element and append it to the array element on which this MessageFormatter
is operating on. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array, a sequence or a choice.
void appendValue | ( | bool | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void appendValue | ( | char | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void appendValue | ( | Int32 | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void appendValue | ( | Int64 | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void appendValue | ( | Float32 | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void appendValue | ( | Float64 | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void appendValue | ( | const Datetime & | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void appendValue | ( | const Datetime::HighPrecision & | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void appendValue | ( | const char * | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void appendValue | ( | const std::string & | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array. The behaviour is undefined if the specified value
contains embedded zero-characters.
void appendValue | ( | const Name & | value | ) |
Append the specified value
to element on which this MessageFormatter
is operating. Throw an exception if the schema of the message is flat or the current element to which value
is appended is not an array.
void formatMessageJson | ( | const char * | message | ) |
Format the message from its JSON
representation. An exception is thrown if the method fails to format the message. The behavior is undefined if further formatting is done using this MessageFormatter
.
void formatMessageXml | ( | const char * | message | ) |
Format the message from its XML
representation. An exception is thrown if the method fails to format the message. The behavior is undefined if further formatting is done using this MessageFormatter
.
blpapi_MessageFormatter_t * impl | ( | ) | const |
Returns underlying implementation of MessageFormatter
. For internal use only.
MessageFormatter & operator= | ( | const MessageFormatter & | rhs | ) |
Make this MessageFormatter
same as rhs
.
void popElement | ( | ) |
Undo the most recent call to pushElement()
or appendElement()
on this MessageFormatter
and return the context of the MessageFormatter
to where it was before the call to pushElement()
or appendElement()
. Once popElement()
has been called it is invalid to attempt to re-visit the same context.
void pushElement | ( | const Name & | name | ) |
Change the level at which this MessageFormatter
is operating to the specified element name
. The element name
must identify either a choice, a sequence or an array at the current level of the schema or the behavior is undefined. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
After this returns, the context of the MessageFormatter
is set to the element name
in the schema and any calls to setElement()
or pushElement()
are applied at that level.
If name
represents an array of scalars then appendValue()
must be used to add values.
If name
represents an array of complex types then appendElement()
must be used.
void setElement | ( | const Name & | name, |
bool | value | ||
) |
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
void setElement | ( | const Name & | name, |
char | value | ||
) |
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
void setElement | ( | const Name & | name, |
const Datetime::HighPrecision & | value | ||
) |
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
void setElement | ( | const Name & | name, |
const char * | value | ||
) |
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message, or if the element identified by name
has already been set an exception is thrown. The behavior is undefined unless value
is not NULL
. Clients wishing to format null values (e.g. for the purpose of cache management) should not use this function; use setElementNull
instead.
void setElement | ( | const Name & | name, |
const std::string & | value | ||
) |
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message, or if the element identified by name
has already been set an exception is thrown. The behaviour is undefined if the specified value
contains embedded zero-characters.
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.
void setElement | ( | const Name & | name, |
const void * | value, | ||
size_t | length | ||
) |
Set the element with the specified name
to the specified value
and length
in bytes in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown. The behavior is undefined unless value
is not NULL
or length
is zero. Clients wishing to format null values (e.g. for the purpose of cache management) should not use this function; use setElementNull
instead.
void setElement | ( | const Name & | name, |
const BYTES & | value | ||
) |
Set the element with the specified name
to the specified value
in the current message referenced by this MessageFormatter
. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown. This function accepts any BYTES
that provides const BYTES::value_type * BYTES::data() const
method, does not provide BYTES::c_str()
method and sizeof(BYTES::value_type) == 1
, for example std::vector<char>
. The behaviour of this function is undefined unless data()
returns a pointer to a contiguous block of memory.
void setElementNull | ( | const Name & | name | ) |
Create a null element with the specified name
. Note that whether or not fields containing null values are published to subscribers is dependent upon details of the service and schema configuration. If the name
is invalid for the current message or if the element identified by name
has already been set an exception is thrown.