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
f5a9d4c8
Commit
f5a9d4c8
authored
Sep 10, 2011
by
Jesse Beder
Browse files
Started emitting events for Values
parent
09beb5c4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
0 deletions
+60
-0
include/yaml-cpp/value/detail/node.h
include/yaml-cpp/value/detail/node.h
+2
-0
include/yaml-cpp/value/value.h
include/yaml-cpp/value/value.h
+1
-0
src/value/valueevents.cpp
src/value/valueevents.cpp
+22
-0
src/value/valueevents.h
src/value/valueevents.h
+35
-0
No files found.
include/yaml-cpp/value/detail/node.h
View file @
f5a9d4c8
...
@@ -22,6 +22,8 @@ namespace YAML
...
@@ -22,6 +22,8 @@ namespace YAML
node
()
:
m_pRef
(
new
node_ref
)
{}
node
()
:
m_pRef
(
new
node_ref
)
{}
bool
is
(
const
node
&
rhs
)
const
{
return
m_pRef
==
rhs
.
m_pRef
;
}
bool
is
(
const
node
&
rhs
)
const
{
return
m_pRef
==
rhs
.
m_pRef
;
}
const
node_ref
*
ref
()
const
{
return
m_pRef
.
get
();
}
ValueType
::
value
type
()
const
{
return
m_pRef
->
type
();
}
ValueType
::
value
type
()
const
{
return
m_pRef
->
type
();
}
const
std
::
string
&
scalar
()
const
{
return
m_pRef
->
scalar
();
}
const
std
::
string
&
scalar
()
const
{
return
m_pRef
->
scalar
();
}
...
...
include/yaml-cpp/value/value.h
View file @
f5a9d4c8
...
@@ -18,6 +18,7 @@ namespace YAML
...
@@ -18,6 +18,7 @@ namespace YAML
{
{
public:
public:
friend
class
ValueBuilder
;
friend
class
ValueBuilder
;
friend
class
ValueEvents
;
friend
class
detail
::
node_data
;
friend
class
detail
::
node_data
;
template
<
typename
,
typename
,
typename
>
friend
class
detail
::
iterator_base
;
template
<
typename
,
typename
,
typename
>
friend
class
detail
::
iterator_base
;
...
...
src/value/valueevents.cpp
0 → 100644
View file @
f5a9d4c8
#include "valueevents.h"
namespace
YAML
{
ValueEvents
::
ValueEvents
(
const
Value
&
value
)
:
m_pMemory
(
value
.
m_pMemory
),
m_root
(
*
value
.
m_pNode
)
{
Visit
(
m_root
);
}
void
Visit
(
detail
::
node
&
node
)
{
int
&
refCount
=
m_refCount
[
node
.
ref
()];
refCount
++
;
if
(
refCount
>
1
)
return
;
if
(
node
.
type
()
==
ValueType
::
Sequence
)
{
}
else
if
(
node
.
type
()
==
ValueType
::
Map
)
{
}
}
}
src/value/valueevents.h
0 → 100644
View file @
f5a9d4c8
#ifndef VALUE_VALUEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define VALUE_VALUEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "yaml-cpp/anchor.h"
#include "yaml-cpp/value/ptr.h"
#include <multiset>
#include <vector>
namespace
YAML
{
class
Value
;
class
ValueEvents
{
public:
ValueEvents
(
const
Value
&
value
);
private:
void
Visit
(
detail
::
node
&
node
);
private:
detail
::
shared_memory_holder
m_pMemory
;
detail
::
node
&
m_root
;
typedef
std
::
map
<
const
detail
::
node_ref
*
,
int
>
RefCount
;
RefCount
m_refCount
;
};
}
#endif // VALUE_VALUEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
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