Skip to content

Commit fc614a4

Browse files
committed
Fix for old compiler
1 parent 30aa433 commit fc614a4

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

drogon_ctl/create_swagger.cc

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,33 +104,38 @@ class StructNode
104104
}
105105
}
106106
}
107-
return {content.substr(pos1, pos2 - pos1), content.substr(pos2 + 1)};
107+
return std::pair<std::string, std::string>(content.substr(pos1,
108+
pos2 - pos1),
109+
content.substr(pos2 + 1));
108110
}
109111
std::pair<StructNodePtr, std::string> findClass(const std::string &content)
110112
{
111113
LOG_DEBUG << "findClass: " << content;
112114
if (content.empty())
113-
return {nullptr, ""};
115+
return std::pair<StructNodePtr, std::string>(nullptr, "");
114116
std::regex rx(R"(class[ \r\n]+([^ \r\n\{]+)[ \r\n\{:]+)");
115117
std::smatch results;
116118
if (std::regex_search(content, results, rx))
117119
{
118120
assert(results.size() > 1);
119121
auto nextPart =
120122
findContentOfClassOrNameSpace(content, results.position());
121-
return {std::make_shared<StructNode>(nextPart.first,
122-
results[1].str(),
123-
kClass),
124-
nextPart.second};
123+
return std::pair<StructNodePtr, std::string>(
124+
std::make_shared<StructNode>(nextPart.first,
125+
results[1].str(),
126+
kClass),
127+
nextPart.second);
125128
}
126-
return {nullptr, ""};
129+
return std::pair<StructNodePtr, std::string>(nullptr, "");
127130
}
128131
std::tuple<std::string, StructNodePtr, std::string> findNameSpace(
129132
const std::string &content)
130133
{
131134
LOG_DEBUG << "findNameSpace";
132135
if (content.empty())
133-
return {"", nullptr, ""};
136+
return std::tuple<std::string, StructNodePtr, std::string>("",
137+
nullptr,
138+
"");
134139
std::regex rx(R"(namespace[ \r\n]+([^ \r\n]+)[ \r\n]*\{)");
135140
std::smatch results;
136141
if (std::regex_search(content, results, rx))
@@ -143,11 +148,14 @@ class StructNode
143148
results[1].str(),
144149
kNameSpace);
145150

146-
return {first, npNodePtr, nextPart.second};
151+
return std::tuple<std::string, StructNodePtr, std::string>(
152+
first, npNodePtr, nextPart.second);
147153
}
148154
else
149155
{
150-
return {"", nullptr, ""};
156+
return std::tuple<std::string, StructNodePtr, std::string>("",
157+
nullptr,
158+
"");
151159
}
152160
}
153161
std::vector<StructNodePtr> parse(const std::string &content)
@@ -221,6 +229,10 @@ class StructNode
221229
{
222230
child->print(indent + 2);
223231
}
232+
if (type_ == kClass)
233+
{
234+
std::cout << content_ << "\n";
235+
}
224236
std::cout << ind << "}";
225237
if (type_ == kClass)
226238
std::cout << ";";

0 commit comments

Comments
 (0)