Library: RemotingNG
Package: Serialization
Header: Poco/RemotingNG/SerializerBase.h
SerializerBase is the common base class for Serializer and Deserializer.
This class provides common definitions and member functions for Serializer and Deserializer classes, most importantly properties management.
Properties allow a TypeSerializer or other classes using a Serializer or Deserializer to send additional (meta-)information to the Serializer (or Deserializer), for example XML namespace information for XML elements.
Properties are managed in a stacks — a separate stack is maintained for every property identified by a name. Users of Serializer and Deserializer classes can push property values onto a stack before serializing a certain object or message, and pop properties from the stack when serialization is completed.
Known Derived Classes: Poco::RemotingNG::JSONRPC::Deserializer, Poco::RemotingNG::JSONRPC::Serializer, Poco::RemotingNG::SOAP::Deserializer, Poco::RemotingNG::SOAP::Serializer, BinaryDeserializer, BinarySerializer, Deserializer, Serializer, Poco::UPnP::GENA::Deserializer, Poco::UPnP::GENA::Serializer, Poco::UPnP::SOAP::Deserializer, Poco::UPnP::SOAP::Serializer
Member Functions: clearProperties, getProperty, hasProperty, popProperty, pushProperty, reset, resetImpl
Creates a Serializer.
virtual ~SerializerBase();
Destroys the Serializer.
const std::string & getProperty(
const std::string & name
) const;
Gets the property with the given name from its stack.
Throws an exception if the stack is empty.
const std::string & getProperty(
const std::string & name,
const std::string & deflt
) const;
Gets the property with the given name from its stack. Returns the default value if the stack is empty.
Warning: Since this method may return a const reference to the default value, the caller must make sure not to pass a temporary object as default value.
bool hasProperty(
const std::string & name
) const;
Returns true if a property with the given name exists.
void popProperty(
const std::string & name
);
Pops a property value from its stack.
Throws an exception if the property stack is empty or does not exist.
void pushProperty(
const std::string & name,
const std::string & value
);
Pushes a property value onto the stack for the property with the given name.
void reset();
Resets the Serializer or Deserializer to a clean state.
void clearProperties();
Clears all properties.
virtual void resetImpl() = 0;
Resets the serializer. Must be implemented by subclasses.
static const std::string PROP_ACTION;
static const std::string PROP_FAULT;
static const std::string PROP_HEADER;
static const std::string PROP_NAMESPACE;
static const std::string PROP_REPLY;
static const std::string PROP_REQUEST;
static const std::string PROP_VERSION;
static const std::string RETURN_PARAM;
The element name used to serialize a function's return value.