@@ -61,8 +61,8 @@ class OR_pascalImp : public OR_pascal
61
61
62
62
private:
63
63
void loadDataset (const string &path, const string &nameImageSet, vector< Ptr<Object> > &imageSet);
64
- Ptr<Object> parseAnnotation (const string path, const string id);
65
- const char * parseNodeText (XMLElement* node, const string nodeName, const string defaultValue);
64
+ Ptr<Object> parseAnnotation (const string & path, const string & id);
65
+ const char * parseNodeText (XMLElement* node, const string & nodeName, const string & defaultValue);
66
66
};
67
67
68
68
@@ -105,17 +105,20 @@ void OR_pascalImp::loadDataset(const string &path, const string &nameImageSet, v
105
105
}
106
106
}
107
107
108
- const char * OR_pascalImp::parseNodeText (XMLElement* node, const string nodeName, const string defaultValue)
108
+ const char * OR_pascalImp::parseNodeText (XMLElement* node, const string & nodeName, const string & defaultValue)
109
109
{
110
- const char * e = node->FirstChildElement (nodeName.c_str ())->GetText ();
110
+ XMLElement* child = node->FirstChildElement (nodeName.c_str ());
111
+ if ( child == 0 )
112
+ return defaultValue.c_str ();
111
113
112
- if ( e != 0 )
113
- return e ;
114
- else
114
+ const char * e = child->GetText ();
115
+ if ( e == 0 )
115
116
return defaultValue.c_str ();
117
+
118
+ return e ;
116
119
}
117
120
118
- Ptr<Object> OR_pascalImp::parseAnnotation (const string path, const string id)
121
+ Ptr<Object> OR_pascalImp::parseAnnotation (const string & path, const string & id)
119
122
{
120
123
string pathAnnotations (path + " Annotations/" );
121
124
string pathImages (path + " JPEGImages/" );
0 commit comments