File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,12 @@ int main(int argc, char* argv[]) {
5555 return -1 ;
5656 }
5757 std::cout << " Done." << std::endl;
58- std::string s = yaml[" version" ];
59- // int nVer = yaml["version"];
60- // bool bVer = yaml["version"];
61- std::cout << s << std::endl;
58+ std::string sVer = yaml[" version" ];
59+ int nVer = yaml[" version" ];
60+ bool bVer = yaml[" version" ];
61+ std::cout << sVer << std::endl;
62+ std::cout << nVer << std::endl;
63+ std::cout << bVer << std::endl;
6264
6365 example_operator_1 ();
6466 return 0 ;
Original file line number Diff line number Diff line change @@ -1237,6 +1237,14 @@ WsjcppYamlCursor WsjcppYamlCursor::operator[](const std::string &sName) const {
12371237 return WsjcppYamlCursor ();
12381238}
12391239
1240+ WsjcppYamlCursor WsjcppYamlCursor::operator [](const char *pName) const {
1241+ std::string sName (pName);
1242+ if (m_pCurrentNode != nullptr && m_pCurrentNode->isMap () && m_pCurrentNode->hasElement (sName )) {
1243+ return WsjcppYamlCursor (m_pCurrentNode->getElement (sName ));
1244+ }
1245+ return WsjcppYamlCursor ();
1246+ }
1247+
12401248WsjcppYamlCursor& WsjcppYamlCursor::operator =(const char *sVal ) {
12411249 return this ->val (std::string (sVal ));
12421250}
Original file line number Diff line number Diff line change @@ -260,12 +260,13 @@ class WsjcppYamlCursor {
260260
261261 std::string getCurrentNodePath ();
262262
263- explicit operator int () const { return valInt (); };
264- explicit operator bool () const { return valBool (); }
263+ operator int () const { return int ( valInt () ); };
264+ // explicit operator bool() const { return valBool(); }
265265 operator std::string () const { return valStr (); };
266266
267267 WsjcppYamlCursor operator [](int idx) const ;
268268 WsjcppYamlCursor operator [](const std::string &sName ) const ;
269+ WsjcppYamlCursor operator [](const char *sName ) const ;
269270
270271 WsjcppYamlCursor& operator =(const char *sVal );
271272 WsjcppYamlCursor& operator =(const std::string &sVal );
You can’t perform that action at this time.
0 commit comments