Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
4aa61944
Commit
4aa61944
authored
Sep 07, 2011
by
Jesse Beder
Browse files
Implemented is()
parent
e2255092
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
include/yaml-cpp/value/detail/node.h
include/yaml-cpp/value/detail/node.h
+2
-0
include/yaml-cpp/value/impl.h
include/yaml-cpp/value/impl.h
+7
-2
include/yaml-cpp/value/value.h
include/yaml-cpp/value/value.h
+1
-0
No files found.
include/yaml-cpp/value/detail/node.h
View file @
4aa61944
...
@@ -21,6 +21,8 @@ namespace YAML
...
@@ -21,6 +21,8 @@ namespace YAML
node
()
:
m_pRef
(
new
node_ref
)
{}
node
()
:
m_pRef
(
new
node_ref
)
{}
ValueType
::
value
type
()
const
{
return
m_pRef
->
type
();
}
ValueType
::
value
type
()
const
{
return
m_pRef
->
type
();
}
bool
is
(
const
node
&
rhs
)
const
{
return
m_pRef
==
rhs
.
m_pRef
;
}
void
set_ref
(
const
node
&
rhs
)
{
m_pRef
=
rhs
.
m_pRef
;
}
void
set_ref
(
const
node
&
rhs
)
{
m_pRef
=
rhs
.
m_pRef
;
}
void
set_data
(
const
node
&
rhs
)
{
m_pRef
->
set_data
(
*
rhs
.
m_pRef
);
}
void
set_data
(
const
node
&
rhs
)
{
m_pRef
->
set_data
(
*
rhs
.
m_pRef
);
}
...
...
include/yaml-cpp/value/impl.h
View file @
4aa61944
...
@@ -57,6 +57,11 @@ namespace YAML
...
@@ -57,6 +57,11 @@ namespace YAML
}
}
// assignment
// assignment
inline
bool
Value
::
is
(
const
Value
&
rhs
)
const
{
return
m_pNode
->
is
(
*
rhs
.
m_pNode
);
}
template
<
typename
T
>
template
<
typename
T
>
inline
Value
&
Value
::
operator
=
(
const
T
&
rhs
)
inline
Value
&
Value
::
operator
=
(
const
T
&
rhs
)
{
{
...
@@ -88,7 +93,7 @@ namespace YAML
...
@@ -88,7 +93,7 @@ namespace YAML
inline
Value
&
Value
::
operator
=
(
const
Value
&
rhs
)
inline
Value
&
Value
::
operator
=
(
const
Value
&
rhs
)
{
{
if
(
is
(
*
this
,
rhs
))
if
(
is
(
rhs
))
return
*
this
;
return
*
this
;
AssignNode
(
rhs
);
AssignNode
(
rhs
);
return
*
this
;
return
*
this
;
...
@@ -213,7 +218,7 @@ namespace YAML
...
@@ -213,7 +218,7 @@ namespace YAML
inline
bool
is
(
const
Value
&
lhs
,
const
Value
&
rhs
)
inline
bool
is
(
const
Value
&
lhs
,
const
Value
&
rhs
)
{
{
return
false
;
return
lhs
.
is
(
rhs
)
;
}
}
}
}
...
...
include/yaml-cpp/value/value.h
View file @
4aa61944
...
@@ -31,6 +31,7 @@ namespace YAML
...
@@ -31,6 +31,7 @@ namespace YAML
template
<
typename
T
>
const
T
as
()
const
;
template
<
typename
T
>
const
T
as
()
const
;
// assignment
// assignment
bool
is
(
const
Value
&
rhs
)
const
;
template
<
typename
T
>
Value
&
operator
=
(
const
T
&
rhs
);
template
<
typename
T
>
Value
&
operator
=
(
const
T
&
rhs
);
Value
&
operator
=
(
const
Value
&
rhs
);
Value
&
operator
=
(
const
Value
&
rhs
);
...
...
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