@@ -83,60 +83,65 @@ inline T convertFromString(StringView /*str*/)
83
83
type_name);
84
84
}
85
85
86
- template <>
86
+ template <> [[nodiscard]]
87
87
std::string convertFromString<std::string>(StringView str);
88
88
89
- template <>
89
+ template <> [[nodiscard]]
90
90
const char * convertFromString<const char *>(StringView str);
91
91
92
- template <>
92
+ template <> [[nodiscard]]
93
93
int convertFromString<int >(StringView str);
94
94
95
- template <>
95
+ template <> [[nodiscard]]
96
96
unsigned convertFromString<unsigned >(StringView str);
97
97
98
- template <>
98
+ template <> [[nodiscard]]
99
99
long convertFromString<long >(StringView str);
100
100
101
- template <>
101
+ template <> [[nodiscard]]
102
102
unsigned long convertFromString<unsigned long >(StringView str);
103
103
104
- template <>
104
+ template <> [[nodiscard]]
105
105
float convertFromString<float >(StringView str);
106
106
107
- template <>
107
+ template <> [[nodiscard]]
108
108
double convertFromString<double >(StringView str);
109
109
110
- template <> // Integer numbers separated by the character ";"
110
+ // Integer numbers separated by the character ";"
111
+ template <> [[nodiscard]]
111
112
std::vector<int > convertFromString<std::vector<int >>(StringView str);
112
113
113
- template <> // Real numbers separated by the character ";"
114
+ // Real numbers separated by the character ";"
115
+ template <> [[nodiscard]]
114
116
std::vector<double > convertFromString<std::vector<double >>(StringView str);
115
117
116
- template <> // This recognizes either 0/1, true/false, TRUE/FALSE
118
+ // This recognizes either 0/1, true/false, TRUE/FALSE
119
+ template <> [[nodiscard]]
117
120
bool convertFromString<bool >(StringView str);
118
121
119
- template <> // Names with all capital letters
122
+ // Names with all capital letters
123
+ template <> [[nodiscard]]
120
124
NodeStatus convertFromString<NodeStatus>(StringView str);
121
125
122
- template <> // Names with all capital letters
126
+ // Names with all capital letters
127
+ template <> [[nodiscard]]
123
128
NodeType convertFromString<NodeType>(StringView str);
124
129
125
- template <>
130
+ template <> [[nodiscard]]
126
131
PortDirection convertFromString<PortDirection>(StringView str);
127
132
128
133
typedef std::function<Any(StringView)> StringConverter;
129
134
130
135
typedef std::unordered_map<const std::type_info*, StringConverter> StringConvertersMap;
131
136
132
137
// helper function
133
- template <typename T>
138
+ template <typename T> [[nodiscard]]
134
139
inline StringConverter GetAnyFromStringFunctor ()
135
140
{
136
141
return [](StringView str) { return Any (convertFromString<T>(str)); };
137
142
}
138
143
139
- template <>
144
+ template <> [[nodiscard]]
140
145
inline StringConverter GetAnyFromStringFunctor<void >()
141
146
{
142
147
return {};
@@ -153,10 +158,8 @@ std::string toStr(const T& value)
153
158
return std::to_string (value);
154
159
}
155
160
156
- template <> [[nodiscard]] inline
157
- std::string toStr<bool >(const bool & value) {
158
- return value ? " true" : " false" ;
159
- }
161
+ template <> [[nodiscard]]
162
+ std::string toStr<bool >(const bool & value);
160
163
161
164
template <> [[nodiscard]]
162
165
std::string toStr<std::string>(const std::string& value);
@@ -172,9 +175,6 @@ std::string toStr(BT::NodeStatus status, bool colored);
172
175
173
176
std::ostream& operator <<(std::ostream& os, const BT::NodeStatus& status);
174
177
175
- /* *
176
- * @brief toStr converts NodeType to string.
177
- */
178
178
template <> [[nodiscard]]
179
179
std::string toStr<BT::NodeType>(const BT::NodeType& type);
180
180
0 commit comments