# ObjectMapper.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/core/data/mapping/ObjectMapper.hpp"

# ObjectMapper

Abstract ObjectMapper class.

namespace oatpp { namespace data { namespace mapping { 
  class ObjectMapper {}
}}}

# Methods

Return Type Name Summary
[none] ObjectMapper Constructor.
const Info& getInfo Get ObjectMapper metadata.
void write Serialize object to stream. Implement this method.
mapping::type::Void read Deserialize object. Implement this method.
oatpp::String writeToString Serialize object to String.
Wrapper readFromCaret Deserialize object.
Wrapper readFromString Deserialize object.

# ObjectMapper::ObjectMapper

Constructor.

  • @param info - Metadata for ObjectMapper.

ObjectMapper(const Info& info)

# ObjectMapper::getInfo

Get ObjectMapper metadata.

  • @return - ObjectMapper metadata.

const Info& getInfo() const

# ObjectMapper::write

Serialize object to stream. Implement this method.

virtual void write(data::stream::ConsistentOutputStream* stream, const type::Void& variant) const = 0

# ObjectMapper::read

Deserialize object. Implement this method.

virtual mapping::type::Void read(oatpp::parser::Caret& caret, const mapping::type::Type* const type) const = 0

# ObjectMapper::writeToString

Serialize object to String.

  • @param variant - Object to serialize.
  • @return - serialized object as oatpp::String.

oatpp::String writeToString(const type::Void& variant) const

# ObjectMapper::readFromCaret

Deserialize object. If nullptr is returned - check caret.getError()

  • @tparam Wrapper - ObjectWrapper type.
  • @param caret - oatpp::parser::Caret over serialized buffer.
  • @return - deserialized Object.
  • @throws - depends on implementation.

template<class Wrapper>
Wrapper readFromCaret(oatpp::parser::Caret& caret) const

# ObjectMapper::readFromString

Deserialize object.

  • @tparam Wrapper - ObjectWrapper type.
  • @param str - serialized data.
  • @return - deserialized Object.
  • @throws - oatpp::parser::ParsingError
  • @throws - depends on implementation.

template<class Wrapper>
Wrapper readFromString(const oatpp::String& str) const

# ObjectMapper::Info

Metadata for ObjectMapper.

namespace oatpp { namespace data { namespace mapping { 
  class ObjectMapper {
    class Info {}
  };
}}}

# Fields

Type Name Summary
const char* const http_content_type Value for Content-Type http header when DTO is serialized via specified ObjectMapper.

# Methods

Return Type Name Summary
[none] Info Constructor.

# ObjectMapper::Info::http_content_type

Value for Content-Type http header when DTO is serialized via specified ObjectMapper.

const char* const http_content_type

# ObjectMapper::Info::Info

Constructor.

  • @param _http_content_type

Info(const char* _http_content_type)
  : http_content_type(_http_content_type)