Skip to content

Commit e1d1e73

Browse files
Barnabás Domozibarnabasdomozi
authored andcommitted
[PythonService] move boolToString to util
1 parent 8e4a5d5 commit e1d1e73

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

plugins/python/service/include/service/pythonservice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ class PythonServiceHandler : virtual public LanguageServiceIf
240240
std::shared_ptr<std::string> _datadir;
241241
const cc::webserver::ServerContext& _context;
242242

243-
inline const char* boolToString(bool b) { return b ? "true" : "false"; }
244243
void setInfoProperties(AstNodeInfo& info, const model::PYName& pyname);
245244
};
246245

plugins/python/service/src/pythonservice.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <service/pythonservice.h>
22
#include <projectservice/projectservice.h>
33
#include <util/dbutil.h>
4+
#include <util/util.h>
45
#include <model/pyname.h>
56
#include "diagram.h"
67

@@ -89,19 +90,19 @@ void PythonServiceHandler::getProperties(
8990
return_.emplace("Full name", pyname.full_name);
9091
}
9192

92-
return_.emplace("Builtin", PythonServiceHandler::boolToString(pyname.is_builtin));
93+
return_.emplace("Builtin", util::boolToString(pyname.is_builtin));
9394

9495
if(!pyname.type_hint.empty())
9596
{
9697
return_.emplace("Type hint", pyname.type_hint);
9798
}
9899

99-
return_.emplace("Function call", PythonServiceHandler::boolToString(pyname.is_call));
100+
return_.emplace("Function call", util::boolToString(pyname.is_call));
100101

101102
#ifndef NDEBUG
102103
return_.emplace("ID", std::to_string(pyname.id));
103104
return_.emplace("REF_ID", std::to_string(pyname.ref_id));
104-
return_.emplace("DEFINITION", PythonServiceHandler::boolToString(pyname.is_definition));
105+
return_.emplace("DEFINITION", util::boolToString(pyname.is_definition));
105106
#endif
106107

107108
return;

util/include/util/util.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ std::string textRange(
2929
*/
3030
std::string escapeHtml(const std::string& str_);
3131

32+
inline const char* boolToString(bool b) {
33+
return b ? "true" : "false";
34+
}
35+
3236
}
3337
}
3438

0 commit comments

Comments
 (0)