Skip to content

Commit 3530ce1

Browse files
committed
Added WsjcppYamlItem::appendElementValue and updated wsjcpp-core
1 parent e2b80ab commit 3530ce1

15 files changed

+30
-19
lines changed

src.wsjcpp/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Automaticly generated by wsjcpp@v0.0.1
22
cmake_minimum_required(VERSION 3.0)
33

4-
add_definitions(-DWSJCPP_VERSION="v0.0.3")
4+
add_definitions(-DWSJCPP_VERSION="v0.1.0")
55
add_definitions(-DWSJCPP_NAME="wsjcpp-yaml")
66

77
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -17,7 +17,7 @@ set (WSJCPP_SOURCES "")
1717
find_package(Threads REQUIRED)
1818
list (APPEND WSJCPP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
1919

20-
# wsjcpp-core:v0.1.0
20+
# wsjcpp-core:v0.1.1
2121
list (APPEND WSJCPP_INCLUDE_DIRS "./src.wsjcpp/wsjcpp_core/")
2222
list (APPEND WSJCPP_SOURCES "./src.wsjcpp/wsjcpp_core/wsjcpp_core.cpp")
2323
list (APPEND WSJCPP_SOURCES "./src.wsjcpp/wsjcpp_core/wsjcpp_core.h")

src.wsjcpp/wsjcpp_core/wsjcpp.hold.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_cxx_standard: 11
33
cmake_minimum_required: 3.0
44

55
name: wsjcpp-core
6-
version: v0.1.0
6+
version: v0.1.1
77
description: Basic Utils for wsjcpp
88
issues: https://github.com/wsjcpp/wsjcpp-core/issues
99
repositories:

src.wsjcpp/wsjcpp_core/wsjcpp_unit_tests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class WsjcppUnitTests {
3232
};
3333

3434
// RegistryCmdHandler
35-
#define REGISTRY_UNIT_TEST( classname ) \
35+
#define REGISTRY_WSJCPP_UNIT_TEST( classname ) \
3636
static classname * pRegistryWsjcppUnitTest ## classname = new classname(); \
3737

3838

src/wsjcpp_yaml.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,18 @@ bool WsjcppYamlItem::appendElement(WsjcppYamlItem *pItem) {
398398

399399
// ---------------------------------------------------------------------
400400

401+
bool WsjcppYamlItem::appendElementValue(const std::string &sValue, bool bHasValueQuotes) {
402+
if (m_nItemType != WSJCPP_YAML_ITEM_ARRAY) {
403+
WsjcppLog::throw_err(TAG, "appendElementValue, Element must be array for " + this->getForLogFormat());
404+
}
405+
WsjcppYamlPlaceInFile pl;
406+
WsjcppYamlItem *pNewItem = new WsjcppYamlItem(this, pl, WsjcppYamlItemType::WSJCPP_YAML_ITEM_VALUE);
407+
pNewItem->setValue(sValue, bHasValueQuotes);
408+
return this->appendElement(pNewItem);
409+
}
410+
411+
// ---------------------------------------------------------------------
412+
401413
bool WsjcppYamlItem::removeElement(int i) {
402414
if (m_nItemType != WSJCPP_YAML_ITEM_ARRAY) {
403415
WsjcppLog::throw_err(TAG, "appendElement, Element must be array for " + this->getForLogFormat());

src/wsjcpp_yaml.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class WsjcppYamlItem { // TODO: rename to node
9393
int getLength();
9494
WsjcppYamlItem *getElement(int i);
9595
bool appendElement(WsjcppYamlItem *pItem);
96+
bool appendElementValue(const std::string &sValue, bool bHasValueQuotes);
9697
bool removeElement(int i);
9798

9899
bool isValue();

unit-tests.wsjcpp/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
cmake_minimum_required(VERSION 3.0)
33

44
project(unit-tests C CXX)
5-
add_definitions(-DWSJCPP_VERSION="ut-v0.0.3")
5+
add_definitions(-DWSJCPP_VERSION="ut-v0.1.0")
66
add_definitions(-DWSJCPP_NAME="unit-tests-wsjcpp-yaml")
77

88
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -19,15 +19,15 @@ set (WSJCPP_SOURCES "")
1919
find_package(Threads REQUIRED)
2020
list (APPEND WSJCPP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
2121

22-
# wsjcpp-core:v0.1.0
22+
# wsjcpp-core:v0.1.1
2323
list (APPEND WSJCPP_INCLUDE_DIRS "../src.wsjcpp/wsjcpp_core/")
2424
list (APPEND WSJCPP_SOURCES "../src.wsjcpp/wsjcpp_core/wsjcpp_core.cpp")
2525
list (APPEND WSJCPP_SOURCES "../src.wsjcpp/wsjcpp_core/wsjcpp_core.h")
2626
list (APPEND WSJCPP_SOURCES "../src.wsjcpp/wsjcpp_core/wsjcpp_unit_tests.cpp")
2727
list (APPEND WSJCPP_SOURCES "../src.wsjcpp/wsjcpp_core/wsjcpp_unit_tests.h")
2828
list (APPEND WSJCPP_SOURCES "../src.wsjcpp/wsjcpp_core/wsjcpp_unit_tests_main.cpp")
2929

30-
# wsjcpp-yaml:v0.0.3
30+
# wsjcpp-yaml:v0.1.0
3131
list (APPEND WSJCPP_INCLUDE_DIRS "../src")
3232
list (APPEND WSJCPP_SOURCES "../src/wsjcpp_yaml.cpp")
3333
list (APPEND WSJCPP_SOURCES "../src/wsjcpp_yaml.h")

unit-tests.wsjcpp/src/unit_test_line_parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <iostream>
44
#include <wsjcpp_yaml.h>
55

6-
REGISTRY_UNIT_TEST(UnitTestLineParser)
6+
REGISTRY_WSJCPP_UNIT_TEST(UnitTestLineParser)
77

88
UnitTestLineParser::UnitTestLineParser()
99
: WsjcppUnitTestBase("UnitTestLineParser") {

unit-tests.wsjcpp/src/unit_test_yaml_parser_all.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <wsjcpp_core.h>
55
#include <wsjcpp_yaml.h>
66

7-
REGISTRY_UNIT_TEST(UnitTestYamlParserAll)
7+
REGISTRY_WSJCPP_UNIT_TEST(UnitTestYamlParserAll)
88

99
UnitTestYamlParserAll::UnitTestYamlParserAll()
1010
: WsjcppUnitTestBase("UnitTestYamlParserAll") {

unit-tests.wsjcpp/src/unit_test_yaml_parser_array_included_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <iostream>
44
#include <wsjcpp_yaml.h>
55

6-
REGISTRY_UNIT_TEST(UnitTestYamlParserArrayIncludedMap)
6+
REGISTRY_WSJCPP_UNIT_TEST(UnitTestYamlParserArrayIncludedMap)
77

88
UnitTestYamlParserArrayIncludedMap::UnitTestYamlParserArrayIncludedMap()
99
: WsjcppUnitTestBase("UnitTestYamlParserArrayIncludedMap") {

unit-tests.wsjcpp/src/unit_test_yaml_parser_comments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <iostream>
44
#include <wsjcpp_yaml.h>
55

6-
REGISTRY_UNIT_TEST(UnitTestYamlParserComments)
6+
REGISTRY_WSJCPP_UNIT_TEST(UnitTestYamlParserComments)
77

88
UnitTestYamlParserComments::UnitTestYamlParserComments()
99
: WsjcppUnitTestBase("UnitTestYamlParserComments") {

0 commit comments

Comments
 (0)