Skip to content

Commit 28af5a2

Browse files
committed
Ser/De: Arrays. Refactor method names.
1 parent d1bcba1 commit 28af5a2

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

src/oatpp-postgresql/mapping/Deserializer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ Deserializer::Deserializer() {
6464
setDeserializerMethod(data::mapping::type::__class::AbstractObject::CLASS_ID, nullptr);
6565
setDeserializerMethod(data::mapping::type::__class::AbstractEnum::CLASS_ID, &Deserializer::deserializeEnum);
6666

67-
setDeserializerMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &Deserializer::deserializeArray2<oatpp::AbstractVector>);
68-
setDeserializerMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &Deserializer::deserializeArray2<oatpp::AbstractList>);
69-
setDeserializerMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &Deserializer::deserializeArray2<oatpp::AbstractUnorderedSet>);
67+
setDeserializerMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &Deserializer::deserializeArray<oatpp::AbstractVector>);
68+
setDeserializerMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &Deserializer::deserializeArray<oatpp::AbstractList>);
69+
setDeserializerMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &Deserializer::deserializeArray<oatpp::AbstractUnorderedSet>);
7070

7171
setDeserializerMethod(data::mapping::type::__class::AbstractPairList::CLASS_ID, nullptr);
7272
setDeserializerMethod(data::mapping::type::__class::AbstractUnorderedMap::CLASS_ID, nullptr);

src/oatpp-postgresql/mapping/Deserializer.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
#include <libpq-fe.h>
3434

3535
#if defined(WIN32) || defined(_WIN32)
36-
#include <WinSock2.h>
36+
#include <WinSock2.h>
3737
#else
38-
#include <arpa/inet.h>
38+
#include <arpa/inet.h>
3939
#endif
4040

4141
namespace oatpp { namespace postgresql { namespace mapping {
@@ -212,7 +212,7 @@ class Deserializer {
212212
}
213213

214214
template<class Collection>
215-
static oatpp::Void deserializeArray2(const Deserializer* _this, const InData& data, const Type* type) {
215+
static oatpp::Void deserializeArray(const Deserializer* _this, const InData& data, const Type* type) {
216216

217217
if(data.isNull) {
218218
return oatpp::Void(nullptr, type);

src/oatpp-postgresql/mapping/Serializer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ void Serializer::setSerializerMethods() {
6565

6666
setSerializerMethod(data::mapping::type::__class::AbstractEnum::CLASS_ID, &Serializer::serializeEnum);
6767

68-
setSerializerMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &Serializer::serializeArray2<oatpp::AbstractVector>);
69-
setSerializerMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &Serializer::serializeArray2<oatpp::AbstractList>);
70-
setSerializerMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &Serializer::serializeArray2<oatpp::AbstractUnorderedSet>);
68+
setSerializerMethod(data::mapping::type::__class::AbstractVector::CLASS_ID, &Serializer::serializeArray<oatpp::AbstractVector>);
69+
setSerializerMethod(data::mapping::type::__class::AbstractList::CLASS_ID, &Serializer::serializeArray<oatpp::AbstractList>);
70+
setSerializerMethod(data::mapping::type::__class::AbstractUnorderedSet::CLASS_ID, &Serializer::serializeArray<oatpp::AbstractUnorderedSet>);
7171

7272
////
7373

src/oatpp-postgresql/mapping/Serializer.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030

3131
#include <libpq-fe.h>
3232

33+
#if defined(WIN32) || defined(_WIN32)
34+
#include <WinSock2.h>
35+
#else
36+
#include <arpa/inet.h>
37+
#endif
38+
3339
namespace oatpp { namespace postgresql { namespace mapping {
3440

3541
/**
@@ -172,7 +178,7 @@ class Serializer {
172178
}
173179

174180
template<class Collection>
175-
static void serializeArray2(const Serializer* _this, OutputData& outData, const oatpp::Void& polymorph) {
181+
static void serializeArray(const Serializer* _this, OutputData& outData, const oatpp::Void& polymorph) {
176182

177183
if(!polymorph) {
178184
serNull(outData);
@@ -183,7 +189,7 @@ class Serializer {
183189
const oatpp::Type* itemType = getArrayItemTypeAndDimensions(polymorph, meta.dimensions);
184190

185191
if(meta.dimensions.empty()) {
186-
throw std::runtime_error("[oatpp::postgresql::mapping::Serializer::serializeArray2()]: Error. "
192+
throw std::runtime_error("[oatpp::postgresql::mapping::Serializer::serializeArray()]: Error. "
187193
"Invalid array.");
188194
}
189195

0 commit comments

Comments
 (0)