Skip to content

Commit 7ee46b9

Browse files
committed
Fixed #23 Added new method WsjcppYamlCursor::node()
1 parent a45f212 commit 7ee46b9

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/wsjcpp_yaml.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,12 @@ WsjcppYamlCursor &WsjcppYamlCursor::val(bool bValue) {
11911191

11921192
// ---------------------------------------------------------------------
11931193

1194+
WsjcppYamlNode *WsjcppYamlCursor::node() {
1195+
return m_pCurrentNode;
1196+
}
1197+
1198+
// ---------------------------------------------------------------------
1199+
11941200
WsjcppYamlCursor WsjcppYamlCursor::operator[](int idx) const {
11951201
if (m_pCurrentNode != nullptr && m_pCurrentNode->isArray() && idx < m_pCurrentNode->getLength() && idx >= 0) {
11961202
return WsjcppYamlCursor(m_pCurrentNode->getElement(idx));

src/wsjcpp_yaml.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ class WsjcppYamlCursor {
235235
bool valBool();
236236
WsjcppYamlCursor &val(bool bValue);
237237

238+
// node
239+
WsjcppYamlNode *node();
238240

239241
WsjcppYamlCursor operator[](int idx) const;
240242
WsjcppYamlCursor operator[](const std::string &sName) const;

unit-tests.wsjcpp/src/unit_test_cursor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ void UnitTestCursor::executeTest() {
133133

134134
// bool
135135
compare("array bool el 4", yaml["arr1"][4].valStr(), "true");
136+
compare("array bool el 4", yaml["arr1"][4].node()->getValue(), "true");
136137
compare("array bool el 4", yaml["arr1"][4].valBool(), true);
137138
yaml["arr1"][4].val(true);
138139
compare("array bool el 4", yaml["arr1"][4].valStr(), "yes");

0 commit comments

Comments
 (0)