Skip to content

Commit 005a611

Browse files
committed
update to the latest oatpp API
1 parent 7255519 commit 005a611

File tree

3 files changed

+40
-28
lines changed

3 files changed

+40
-28
lines changed

src/oatpp-postgresql/mapping/type/Uuid.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,15 @@ namespace __class {
7676

7777
const oatpp::ClassId Uuid::CLASS_ID("oatpp::postgresql::Uuid");
7878

79+
oatpp::Type* Uuid::createType() {
80+
oatpp::Type::Info info;
81+
info.interpretationMap = {{"postgresql", new Inter()}};
82+
return new oatpp::Type(CLASS_ID, info);
83+
}
84+
7985
oatpp::Type* Uuid::getType() {
80-
static Type type(
81-
CLASS_ID, nullptr, nullptr,
82-
{
83-
{"postgresql", new Inter()}
84-
}
85-
);
86-
return &type;
86+
static Type* type = createType();
87+
return type;
8788
}
8889

8990
}

src/oatpp-postgresql/mapping/type/Uuid.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ class Uuid {
101101

102102
};
103103

104+
private:
105+
static oatpp::Type* createType();
104106
public:
105107

106108
static const oatpp::ClassId CLASS_ID;

test/oatpp-postgresql/types/InterpretationTest.cpp

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,21 @@ namespace __class {
9292

9393
};
9494

95+
private:
96+
97+
static oatpp::Type* createType() {
98+
oatpp::Type::Info info;
99+
info.interpretationMap = {{"test", new Inter()}};
100+
return new oatpp::Type(CLASS_ID, info);
101+
}
102+
95103
public:
96104

97105
static const oatpp::ClassId CLASS_ID;
98106

99107
static oatpp::Type *getType() {
100-
static Type type(
101-
CLASS_ID, nullptr, nullptr,
102-
{
103-
{"test", new Inter()}
104-
}
105-
);
106-
return &type;
108+
static Type* type = createType();
109+
return type;
107110
}
108111

109112
};
@@ -141,18 +144,21 @@ namespace __class {
141144

142145
};
143146

147+
private:
148+
149+
static oatpp::Type* createType() {
150+
oatpp::Type::Info info;
151+
info.interpretationMap = {{"test", new Inter()}};
152+
return new oatpp::Type(CLASS_ID, info);
153+
}
154+
144155
public:
145156

146157
static const oatpp::ClassId CLASS_ID;
147158

148159
static oatpp::Type *getType() {
149-
static Type type(
150-
CLASS_ID, nullptr, nullptr,
151-
{
152-
{"test", new Inter()}
153-
}
154-
);
155-
return &type;
160+
static Type* type = createType();
161+
return type;
156162
}
157163

158164
};
@@ -177,18 +183,21 @@ namespace __class {
177183

178184
};
179185

186+
private:
187+
188+
static oatpp::Type* createType() {
189+
oatpp::Type::Info info;
190+
info.interpretationMap = {{"test", new Inter()}};
191+
return new oatpp::Type(CLASS_ID, info);
192+
}
193+
180194
public:
181195

182196
static const oatpp::ClassId CLASS_ID;
183197

184198
static oatpp::Type *getType() {
185-
static Type type(
186-
CLASS_ID, nullptr, nullptr,
187-
{
188-
{"test", new Inter()}
189-
}
190-
);
191-
return &type;
199+
static Type* type = createType();
200+
return type;
192201
}
193202

194203
};

0 commit comments

Comments
 (0)