@@ -68,7 +68,7 @@ std::string WsjcppYamlPlaceInFile::getForLogFormat() {
6868WsjcppYamlItem::WsjcppYamlItem (
6969 WsjcppYamlItem *pParent,
7070 const WsjcppYamlPlaceInFile &placeInFile,
71- WsjcppYamlItemType nItemType
71+ WsjcppYamlNodeType nItemType
7272) {
7373 m_pParent = pParent;
7474 m_placeInFile.setFilename (placeInFile.getFilename ());
@@ -143,14 +143,14 @@ WsjcppYamlQuotes WsjcppYamlItem::getNameQuotes() {
143143// ---------------------------------------------------------------------
144144
145145bool WsjcppYamlItem::isEmpty () {
146- return m_nItemType == WSJCPP_YAML_ITEM_EMPTY ;
146+ return m_nItemType == WSJCPP_YAML_NODE_EMPTY ;
147147}
148148
149149// ---------------------------------------------------------------------
150150
151151void WsjcppYamlItem::doEmpty () {
152- if (m_nItemType == WSJCPP_YAML_ITEM_UNDEFINED ) {
153- m_nItemType = WSJCPP_YAML_ITEM_EMPTY ;
152+ if (m_nItemType == WSJCPP_YAML_NODE_UNDEFINED ) {
153+ m_nItemType = WSJCPP_YAML_NODE_EMPTY ;
154154 } else {
155155 WsjcppLog::throw_err (TAG, " Element already defined as '" + this ->getItemTypeAsString () + " '" );
156156 }
@@ -159,14 +159,14 @@ void WsjcppYamlItem::doEmpty() {
159159// ---------------------------------------------------------------------
160160
161161bool WsjcppYamlItem::isUndefined () {
162- return m_nItemType == WSJCPP_YAML_ITEM_UNDEFINED ;
162+ return m_nItemType == WSJCPP_YAML_NODE_UNDEFINED ;
163163}
164164
165165// ---------------------------------------------------------------------
166166
167167void WsjcppYamlItem::doArray () {
168- if (m_nItemType == WSJCPP_YAML_ITEM_UNDEFINED ) {
169- m_nItemType = WSJCPP_YAML_ITEM_ARRAY ;
168+ if (m_nItemType == WSJCPP_YAML_NODE_UNDEFINED ) {
169+ m_nItemType = WSJCPP_YAML_NODE_ARRAY ;
170170 } else {
171171 WsjcppLog::throw_err (TAG, " Element already defined as '" + this ->getItemTypeAsString () + " '" );
172172 }
@@ -175,8 +175,8 @@ void WsjcppYamlItem::doArray() {
175175// ---------------------------------------------------------------------
176176
177177void WsjcppYamlItem::doMap () {
178- if (m_nItemType == WSJCPP_YAML_ITEM_UNDEFINED ) {
179- m_nItemType = WSJCPP_YAML_ITEM_MAP ;
178+ if (m_nItemType == WSJCPP_YAML_NODE_UNDEFINED ) {
179+ m_nItemType = WSJCPP_YAML_NODE_MAP ;
180180 } else {
181181 WsjcppLog::throw_err (TAG, " Element already defined as '" + this ->getItemTypeAsString () + " '" );
182182 }
@@ -185,8 +185,8 @@ void WsjcppYamlItem::doMap() {
185185// ---------------------------------------------------------------------
186186
187187void WsjcppYamlItem::doValue () {
188- if (m_nItemType == WSJCPP_YAML_ITEM_UNDEFINED ) {
189- m_nItemType = WSJCPP_YAML_ITEM_VALUE ;
188+ if (m_nItemType == WSJCPP_YAML_NODE_UNDEFINED ) {
189+ m_nItemType = WSJCPP_YAML_NODE_VALUE ;
190190 } else {
191191 WsjcppLog::throw_err (TAG, " Element already defined as '" + this ->getItemTypeAsString () + " '" );
192192 }
@@ -195,13 +195,13 @@ void WsjcppYamlItem::doValue() {
195195// ---------------------------------------------------------------------
196196
197197bool WsjcppYamlItem::isMap () {
198- return m_nItemType == WSJCPP_YAML_ITEM_MAP ;
198+ return m_nItemType == WSJCPP_YAML_NODE_MAP ;
199199}
200200
201201// ---------------------------------------------------------------------
202202
203203bool WsjcppYamlItem::hasElement (const std::string &sName ) {
204- if (m_nItemType != WSJCPP_YAML_ITEM_MAP ) {
204+ if (m_nItemType != WSJCPP_YAML_NODE_MAP ) {
205205 WsjcppLog::throw_err (TAG, " hasElement('" + sName + " '): Element must be map" );
206206 }
207207 for (int i = 0 ; i < m_vObjects.size (); i++) {
@@ -215,7 +215,7 @@ bool WsjcppYamlItem::hasElement(const std::string &sName) {
215215// ---------------------------------------------------------------------
216216
217217WsjcppYamlItem *WsjcppYamlItem::getElement (const std::string &sName ) {
218- if (m_nItemType != WSJCPP_YAML_ITEM_MAP ) {
218+ if (m_nItemType != WSJCPP_YAML_NODE_MAP ) {
219219 WsjcppLog::throw_err (TAG, " getElement: Element must be map" );
220220 }
221221
@@ -232,11 +232,11 @@ WsjcppYamlItem *WsjcppYamlItem::getElement(const std::string &sName) {
232232// ---------------------------------------------------------------------
233233
234234bool WsjcppYamlItem::setElement (const std::string &sName , WsjcppYamlItem *pItem) {
235- if (m_nItemType == WSJCPP_YAML_ITEM_UNDEFINED ) {
236- m_nItemType = WSJCPP_YAML_ITEM_MAP ; // change item type to map on first element
235+ if (m_nItemType == WSJCPP_YAML_NODE_UNDEFINED ) {
236+ m_nItemType = WSJCPP_YAML_NODE_MAP ; // change item type to map on first element
237237 }
238238
239- if (m_nItemType != WSJCPP_YAML_ITEM_MAP ) {
239+ if (m_nItemType != WSJCPP_YAML_NODE_MAP ) {
240240 WsjcppLog::throw_err (TAG, " setElement, Element must be 'map' for " + pItem->getPlaceInFile ().getForLogFormat ());
241241 }
242242
@@ -250,7 +250,7 @@ bool WsjcppYamlItem::setElement(const std::string &sName, WsjcppYamlItem *pItem)
250250// ---------------------------------------------------------------------
251251
252252bool WsjcppYamlItem::removeElement (const std::string &sName ) {
253- if (m_nItemType != WSJCPP_YAML_ITEM_MAP ) {
253+ if (m_nItemType != WSJCPP_YAML_NODE_MAP ) {
254254 WsjcppLog::throw_err (TAG, " removeElement: Element must be map" );
255255 }
256256 std::vector<WsjcppYamlItem *>::iterator it;
@@ -268,7 +268,7 @@ bool WsjcppYamlItem::removeElement(const std::string &sName) {
268268// ---------------------------------------------------------------------
269269
270270std::vector<std::string> WsjcppYamlItem::getKeys () {
271- if (m_nItemType != WSJCPP_YAML_ITEM_MAP ) {
271+ if (m_nItemType != WSJCPP_YAML_NODE_MAP ) {
272272 WsjcppLog::throw_err (TAG, " getKeys: Element must be map" );
273273 }
274274 std::vector<std::string> vKeys;
@@ -290,11 +290,11 @@ bool WsjcppYamlItem::setElementValue(
290290 WsjcppYamlQuotes nNameQuotes,
291291 WsjcppYamlQuotes nValueQuotes
292292) {
293- if (m_nItemType == WSJCPP_YAML_ITEM_UNDEFINED ) {
294- m_nItemType = WSJCPP_YAML_ITEM_MAP ; // change item type to map on first element
293+ if (m_nItemType == WSJCPP_YAML_NODE_UNDEFINED ) {
294+ m_nItemType = WSJCPP_YAML_NODE_MAP ; // change item type to map on first element
295295 }
296296
297- if (m_nItemType != WSJCPP_YAML_ITEM_MAP ) {
297+ if (m_nItemType != WSJCPP_YAML_NODE_MAP ) {
298298 WsjcppLog::throw_err (TAG, " setElement, Element must be 'map' for " + this ->getPlaceInFile ().getForLogFormat ());
299299 }
300300
@@ -303,7 +303,7 @@ bool WsjcppYamlItem::setElementValue(
303303 pItem->setValue (sValue , nValueQuotes);
304304 } else {
305305 WsjcppYamlPlaceInFile pl;
306- WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WsjcppYamlItemType::WSJCPP_YAML_ITEM_VALUE );
306+ WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WSJCPP_YAML_NODE_VALUE );
307307 pNewItem->setName (sName , nNameQuotes);
308308 pNewItem->setValue (sValue , nValueQuotes);
309309 this ->setElement (sName , pNewItem);
@@ -314,14 +314,14 @@ bool WsjcppYamlItem::setElementValue(
314314// ---------------------------------------------------------------------
315315
316316bool WsjcppYamlItem::createElementMap (const std::string &sName , WsjcppYamlQuotes nNameQuotes) {
317- if (m_nItemType != WSJCPP_YAML_ITEM_MAP ) {
317+ if (m_nItemType != WSJCPP_YAML_NODE_MAP ) {
318318 WsjcppLog::throw_err (TAG, " createElementMap, Element must be 'map' for " + this ->getPlaceInFile ().getForLogFormat ());
319319 }
320320 if (this ->hasElement (sName )) {
321321 return false ; // already exists
322322 }
323323 WsjcppYamlPlaceInFile pl;
324- WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WsjcppYamlItemType::WSJCPP_YAML_ITEM_MAP );
324+ WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WSJCPP_YAML_NODE_MAP );
325325 pNewItem->setName (sName , nNameQuotes);
326326 this ->setElement (sName , pNewItem);
327327 return true ;
@@ -330,26 +330,26 @@ bool WsjcppYamlItem::createElementMap(const std::string &sName, WsjcppYamlQuotes
330330// ---------------------------------------------------------------------
331331
332332WsjcppYamlItem *WsjcppYamlItem::createElementMap () {
333- if (m_nItemType != WSJCPP_YAML_ITEM_ARRAY ) {
333+ if (m_nItemType != WSJCPP_YAML_NODE_ARRAY ) {
334334 WsjcppLog::throw_err (TAG, " createElementMap, Element must be 'array' for " + this ->getPlaceInFile ().getForLogFormat ());
335335 }
336336 WsjcppYamlPlaceInFile pl;
337- WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WsjcppYamlItemType::WSJCPP_YAML_ITEM_MAP );
337+ WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WSJCPP_YAML_NODE_MAP );
338338 this ->appendElement (pNewItem);
339339 return pNewItem;
340340}
341341
342342// ---------------------------------------------------------------------
343343
344344bool WsjcppYamlItem::createElementArray (const std::string &sName , WsjcppYamlQuotes nNameQuotes) {
345- if (m_nItemType != WSJCPP_YAML_ITEM_MAP ) {
345+ if (m_nItemType != WSJCPP_YAML_NODE_MAP ) {
346346 WsjcppLog::throw_err (TAG, " createElementArray, Element must be 'map' for " + this ->getPlaceInFile ().getForLogFormat ());
347347 }
348348 if (this ->hasElement (sName )) {
349349 return false ;
350350 }
351351 WsjcppYamlPlaceInFile pl;
352- WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WsjcppYamlItemType::WSJCPP_YAML_ITEM_ARRAY );
352+ WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WSJCPP_YAML_NODE_ARRAY );
353353 pNewItem->setName (sName , nNameQuotes);
354354 this ->setElement (sName , pNewItem);
355355 return true ;
@@ -358,13 +358,13 @@ bool WsjcppYamlItem::createElementArray(const std::string &sName, WsjcppYamlQuot
358358// ---------------------------------------------------------------------
359359
360360bool WsjcppYamlItem::isArray () {
361- return m_nItemType == WSJCPP_YAML_ITEM_ARRAY ;
361+ return m_nItemType == WSJCPP_YAML_NODE_ARRAY ;
362362}
363363
364364// ---------------------------------------------------------------------
365365
366366int WsjcppYamlItem::getLength () {
367- if (m_nItemType != WSJCPP_YAML_ITEM_ARRAY ) {
367+ if (m_nItemType != WSJCPP_YAML_NODE_ARRAY ) {
368368 WsjcppLog::throw_err (TAG, " getLength, Element must be array for " + this ->getForLogFormat ());
369369 }
370370 int nCount = 0 ;
@@ -379,7 +379,7 @@ int WsjcppYamlItem::getLength() {
379379// ---------------------------------------------------------------------
380380
381381WsjcppYamlItem *WsjcppYamlItem::getElement (int i) {
382- if (m_nItemType != WSJCPP_YAML_ITEM_ARRAY ) {
382+ if (m_nItemType != WSJCPP_YAML_NODE_ARRAY ) {
383383 WsjcppLog::throw_err (TAG, " getElement, Element must be array" );
384384 }
385385 int nCounter = -1 ;
@@ -406,7 +406,7 @@ bool WsjcppYamlItem::appendElement(WsjcppYamlItem *pItem) {
406406 m_vObjects.push_back (pItem); // TODO clone object
407407 return true ;
408408 }
409- if (m_nItemType != WSJCPP_YAML_ITEM_ARRAY ) {
409+ if (m_nItemType != WSJCPP_YAML_NODE_ARRAY ) {
410410 WsjcppLog::throw_err (TAG, " appendElement, Element must be array for " + this ->getForLogFormat ());
411411 }
412412 m_vObjects.push_back (pItem); // TODO clone object
@@ -416,19 +416,19 @@ bool WsjcppYamlItem::appendElement(WsjcppYamlItem *pItem) {
416416// ---------------------------------------------------------------------
417417
418418bool WsjcppYamlItem::appendElementValue (const std::string &sValue , WsjcppYamlQuotes nValueQuotes) {
419- if (m_nItemType != WSJCPP_YAML_ITEM_ARRAY ) {
419+ if (m_nItemType != WSJCPP_YAML_NODE_ARRAY ) {
420420 WsjcppLog::throw_err (TAG, " appendElementValue, Element must be array for " + this ->getForLogFormat ());
421421 }
422422 WsjcppYamlPlaceInFile pl;
423- WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WsjcppYamlItemType::WSJCPP_YAML_ITEM_VALUE );
423+ WsjcppYamlItem *pNewItem = new WsjcppYamlItem (this , pl, WSJCPP_YAML_NODE_VALUE );
424424 pNewItem->setValue (sValue , nValueQuotes);
425425 return this ->appendElement (pNewItem);
426426}
427427
428428// ---------------------------------------------------------------------
429429
430430bool WsjcppYamlItem::removeElement (int i) {
431- if (m_nItemType != WSJCPP_YAML_ITEM_ARRAY ) {
431+ if (m_nItemType != WSJCPP_YAML_NODE_ARRAY ) {
432432 WsjcppLog::throw_err (TAG, " appendElement, Element must be array for " + this ->getForLogFormat ());
433433 }
434434 int nCounter = -1 ;
@@ -459,13 +459,13 @@ bool WsjcppYamlItem::removeElement(int i) {
459459// ---------------------------------------------------------------------
460460
461461bool WsjcppYamlItem::isValue () {
462- return m_nItemType == WSJCPP_YAML_ITEM_VALUE ;
462+ return m_nItemType == WSJCPP_YAML_NODE_VALUE ;
463463}
464464
465465// ---------------------------------------------------------------------
466466
467467std::string WsjcppYamlItem::getValue () {
468- if (m_nItemType != WSJCPP_YAML_ITEM_VALUE ) {
468+ if (m_nItemType != WSJCPP_YAML_NODE_VALUE ) {
469469 WsjcppLog::throw_err (TAG, " getValue, Element must be value for " + this ->getForLogFormat ());
470470 }
471471 return m_sValue;
@@ -474,7 +474,7 @@ std::string WsjcppYamlItem::getValue() {
474474// ---------------------------------------------------------------------
475475
476476void WsjcppYamlItem::setValue (const std::string &sValue , WsjcppYamlQuotes nQuotes) {
477- if (m_nItemType != WSJCPP_YAML_ITEM_VALUE ) {
477+ if (m_nItemType != WSJCPP_YAML_NODE_VALUE ) {
478478 WsjcppLog::throw_err (TAG, " setValue, Element must be value for " + this ->getForLogFormat ());
479479 }
480480 m_nValueQuotes = nQuotes;
@@ -585,13 +585,13 @@ std::string WsjcppYamlItem::toString(std::string sIntent) {
585585// ---------------------------------------------------------------------
586586
587587std::string WsjcppYamlItem::getItemTypeAsString () {
588- if (m_nItemType == WSJCPP_YAML_ITEM_UNDEFINED ) {
588+ if (m_nItemType == WSJCPP_YAML_NODE_UNDEFINED ) {
589589 return " undefined" ;
590- } else if (m_nItemType == WSJCPP_YAML_ITEM_ARRAY ) {
590+ } else if (m_nItemType == WSJCPP_YAML_NODE_ARRAY ) {
591591 return " array" ;
592- } else if (m_nItemType == WSJCPP_YAML_ITEM_MAP ) {
592+ } else if (m_nItemType == WSJCPP_YAML_NODE_MAP ) {
593593 return " map" ;
594- } else if (m_nItemType == WSJCPP_YAML_ITEM_VALUE ) {
594+ } else if (m_nItemType == WSJCPP_YAML_NODE_VALUE ) {
595595 return " value" ;
596596 }
597597 return " unknown" ;
@@ -1257,7 +1257,7 @@ std::vector<std::string> WsjcppYaml::splitToLines(const std::string &sBuffer) {
12571257bool WsjcppYaml::parse (const std::string &sFileName , const std::string &sBuffer , std::string &sError ) {
12581258 this ->clear ();
12591259 if (m_pRoot == nullptr ) {
1260- m_pRoot = new WsjcppYamlItem (nullptr , WsjcppYamlPlaceInFile (), WSJCPP_YAML_ITEM_MAP );
1260+ m_pRoot = new WsjcppYamlItem (nullptr , WsjcppYamlPlaceInFile (), WSJCPP_YAML_NODE_MAP );
12611261 }
12621262
12631263 std::vector<std::string> vLines = this ->splitToLines (sBuffer );
@@ -1290,13 +1290,13 @@ bool WsjcppYaml::parse(const std::string &sFileName, const std::string &sBuffer,
12901290 if (st.pCurItem ->isArray () || st.pCurItem ->isMap () || st.pCurItem ->isUndefined ()) {
12911291 WsjcppYamlItem *pItem = new WsjcppYamlItem (
12921292 st.pCurItem , st.placeInFile ,
1293- WsjcppYamlItemType::WSJCPP_YAML_ITEM_EMPTY
1293+ WSJCPP_YAML_NODE_EMPTY
12941294 );
12951295 st.pCurItem ->appendElement (pItem);
12961296 } else if (st.pCurItem ->getParent () != nullptr && (st.pCurItem ->getParent ()->isArray () || st.pCurItem ->getParent ()->isMap ())) {
12971297 WsjcppYamlItem *pItem = new WsjcppYamlItem (
12981298 st.pCurItem ->getParent (), st.placeInFile ,
1299- WsjcppYamlItemType::WSJCPP_YAML_ITEM_EMPTY
1299+ WSJCPP_YAML_NODE_EMPTY
13001300 );
13011301 st.pCurItem ->getParent ()->appendElement (pItem);
13021302 } else {
@@ -1362,7 +1362,7 @@ void WsjcppYaml::process_sameIntent_hasName_emptyValue_arrayItem(WsjcppYamlParse
13621362void WsjcppYaml::process_sameIntent_hasName_emptyValue_noArrayItem (WsjcppYamlParserStatus &st) {
13631363 WsjcppYamlItem *pItem = new WsjcppYamlItem (
13641364 st.pCurItem , st.placeInFile ,
1365- WsjcppYamlItemType::WSJCPP_YAML_ITEM_UNDEFINED
1365+ WSJCPP_YAML_NODE_UNDEFINED
13661366 );
13671367 if (st.line .getValueQuotes () != WSJCPP_YAML_QUOTES_NONE) {
13681368 pItem->doValue ();
@@ -1383,15 +1383,15 @@ void WsjcppYaml::process_sameIntent_hasName_hasValue_arrayItem(WsjcppYamlParserS
13831383 }
13841384 WsjcppYamlItem *pMapItem = new WsjcppYamlItem (
13851385 st.pCurItem , st.placeInFile ,
1386- WsjcppYamlItemType::WSJCPP_YAML_ITEM_MAP
1386+ WSJCPP_YAML_NODE_MAP
13871387 );
13881388 st.pCurItem ->appendElement (pMapItem);
13891389 st.pCurItem = pMapItem;
13901390 st.nIntent = st.nIntent + 2 ;
13911391
13921392 WsjcppYamlItem *pItem = new WsjcppYamlItem (
13931393 st.pCurItem , st.placeInFile ,
1394- WsjcppYamlItemType::WSJCPP_YAML_ITEM_VALUE
1394+ WSJCPP_YAML_NODE_VALUE
13951395 );
13961396 pItem->setComment (st.line .getComment ());
13971397 pItem->setValue (st.line .getValue (), st.line .getValueQuotes ());
@@ -1406,7 +1406,7 @@ void WsjcppYaml::process_sameIntent_hasName_hasValue_arrayItem(WsjcppYamlParserS
14061406void WsjcppYaml::process_sameIntent_hasName_hasValue_noArrayItem (WsjcppYamlParserStatus &st) {
14071407 WsjcppYamlItem *pItem = new WsjcppYamlItem (
14081408 st.pCurItem , st.placeInFile ,
1409- WsjcppYamlItemType::WSJCPP_YAML_ITEM_VALUE
1409+ WSJCPP_YAML_NODE_VALUE
14101410 );
14111411 pItem->setComment (st.line .getComment ());
14121412 pItem->setValue (st.line .getValue (), st.line .getValueQuotes ());
@@ -1424,7 +1424,7 @@ void WsjcppYaml::process_sameIntent_emptyName_hasValue_arrayItem(WsjcppYamlParse
14241424 }
14251425 WsjcppYamlItem *pItem = new WsjcppYamlItem (
14261426 st.pCurItem , st.placeInFile ,
1427- WsjcppYamlItemType::WSJCPP_YAML_ITEM_VALUE
1427+ WSJCPP_YAML_NODE_VALUE
14281428 );
14291429 pItem->setComment (st.line .getComment ());
14301430 pItem->setValue (st.line .getValue (), st.line .getValueQuotes ());
@@ -1447,7 +1447,7 @@ void WsjcppYaml::process_sameIntent_emptyName_emptyValue_arrayItem(WsjcppYamlPar
14471447 }
14481448 WsjcppYamlItem *pItem = new WsjcppYamlItem (
14491449 st.pCurItem , st.placeInFile ,
1450- WsjcppYamlItemType::WSJCPP_YAML_ITEM_VALUE
1450+ WSJCPP_YAML_NODE_VALUE
14511451 );
14521452 pItem->setComment (st.line .getComment ());
14531453 pItem->setValue (st.line .getValue (), st.line .getValueQuotes ());
@@ -1461,7 +1461,7 @@ void WsjcppYaml::process_sameIntent_emptyName_emptyValue_arrayItem(WsjcppYamlPar
14611461void WsjcppYaml::process_sameIntent_emptyName_emptyValue_noArrayItem (WsjcppYamlParserStatus &st) {
14621462 WsjcppYamlItem *pItem = new WsjcppYamlItem (
14631463 st.pCurItem , st.placeInFile ,
1464- WsjcppYamlItemType::WSJCPP_YAML_ITEM_EMPTY
1464+ WSJCPP_YAML_NODE_EMPTY
14651465 );
14661466 pItem->setComment (st.line .getComment ());
14671467 st.pCurItem ->appendElement (pItem);
0 commit comments