@@ -1160,29 +1160,23 @@ WsjcppYamlCursor &WsjcppYamlCursor::comment(const std::string& sComment) {
11601160
11611161// ---------------------------------------------------------------------
11621162
1163- std::string WsjcppYamlCursor::valStr () {
1163+ std::string WsjcppYamlCursor::valStr () const {
11641164 return m_pCurrentNode != nullptr ? m_pCurrentNode->getValue () : " " ;
11651165}
11661166
1167- // ---------------------------------------------------------------------
1168-
11691167WsjcppYamlCursor &WsjcppYamlCursor::val (const std::string &sValue ) {
11701168 if (m_pCurrentNode != nullptr ) {
11711169 m_pCurrentNode->setValue (sValue ); // TODO reserch need or not add quotes
11721170 }
11731171 return *this ;
11741172}
11751173
1176- // ---------------------------------------------------------------------
1177-
11781174WsjcppYamlCursor &WsjcppYamlCursor::val (const char *sValue ) {
11791175 this ->val (std::string (sValue ));
11801176 return *this ;
11811177}
11821178
1183- // ---------------------------------------------------------------------
1184-
1185- int WsjcppYamlCursor::valInt () {
1179+ int WsjcppYamlCursor::valInt () const {
11861180 if (m_pCurrentNode != nullptr ) {
11871181 std::string sValue = m_pCurrentNode->getValue ();
11881182 sValue = WsjcppYaml::toLower (sValue );
@@ -1195,18 +1189,14 @@ int WsjcppYamlCursor::valInt() {
11951189 return 0 ;
11961190}
11971191
1198- // ---------------------------------------------------------------------
1199-
12001192WsjcppYamlCursor &WsjcppYamlCursor::val (int nValue) {
12011193 if (m_pCurrentNode != nullptr ) {
12021194 m_pCurrentNode->setValue (std::to_string (nValue));
12031195 }
12041196 return *this ;
12051197}
12061198
1207- // ---------------------------------------------------------------------
1208-
1209- bool WsjcppYamlCursor::valBool () {
1199+ bool WsjcppYamlCursor::valBool () const {
12101200 if (m_pCurrentNode != nullptr ) {
12111201 std::string sValue = m_pCurrentNode->getValue ();
12121202 sValue = WsjcppYaml::toLower (sValue );
@@ -1222,39 +1212,47 @@ bool WsjcppYamlCursor::valBool() {
12221212 return false ;
12231213}
12241214
1225- // ---------------------------------------------------------------------
1226-
12271215WsjcppYamlCursor &WsjcppYamlCursor::val (bool bValue) {
12281216 if (m_pCurrentNode != nullptr ) {
12291217 m_pCurrentNode->setValue ((bValue ? " yes" : " no" ));
12301218 }
12311219 return *this ;
12321220}
12331221
1234- // ---------------------------------------------------------------------
1235-
12361222WsjcppYamlNode *WsjcppYamlCursor::node () {
12371223 return m_pCurrentNode;
12381224}
12391225
1240- // ---------------------------------------------------------------------
1241-
12421226WsjcppYamlCursor WsjcppYamlCursor::operator [](int idx) const {
12431227 if (m_pCurrentNode != nullptr && m_pCurrentNode->isArray () && idx < m_pCurrentNode->getLength () && idx >= 0 ) {
12441228 return WsjcppYamlCursor (m_pCurrentNode->getElement (idx));
12451229 }
12461230 return WsjcppYamlCursor ();
12471231}
12481232
1249- // ---------------------------------------------------------------------
1250-
12511233WsjcppYamlCursor WsjcppYamlCursor::operator [](const std::string &sName ) const {
12521234 if (m_pCurrentNode != nullptr && m_pCurrentNode->isMap () && m_pCurrentNode->hasElement (sName )) {
12531235 return WsjcppYamlCursor (m_pCurrentNode->getElement (sName ));
12541236 }
12551237 return WsjcppYamlCursor ();
12561238}
12571239
1240+ WsjcppYamlCursor& WsjcppYamlCursor::operator =(const char *sVal ) {
1241+ return this ->val (std::string (sVal ));
1242+ }
1243+
1244+ WsjcppYamlCursor& WsjcppYamlCursor::operator =(const std::string &sVal ) {
1245+ return this ->val (sVal );
1246+ }
1247+
1248+ WsjcppYamlCursor& WsjcppYamlCursor::operator =(const int &nVal) {
1249+ return this ->val (nVal);
1250+ }
1251+
1252+ WsjcppYamlCursor& WsjcppYamlCursor::operator =(const bool &bVal) {
1253+ return this ->val (bVal);
1254+ }
1255+
12581256// ---------------------------------------------------------------------
12591257// WsjcppYaml
12601258
0 commit comments