@@ -77,13 +77,13 @@ WsjcppYamlNode::WsjcppYamlNode(
7777 m_nItemType = nItemType;
7878 m_nValueQuotes = WSJCPP_YAML_QUOTES_NONE;
7979 m_nNameQuotes = WSJCPP_YAML_QUOTES_NONE;
80- // TODO get child intent
80+ // TODO get child indent
8181 if (m_pParent != nullptr && m_pParent->getParent () != nullptr ) {
82- m_nNodeDiffIntent = 2 ;
83- m_sNodeDiffIntent = " " ;
82+ m_nNodeDiffIndent = 2 ;
83+ m_sNodeDiffIndent = " " ;
8484 } else {
85- m_nNodeDiffIntent = 0 ;
86- m_sNodeDiffIntent = " " ;
85+ m_nNodeDiffIndent = 0 ;
86+ m_sNodeDiffIndent = " " ;
8787 }
8888
8989 TAG = " WsjcppYamlNode" ;
@@ -334,7 +334,7 @@ bool WsjcppYamlNode::createElementMap(const std::string &sName, WsjcppYamlQuotes
334334 WsjcppYamlPlaceInFile pl;
335335 WsjcppYamlNode *pNewItem = new WsjcppYamlNode (this , pl, WSJCPP_YAML_NODE_MAP);
336336 pNewItem->setName (sName , nNameQuotes);
337- // pNewItem->setNodeIntents ({2});
337+ // pNewItem->setNodeIndents ({2});
338338 this ->setElement (sName , pNewItem);
339339 return true ;
340340}
@@ -521,7 +521,7 @@ std::string WsjcppYamlNode::getSerializedName() {
521521
522522// ---------------------------------------------------------------------
523523
524- std::string WsjcppYamlNode::toString (std::string sIntent ) {
524+ std::string WsjcppYamlNode::toString (std::string sIndent ) {
525525 std::string sRet = " " ;
526526 if (this ->isValue ()) {
527527 if (m_nValueQuotes == WSJCPP_YAML_QUOTES_DOUBLE) {
@@ -549,7 +549,7 @@ std::string WsjcppYamlNode::toString(std::string sIntent) {
549549 return sRet ;
550550 } else if (this ->isEmpty ()) {
551551 if (m_sComment.length () > 0 ) {
552- sRet += sIntent + m_sNodeDiffIntent + " # " + m_sComment;
552+ sRet += sIndent + m_sNodeDiffIndent + " # " + m_sComment;
553553 }
554554 return sRet ;
555555 } else if (this ->isArray ()) {
@@ -559,16 +559,16 @@ std::string WsjcppYamlNode::toString(std::string sIntent) {
559559 std::string sVal = pNode->toString ();
560560 sVal = WsjcppCore::trim (sVal );
561561 if (sVal .length () > 0 ) { // empty string have content
562- sRet += sIntent + pNode->getStringNodeLastIntent ();
562+ sRet += sIndent + pNode->getStringNodeLastIndent ();
563563 }
564564 sRet += sVal ;
565565 } else if (pNode->isMap ()) {
566- sRet += sIntent + pNode->getStringNodeLastIntent ();
567- std::string s = pNode->toString (sIntent + pNode->getStringNodeLastIntent ());
566+ sRet += sIndent + pNode->getStringNodeLastIndent ();
567+ std::string s = pNode->toString (sIndent + pNode->getStringNodeLastIndent ());
568568 WsjcppCore::trim (s);
569569 sRet += " - " + s;
570570 } else {
571- sRet += sIntent + pNode->getStringNodeLastIntent ();
571+ sRet += sIndent + pNode->getStringNodeLastIndent ();
572572 sRet += " - " + pNode->toString ();
573573 }
574574 sRet += " \n " ;
@@ -577,28 +577,28 @@ std::string WsjcppYamlNode::toString(std::string sIntent) {
577577 for (int i = 0 ; i < m_vObjects.size (); i++) {
578578 WsjcppYamlNode *pNode = m_vObjects[i];
579579 if (pNode->isEmpty () ) {
580- // sRet += " * " + pNode->toString(sIntent );
581- sRet += pNode->toString (sIntent );
580+ // sRet += " * " + pNode->toString(sIndent );
581+ sRet += pNode->toString (sIndent );
582582 sRet += " \n " ;
583583 } else if (pNode->isUndefined ()) {
584- sRet += sIntent + pNode->getStringNodeLastIntent ()
584+ sRet += sIndent + pNode->getStringNodeLastIndent ()
585585 + pNode->getSerializedName () + " :\n " + pNode->toString ();
586586 } else if (pNode->isArray () || pNode->isMap ()) {
587- sRet += sIntent + pNode->getStringNodeLastIntent ()
587+ sRet += sIndent + pNode->getStringNodeLastIndent ()
588588 + pNode->getSerializedName () + " :" ;
589589 if (pNode->getComment ().length () > 0 ) {
590590 sRet += " # " + pNode->getComment ();
591591 }
592592 sRet += " \n " ;
593- sRet += pNode->toString (sIntent + pNode->getStringNodeLastIntent ());
593+ sRet += pNode->toString (sIndent + pNode->getStringNodeLastIndent ());
594594 } else {
595595 std::string sVal = pNode->toString ();
596596 std::string sVal_ = sVal ;
597597 sVal_ = WsjcppCore::trim (sVal_ );
598598 if (sVal_ .length () > 0 ) {
599599 sVal = " " + sVal ;
600600 }
601- sRet += sIntent + pNode->getStringNodeLastIntent ()
601+ sRet += sIndent + pNode->getStringNodeLastIndent ()
602602 + pNode->getSerializedName () + " :" + sVal ;
603603 sRet += " \n " ;
604604 }
@@ -639,34 +639,34 @@ std::string WsjcppYamlNode::getForLogFormat() {
639639
640640// ---------------------------------------------------------------------
641641
642- int WsjcppYamlNode::getNodeLastIntent () {
643- return m_nNodeDiffIntent ;
642+ int WsjcppYamlNode::getNodeLastIndent () {
643+ return m_nNodeDiffIndent ;
644644}
645645
646646// ---------------------------------------------------------------------
647647
648- std::string WsjcppYamlNode::getStringNodeLastIntent () {
649- return m_sNodeDiffIntent ;
648+ std::string WsjcppYamlNode::getStringNodeLastIndent () {
649+ return m_sNodeDiffIndent ;
650650}
651651
652652// ---------------------------------------------------------------------
653653
654- void WsjcppYamlNode::setNodeIntents (const std::vector<int > & vNodeIntents ) {
655- m_nNodeDiffIntent = vNodeIntents .back ();
656- m_sNodeDiffIntent = " " ;
657- for (int i = 0 ; i < m_nNodeDiffIntent ; i++) {
658- m_sNodeDiffIntent += " " ;
654+ void WsjcppYamlNode::setNodeIndents (const std::vector<int > & vNodeIndents ) {
655+ m_nNodeDiffIndent = vNodeIndents .back ();
656+ m_sNodeDiffIndent = " " ;
657+ for (int i = 0 ; i < m_nNodeDiffIndent ; i++) {
658+ m_sNodeDiffIndent += " " ;
659659 }
660- m_nNodeIntent = 0 ;
661- for (int i = 0 ; i < vNodeIntents .size (); i++) {
662- m_nNodeIntent += vNodeIntents [i];
660+ m_nNodeIndent = 0 ;
661+ for (int i = 0 ; i < vNodeIndents .size (); i++) {
662+ m_nNodeIndent += vNodeIndents [i];
663663 }
664664}
665665
666666// ---------------------------------------------------------------------
667667
668- int WsjcppYamlNode::getNodeIntent () {
669- return m_nNodeIntent ;
668+ int WsjcppYamlNode::getNodeIndent () {
669+ return m_nNodeIndent ;
670670}
671671
672672// ---------------------------------------------------------------------
@@ -725,7 +725,7 @@ std::string WsjcppYamlParsebleLine::getPrefix() {
725725
726726// ---------------------------------------------------------------------
727727
728- int WsjcppYamlParsebleLine::getIntent () {
728+ int WsjcppYamlParsebleLine::getIndent () {
729729 return m_sPrefix.length ();
730730}
731731
@@ -1341,9 +1341,9 @@ bool WsjcppYaml::parse(const std::string &sFileName, const std::string &sBuffer,
13411341 std::vector<std::string> vLines = this ->splitToLines (sBuffer );
13421342 m_pParseCurrentParentNode = m_pRoot;
13431343 m_parsePlaceInFile.setFilename (sFileName );
1344- m_vStackDiffNodeIntents .clear ();
1345- m_vStackDiffNodeIntents .push_back (0 );
1346- m_nParseCurrentIntent = 0 ;
1344+ m_vStackDiffNodeIndents .clear ();
1345+ m_vStackDiffNodeIndents .push_back (0 );
1346+ m_nParseCurrentIndent = 0 ;
13471347 m_pRoot->setPlaceInFile (m_parsePlaceInFile);
13481348
13491349 for (int nLine = 0 ; nLine < vLines.size (); nLine++) {
@@ -1357,12 +1357,12 @@ bool WsjcppYaml::parse(const std::string &sFileName, const std::string &sBuffer,
13571357 bool isEmptyName = m_parseLine.isEmptyName ();
13581358 bool isEmptyValue = m_parseLine.isEmptyValue ();
13591359 bool isArrayItem = m_parseLine.isArrayItem ();
1360- int nLineIntent = m_parseLine.getIntent ();
1361- int nDiffIntent = nLineIntent - m_nParseCurrentIntent ;
1360+ int nLineIndent = m_parseLine.getIndent ();
1361+ int nDiffIndent = nLineIndent - m_nParseCurrentIndent ;
13621362
1363- if (nDiffIntent > 0 ) {
1364- m_vStackDiffNodeIntents .push_back (nDiffIntent );
1365- m_nParseCurrentIntent = m_parseLine.getIntent ();
1363+ if (nDiffIndent > 0 ) {
1364+ m_vStackDiffNodeIndents .push_back (nDiffIndent );
1365+ m_nParseCurrentIndent = m_parseLine.getIndent ();
13661366 }
13671367
13681368 if (m_parseLine.isEmptyLine ()) {
@@ -1372,14 +1372,14 @@ bool WsjcppYaml::parse(const std::string &sFileName, const std::string &sBuffer,
13721372 m_pParseCurrentParentNode, m_parsePlaceInFile,
13731373 WSJCPP_YAML_NODE_EMPTY
13741374 );
1375- pNode->setNodeIntents (m_vStackDiffNodeIntents );
1375+ pNode->setNodeIndents (m_vStackDiffNodeIndents );
13761376 m_pParseCurrentParentNode->appendElement (pNode);
13771377 } else if (m_pParseCurrentParentNode->getParent () != nullptr && (m_pParseCurrentParentNode->getParent ()->isArray () || m_pParseCurrentParentNode->getParent ()->isMap ())) {
13781378 WsjcppYamlNode *pNode = new WsjcppYamlNode (
13791379 m_pParseCurrentParentNode->getParent (), m_parsePlaceInFile,
13801380 WSJCPP_YAML_NODE_EMPTY
13811381 );
1382- pNode->setNodeIntents (m_vStackDiffNodeIntents );
1382+ pNode->setNodeIndents (m_vStackDiffNodeIndents );
13831383 m_pParseCurrentParentNode->getParent ()->appendElement (pNode);
13841384 } else {
13851385 throw std::runtime_error (TAG + " : Empty element can be added only to map or to array" );
@@ -1389,16 +1389,16 @@ bool WsjcppYaml::parse(const std::string &sFileName, const std::string &sBuffer,
13891389 }
13901390
13911391 // fast switch to root
1392- if (nDiffIntent < 0 && m_parseLine.getIntent () == 0 ) {
1393- nDiffIntent = 0 ;
1394- m_nParseCurrentIntent = m_parseLine.getIntent ();
1392+ if (nDiffIndent < 0 && m_parseLine.getIndent () == 0 ) {
1393+ nDiffIndent = 0 ;
1394+ m_nParseCurrentIndent = m_parseLine.getIndent ();
13951395 m_pParseCurrentParentNode = m_pRoot;
1396- m_vStackDiffNodeIntents .clear ();
1397- m_vStackDiffNodeIntents .push_back (0 );
1396+ m_vStackDiffNodeIndents .clear ();
1397+ m_vStackDiffNodeIndents .push_back (0 );
13981398 }
13991399
14001400 // switch to parent
1401- while (nDiffIntent < 0 && m_nParseCurrentIntent != m_parseLine.getIntent ()) {
1401+ while (nDiffIndent < 0 && m_nParseCurrentIndent != m_parseLine.getIndent ()) {
14021402 if (m_pParseCurrentParentNode == nullptr ) {
14031403 sError = " Current node is nullptr, line: " + std::to_string (nLine);
14041404 return false ;
@@ -1407,18 +1407,18 @@ bool WsjcppYaml::parse(const std::string &sFileName, const std::string &sBuffer,
14071407 sError = " Parent of current node is nullptr, line: " + std::to_string (nLine);
14081408 return false ;
14091409 }
1410- m_nParseCurrentIntent = m_nParseCurrentIntent - m_vStackDiffNodeIntents .back ();
1411- m_vStackDiffNodeIntents .pop_back ();
1410+ m_nParseCurrentIndent = m_nParseCurrentIndent - m_vStackDiffNodeIndents .back ();
1411+ m_vStackDiffNodeIndents .pop_back ();
14121412 m_pParseCurrentParentNode = m_pParseCurrentParentNode->getParent ();
1413- if (m_nParseCurrentIntent < m_parseLine.getIntent ()) {
1414- sError = " Wrong intent , expected "
1415- " '" + std::to_string (m_parseLine.getIntent ()) + " ',"
1413+ if (m_nParseCurrentIndent < m_parseLine.getIndent ()) {
1414+ sError = " Wrong indent , expected "
1415+ " '" + std::to_string (m_parseLine.getIndent ()) + " ',"
14161416 " but got '" +
14171417 " in line: (" + sFileName + " :" + std::to_string (nLine) + " )" ;
14181418 return false ;
14191419 }
14201420
1421- if (m_nParseCurrentIntent == m_parseLine.getIntent ()) {
1421+ if (m_nParseCurrentIndent == m_parseLine.getIndent ()) {
14221422 break ;
14231423 }
14241424 }
@@ -1465,7 +1465,7 @@ void WsjcppYaml::process_hasName_emptyValue_arrayItem() {
14651465
14661466void WsjcppYaml::process_hasName_emptyValue_noArrayItem () {
14671467 // std::cout << "process_hasName_emptyValue_noArrayItem" << std::endl;
1468- if (m_parseLine.getIntent () == m_pParseCurrentParentNode->getNodeIntent ()) {
1468+ if (m_parseLine.getIndent () == m_pParseCurrentParentNode->getNodeIndent ()) {
14691469 if (m_pParseCurrentParentNode->getParent () != nullptr ) {
14701470 m_pParseCurrentParentNode = m_pParseCurrentParentNode->getParent ();
14711471 }
@@ -1479,10 +1479,10 @@ void WsjcppYaml::process_hasName_emptyValue_noArrayItem() {
14791479 pNode->doValue ();
14801480 pNode->setValue (m_parseLine.getValue (), m_parseLine.getValueQuotes ());
14811481 }
1482- // int nDiffIntent = m_parseLine.getIntent () - m_nParseCurrentIntent ;
1482+ // int nDiffIndent = m_parseLine.getIndent () - m_nParseCurrentIndent ;
14831483 pNode->setName (m_parseLine.getName (), m_parseLine.getNameQuotes ());
14841484 pNode->setComment (m_parseLine.getComment ());
1485- pNode->setNodeIntents (m_vStackDiffNodeIntents );
1485+ pNode->setNodeIndents (m_vStackDiffNodeIndents );
14861486
14871487 m_pParseCurrentParentNode->setElement (m_parseLine.getName (), pNode);
14881488 if (pNode->isUndefined ()) {
@@ -1510,7 +1510,7 @@ void WsjcppYaml::process_hasName_hasValue_arrayItem() {
15101510 m_pParseCurrentParentNode->appendElement (pMapItem);
15111511 // std::cout << "appended " << std::endl;
15121512 m_pParseCurrentParentNode = pMapItem;
1513- pMapItem->setNodeIntents (m_vStackDiffNodeIntents );
1513+ pMapItem->setNodeIndents (m_vStackDiffNodeIndents );
15141514
15151515 WsjcppYamlNode *pNode = new WsjcppYamlNode (
15161516 m_pParseCurrentParentNode, m_parsePlaceInFile,
@@ -1521,9 +1521,9 @@ void WsjcppYaml::process_hasName_hasValue_arrayItem() {
15211521 pNode->setName (m_parseLine.getName (), m_parseLine.getNameQuotes ());
15221522 pMapItem->setElement (m_parseLine.getName (), pNode);
15231523
1524- // next intents must be for map
1525- m_vStackDiffNodeIntents .push_back (2 );
1526- m_nParseCurrentIntent += 2 ;
1524+ // next indents must be for map
1525+ m_vStackDiffNodeIndents .push_back (2 );
1526+ m_nParseCurrentIndent += 2 ;
15271527}
15281528
15291529// ---------------------------------------------------------------------
@@ -1539,7 +1539,7 @@ void WsjcppYaml::process_hasName_hasValue_noArrayItem() {
15391539 pNode->setComment (m_parseLine.getComment ());
15401540 pNode->setValue (m_parseLine.getValue (), m_parseLine.getValueQuotes ());
15411541 pNode->setName (m_parseLine.getName (), m_parseLine.getNameQuotes ());
1542- pNode->setNodeIntents (m_vStackDiffNodeIntents );
1542+ pNode->setNodeIndents (m_vStackDiffNodeIndents );
15431543 m_pParseCurrentParentNode->setElement (m_parseLine.getName (), pNode);
15441544
15451545 // m_pParseCurrentParentNode = pItem;
@@ -1560,7 +1560,7 @@ void WsjcppYaml::process_emptyName_hasValue_arrayItem() {
15601560 pNode->setValue (m_parseLine.getValue (), m_parseLine.getValueQuotes ());
15611561 m_pParseCurrentParentNode->appendElement (pNode);
15621562 // m_pParseCurrentParentNode = pNode;
1563- pNode->setNodeIntents (m_vStackDiffNodeIntents );
1563+ pNode->setNodeIndents (m_vStackDiffNodeIndents );
15641564}
15651565
15661566// ---------------------------------------------------------------------
@@ -1584,7 +1584,7 @@ void WsjcppYaml::process_emptyName_emptyValue_arrayItem() {
15841584 );
15851585 pNode->setComment (m_parseLine.getComment ());
15861586 pNode->setValue (m_parseLine.getValue (), m_parseLine.getValueQuotes ());
1587- pNode->setNodeIntents (m_vStackDiffNodeIntents );
1587+ pNode->setNodeIndents (m_vStackDiffNodeIndents );
15881588 m_pParseCurrentParentNode->appendElement (pNode);
15891589}
15901590
@@ -1597,7 +1597,7 @@ void WsjcppYaml::process_emptyName_emptyValue_noArrayItem() {
15971597 WSJCPP_YAML_NODE_EMPTY
15981598 );
15991599 pNode->setComment (m_parseLine.getComment ());
1600- pNode->setNodeIntents (m_vStackDiffNodeIntents );
1600+ pNode->setNodeIndents (m_vStackDiffNodeIndents );
16011601 m_pParseCurrentParentNode->appendElement (pNode);
16021602}
16031603
@@ -1609,7 +1609,7 @@ void WsjcppYaml::logUnknownParseLine() {
16091609 " desc: \" unknown_line\"\n "
16101610 " line_number: " + std::to_string (m_pParseCurrentParentNode->getPlaceInFile ().getNumberOfLine ()) + " \n "
16111611 " line: \" " + m_parsePlaceInFile.getLine () + " \"\n "
1612- " intent : " + std::to_string (m_nParseCurrentIntent ) + " \n "
1612+ " indent : " + std::to_string (m_nParseCurrentIndent ) + " \n "
16131613 " filename: \" " + m_pParseCurrentParentNode->getPlaceInFile ().getFilename () + " \" "
16141614 );
16151615}
0 commit comments