mirror of
https://github.com/oatpp/oatpp.git
synced 2025-01-30 16:59:30 +08:00
Better API Docs.
This commit is contained in:
parent
f65798957e
commit
a1ff01ce9c
@ -43,9 +43,8 @@ namespace __class {
|
||||
|
||||
std::atomic_int ClassId::ID_COUNTER(0);
|
||||
|
||||
ClassId::ClassId(const char* pName, const char* pQualifier)
|
||||
ClassId::ClassId(const char* pName)
|
||||
: name(pName)
|
||||
, qualifier(pQualifier)
|
||||
, id(ID_COUNTER ++)
|
||||
{}
|
||||
|
||||
|
@ -35,15 +35,35 @@ namespace oatpp { namespace data { namespace mapping { namespace type {
|
||||
|
||||
class Type; // FWD
|
||||
|
||||
/**
|
||||
* Structure representing `ID` of the type class.
|
||||
*/
|
||||
class ClassId {
|
||||
private:
|
||||
static std::atomic_int ID_COUNTER;
|
||||
public:
|
||||
/**
|
||||
* Get count of all type classes created.
|
||||
* @return
|
||||
*/
|
||||
static int getClassCount();
|
||||
public:
|
||||
ClassId(const char* pName, const char* pQualifier = nullptr);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param pName
|
||||
*/
|
||||
ClassId(const char* pName);
|
||||
|
||||
/**
|
||||
* Name of the type class.
|
||||
*/
|
||||
const char* const name;
|
||||
const char* const qualifier;
|
||||
|
||||
/**
|
||||
* Integer ID of the type class. <br>
|
||||
* *Note: class type IDs are integer values incremented continuously from [0 to `getClassCount()`]*
|
||||
*/
|
||||
const v_int32 id;
|
||||
};
|
||||
|
||||
|
@ -179,12 +179,31 @@ private:
|
||||
std::vector<DeserializerMethod> m_methods;
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param config
|
||||
*/
|
||||
Deserializer(const std::shared_ptr<Config>& config = std::make_shared<Config>());
|
||||
|
||||
/**
|
||||
* Set deserializer method for type.
|
||||
* @param classId - &id:oatpp::data::mapping::type::ClassId;.
|
||||
* @param method - `typedef AbstractObjectWrapper (*DeserializerMethod)(Deserializer*, parser::Caret&, const Type* const)`.
|
||||
*/
|
||||
void setDeserializerMethod(const data::mapping::type::ClassId& classId, DeserializerMethod method);
|
||||
|
||||
/**
|
||||
* Deserialize text.
|
||||
* @param caret - &id:oatpp::parser::Caret;.
|
||||
* @param type - &id:oatpp::data::mapping::type::Type;
|
||||
* @return - `AbstractObjectWrapper` over deserialized object.
|
||||
*/
|
||||
AbstractObjectWrapper deserialize(parser::Caret& caret, const Type* const type);
|
||||
|
||||
/**
|
||||
* Get deserializer config.
|
||||
* @return
|
||||
*/
|
||||
const std::shared_ptr<Config>& getConfig();
|
||||
|
||||
};
|
||||
|
@ -151,12 +151,30 @@ private:
|
||||
std::vector<SerializerMethod> m_methods;
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param config - serializer config.
|
||||
*/
|
||||
Serializer(const std::shared_ptr<Config>& config = std::make_shared<Config>());
|
||||
|
||||
/**
|
||||
* Set serializer method for type.
|
||||
* @param classId - &id:oatpp::data::mapping::type::ClassId;.
|
||||
* @param method - `typedef void (*SerializerMethod)(Serializer*, data::stream::ConsistentOutputStream*, const data::mapping::type::AbstractObjectWrapper&)`.
|
||||
*/
|
||||
void setSerializerMethod(const data::mapping::type::ClassId& classId, SerializerMethod method);
|
||||
|
||||
/**
|
||||
* Serialize object to stream.
|
||||
* @param stream - &id:oatpp::data::stream::ConsistentOutputStream;.
|
||||
* @param polymorph - DTO as &id:oatpp::data::mapping::type::AbstractObjectWrapper;.
|
||||
*/
|
||||
void serializeToStream(data::stream::ConsistentOutputStream* stream, const data::mapping::type::AbstractObjectWrapper& polymorph);
|
||||
|
||||
/**
|
||||
* Get serializer config.
|
||||
* @return
|
||||
*/
|
||||
const std::shared_ptr<Config>& getConfig();
|
||||
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ namespace oatpp { namespace test { namespace parser { namespace json { namespace
|
||||
class DeserializerTest : public UnitTest{
|
||||
public:
|
||||
|
||||
DeserializerTest():UnitTest("TEST[parser::json::mapping::DeserializerTestTest]"){}
|
||||
DeserializerTest():UnitTest("TEST[parser::json::mapping::DeserializerTest]"){}
|
||||
void onRun() override;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user