Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
0987b234
Commit
0987b234
authored
Sep 13, 2011
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tags to Node
parent
2dfccbb9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
7 deletions
+35
-7
include/yaml-cpp/node/convert.h
+2
-2
include/yaml-cpp/node/detail/node.h
+5
-0
include/yaml-cpp/node/detail/node_data.h
+3
-0
include/yaml-cpp/node/detail/node_ref.h
+2
-0
include/yaml-cpp/node/impl.h
+13
-2
include/yaml-cpp/node/node.h
+5
-3
src/node/detail/node_data.cpp
+5
-0
No files found.
include/yaml-cpp/node/convert.h
View file @
0987b234
...
...
@@ -26,7 +26,7 @@ namespace YAML
static
bool
decode
(
const
Node
&
node
,
std
::
string
&
rhs
)
{
if
(
node
.
Type
()
!=
NodeType
::
Scalar
)
return
false
;
rhs
=
node
.
s
calar
();
rhs
=
node
.
S
calar
();
return
true
;
}
};
...
...
@@ -54,7 +54,7 @@ namespace YAML
static bool decode(const Node& node, type& rhs) {\
if(node.Type() != NodeType::Scalar)\
return false;\
std::stringstream stream(node.
s
calar());\
std::stringstream stream(node.
S
calar());\
stream >> rhs;\
return !!stream;\
}\
...
...
include/yaml-cpp/node/detail/node.h
View file @
0987b234
...
...
@@ -29,6 +29,7 @@ namespace YAML
NodeType
::
value
type
()
const
{
return
m_pRef
->
type
();
}
const
std
::
string
&
scalar
()
const
{
return
m_pRef
->
scalar
();
}
const
std
::
string
&
tag
()
const
{
return
m_pRef
->
tag
();
}
void
mark_defined
()
{
if
(
is_defined
())
...
...
@@ -71,6 +72,10 @@ namespace YAML
mark_defined
();
m_pRef
->
set_scalar
(
scalar
);
}
void
set_tag
(
const
std
::
string
&
tag
)
{
mark_defined
();
m_pRef
->
set_tag
(
tag
);
}
// size/iterator
std
::
size_t
size
()
const
{
return
m_pRef
->
size
();
}
...
...
include/yaml-cpp/node/detail/node_data.h
View file @
0987b234
...
...
@@ -26,12 +26,14 @@ namespace YAML
void
mark_defined
();
void
set_type
(
NodeType
::
value
type
);
void
set_tag
(
const
std
::
string
&
tag
);
void
set_null
();
void
set_scalar
(
const
std
::
string
&
scalar
);
bool
is_defined
()
const
{
return
m_isDefined
;
}
NodeType
::
value
type
()
const
{
return
m_isDefined
?
m_type
:
NodeType
::
Undefined
;
}
const
std
::
string
&
scalar
()
const
{
return
m_scalar
;
}
const
std
::
string
&
tag
()
const
{
return
m_tag
;
}
// size/iterator
std
::
size_t
size
()
const
;
...
...
@@ -78,6 +80,7 @@ namespace YAML
private
:
bool
m_isDefined
;
NodeType
::
value
m_type
;
std
::
string
m_tag
;
// scalar
std
::
string
m_scalar
;
...
...
include/yaml-cpp/node/detail/node_ref.h
View file @
0987b234
...
...
@@ -24,11 +24,13 @@ namespace YAML
bool
is_defined
()
const
{
return
m_pData
->
is_defined
();
}
NodeType
::
value
type
()
const
{
return
m_pData
->
type
();
}
const
std
::
string
&
scalar
()
const
{
return
m_pData
->
scalar
();
}
const
std
::
string
&
tag
()
const
{
return
m_pData
->
tag
();
}
void
mark_defined
()
{
m_pData
->
mark_defined
();
}
void
set_data
(
const
node_ref
&
rhs
)
{
m_pData
=
rhs
.
m_pData
;
}
void
set_type
(
NodeType
::
value
type
)
{
m_pData
->
set_type
(
type
);
}
void
set_tag
(
const
std
::
string
&
tag
)
{
m_pData
->
set_tag
(
tag
);
}
void
set_null
()
{
m_pData
->
set_null
();
}
void
set_scalar
(
const
std
::
string
&
scalar
)
{
m_pData
->
set_scalar
(
scalar
);
}
...
...
include/yaml-cpp/node/impl.h
View file @
0987b234
...
...
@@ -73,14 +73,25 @@ namespace YAML
{
if
(
Type
()
!=
NodeType
::
Scalar
)
throw
std
::
runtime_error
(
"Unable to convert to string, not a scalar"
);
return
s
calar
();
return
S
calar
();
}
inline
const
std
::
string
&
Node
::
s
calar
()
const
inline
const
std
::
string
&
Node
::
S
calar
()
const
{
return
m_pNode
?
m_pNode
->
scalar
()
:
detail
::
node_data
::
empty_scalar
;
}
inline
const
std
::
string
&
Node
::
Tag
()
const
{
return
m_pNode
?
m_pNode
->
tag
()
:
detail
::
node_data
::
empty_scalar
;
}
inline
void
Node
::
SetTag
(
const
std
::
string
&
tag
)
{
EnsureNodeExists
();
m_pNode
->
set_tag
(
tag
);
}
// assignment
inline
bool
Node
::
is
(
const
Node
&
rhs
)
const
{
...
...
include/yaml-cpp/node/node.h
View file @
0987b234
...
...
@@ -32,13 +32,15 @@ namespace YAML
// access
template
<
typename
T
>
const
T
as
()
const
;
const
std
::
string
&
scalar
()
const
;
const
std
::
string
&
Scalar
()
const
;
const
std
::
string
&
Tag
()
const
;
void
SetTag
(
const
std
::
string
&
tag
);
// assignment
bool
is
(
const
Node
&
rhs
)
const
;
template
<
typename
T
>
Node
&
operator
=
(
const
T
&
rhs
);
Node
&
operator
=
(
const
Node
&
rhs
);
// size/iterator
std
::
size_t
size
()
const
;
...
...
src/node/detail/node_data.cpp
View file @
0987b234
...
...
@@ -54,6 +54,11 @@ namespace YAML
}
}
void
node_data
::
set_tag
(
const
std
::
string
&
tag
)
{
m_tag
=
tag
;
}
void
node_data
::
set_null
()
{
m_isDefined
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment