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
f0174ca0
Commit
f0174ca0
authored
Sep 07, 2011
by
Jesse Beder
Browse files
Reorganized so that we don't have cyclic include problems
parent
fed95c5d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
105 additions
and
47 deletions
+105
-47
include/yaml-cpp/value.h
include/yaml-cpp/value.h
+13
-0
include/yaml-cpp/value/detail/impl.h
include/yaml-cpp/value/detail/impl.h
+43
-0
include/yaml-cpp/value/detail/memory.h
include/yaml-cpp/value/detail/memory.h
+10
-43
include/yaml-cpp/value/detail/node.h
include/yaml-cpp/value/detail/node.h
+7
-0
include/yaml-cpp/value/detail/node_data.h
include/yaml-cpp/value/detail/node_data.h
+1
-1
include/yaml-cpp/value/detail/nodedata.h
include/yaml-cpp/value/detail/nodedata.h
+0
-0
include/yaml-cpp/value/impl.h
include/yaml-cpp/value/impl.h
+1
-0
include/yaml-cpp/value/value.h
include/yaml-cpp/value/value.h
+0
-2
src/value/detail/memory.cpp
src/value/detail/memory.cpp
+29
-0
util/value.cpp
util/value.cpp
+1
-1
No files found.
include/yaml-cpp/value.h
0 → 100644
View file @
f0174ca0
#ifndef VALUE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define VALUE_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/value/value.h"
#include "yaml-cpp/value/impl.h"
#include "yaml-cpp/value/detail/impl.h"
#endif // VALUE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
include/yaml-cpp/value/detail/impl.h
0 → 100644
View file @
f0174ca0
#ifndef VALUE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define VALUE_DETAIL_IMPL_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/value/detail/node.h"
#include "yaml-cpp/value/detail/node_data.h"
namespace
YAML
{
namespace
detail
{
// indexing
template
<
typename
Key
>
inline
shared_node
node_data
::
operator
[](
const
Key
&
key
)
const
{
if
(
m_type
!=
ValueType
::
Map
)
return
shared_node
(
new
node
);
for
(
node_map
::
const_iterator
it
=
m_map
.
begin
();
it
!=
m_map
.
end
();
++
it
)
{
if
(
it
->
first
->
equals
(
key
))
return
it
->
second
;
}
return
shared_node
(
new
node
);
}
template
<
typename
Key
>
inline
shared_node
node_data
::
operator
[](
const
Key
&
key
)
{
}
template
<
typename
Key
>
inline
bool
node_data
::
remove
(
const
Key
&
key
)
{
}
}
}
#endif // VALUE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
include/yaml-cpp/value/detail/memory.h
View file @
f0174ca0
...
...
@@ -6,7 +6,6 @@
#endif
#include "yaml-cpp/value/ptr.h"
#include "yaml-cpp/value/detail/node.h"
#include <set>
#include <boost/shared_ptr.hpp>
...
...
@@ -14,19 +13,6 @@ namespace YAML
{
namespace
detail
{
class
memory
;
class
memory_holder
{
public:
memory_holder
();
shared_node
create_node
();
void
merge
(
memory_holder
&
rhs
);
private:
boost
::
shared_ptr
<
memory
>
m_pMemory
;
};
class
memory
{
public:
shared_node
create_node
();
...
...
@@ -37,35 +23,16 @@ namespace YAML
Nodes
m_nodes
;
};
inline
memory_holder
::
memory_holder
()
:
m_pMemory
(
new
memory
)
{
}
inline
shared_node
memory_holder
::
create_node
()
{
return
m_pMemory
->
create_node
();
}
inline
void
memory_holder
::
merge
(
memory_holder
&
rhs
)
{
if
(
m_pMemory
==
rhs
.
m_pMemory
)
return
;
m_pMemory
->
merge
(
*
rhs
.
m_pMemory
);
rhs
.
m_pMemory
=
m_pMemory
;
}
class
memory_holder
{
public:
memory_holder
()
:
m_pMemory
(
new
memory
)
{}
shared_node
memory
::
create_node
()
{
shared_node
pNode
(
new
node
);
m_nodes
.
insert
(
pNode
);
return
pNode
;
}
shared_node
create_node
()
{
return
m_pMemory
->
create_node
();
}
void
merge
(
memory_holder
&
rhs
);
inline
void
memory
::
merge
(
const
memory
&
rhs
)
{
m_nodes
.
insert
(
rhs
.
m_nodes
.
begin
(),
rhs
.
m_nodes
.
end
());
}
private:
boost
::
shared_ptr
<
memory
>
m_pMemory
;
};
}
}
...
...
include/yaml-cpp/value/detail/node.h
View file @
f0174ca0
...
...
@@ -28,6 +28,8 @@ namespace YAML
void
set_null
()
{
m_pData
->
set_null
();
}
void
set_scalar
(
const
std
::
string
&
scalar
)
{
m_pData
->
set_scalar
(
scalar
);
}
template
<
typename
T
>
bool
equals
(
const
T
&
rhs
)
const
;
// indexing
template
<
typename
Key
>
shared_node
operator
[](
const
Key
&
key
)
const
{
return
(
static_cast
<
const
node_data
&>
(
*
m_pData
))[
key
];
}
template
<
typename
Key
>
shared_node
operator
[](
const
Key
&
key
)
{
return
(
*
m_pData
)[
key
];
}
...
...
@@ -40,6 +42,11 @@ namespace YAML
private:
shared_node_data
m_pData
;
};
template
<
typename
T
>
inline
bool
node
::
equals
(
const
T
&
rhs
)
const
{
}
}
}
...
...
include/yaml-cpp/value/detail/node_data.h
View file @
f0174ca0
...
...
@@ -7,8 +7,8 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/value/type.h"
#include "yaml-cpp/value/ptr.h"
#include "yaml-cpp/value/type.h"
#include <list>
#include <utility>
#include <vector>
...
...
include/yaml-cpp/value/detail/nodedata.h
deleted
100644 → 0
View file @
fed95c5d
include/yaml-cpp/value/impl.h
View file @
f0174ca0
...
...
@@ -8,6 +8,7 @@
#include "yaml-cpp/value/value.h"
#include "yaml-cpp/value/detail/memory.h"
#include "yaml-cpp/value/detail/node.h"
#include <string>
namespace
YAML
...
...
include/yaml-cpp/value/value.h
View file @
f0174ca0
...
...
@@ -85,6 +85,4 @@ namespace YAML
bool
convert
(
const
Value
&
value
,
T
&
rhs
);
}
#include "yaml-cpp/value/impl.h"
#endif // VALUE_VALUE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
src/value/detail/memory.cpp
0 → 100644
View file @
f0174ca0
#include "yaml-cpp/value/detail/memory.h"
#include "yaml-cpp/value/detail/node.h"
namespace
YAML
{
namespace
detail
{
void
memory_holder
::
merge
(
memory_holder
&
rhs
)
{
if
(
m_pMemory
==
rhs
.
m_pMemory
)
return
;
m_pMemory
->
merge
(
*
rhs
.
m_pMemory
);
rhs
.
m_pMemory
=
m_pMemory
;
}
shared_node
memory
::
create_node
()
{
shared_node
pNode
(
new
node
);
m_nodes
.
insert
(
pNode
);
return
pNode
;
}
void
memory
::
merge
(
const
memory
&
rhs
)
{
m_nodes
.
insert
(
rhs
.
m_nodes
.
begin
(),
rhs
.
m_nodes
.
end
());
}
}
}
util/value.cpp
View file @
f0174ca0
#include "yaml-cpp/value
/value
.h"
#include "yaml-cpp/value.h"
int
main
()
{
...
...
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