File tree Expand file tree Collapse file tree 2 files changed +17
-17
lines changed Expand file tree Collapse file tree 2 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -35,4 +35,21 @@ class AbstractTreeDecoder {
35
35
virtual void readNode (Defect *def, const pt::ptree &node) = 0;
36
36
};
37
37
38
+ template <typename TNode>
39
+ bool findChildOf (TNode **pDst, TNode &node, const char *key)
40
+ {
41
+ if (node.not_found () == node.find (key))
42
+ return false ;
43
+
44
+ *pDst = &node.get_child (key);
45
+ return true ;
46
+ }
47
+
48
+ template <typename T>
49
+ inline T valueOf (const pt::ptree &node, const char *path, const T &defVal)
50
+ {
51
+ const boost::optional<T> &opt = node.get_optional <T>(path);
52
+ return opt.get_value_or (defVal);
53
+ }
54
+
38
55
#endif /* H_GUARD_ABSTRACT_TREE_H */
Original file line number Diff line number Diff line change @@ -97,16 +97,6 @@ void JsonParser::Private::dataError(const std::string &msg)
97
97
<< this ->defNumber << " : " << msg << " \n " ;
98
98
}
99
99
100
- template <typename TNode>
101
- bool findChildOf (TNode **pDst, TNode &node, const char *key)
102
- {
103
- if (node.not_found () == node.find (key))
104
- return false ;
105
-
106
- *pDst = &node.get_child (key);
107
- return true ;
108
- }
109
-
110
100
JsonParser::JsonParser (InStream &input):
111
101
d(new Private(input))
112
102
{
@@ -157,13 +147,6 @@ const TScanProps& JsonParser::getScanProps() const
157
147
return d->scanProps ;
158
148
}
159
149
160
- template <typename T>
161
- inline T valueOf (const pt::ptree &node, const char *path, const T &defVal)
162
- {
163
- const boost::optional<T> &opt = node.get_optional <T>(path);
164
- return opt.get_value_or (defVal);
165
- }
166
-
167
150
bool JsonParser::Private::readNext (Defect *def)
168
151
{
169
152
try {
You can’t perform that action at this time.
0 commit comments