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
190a5567
Commit
190a5567
authored
Sep 09, 2011
by
Jesse Beder
Browse files
Switched iterators to typedef's, with a bit of finagling so we can forward-declare them
parent
9aa3eb56
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
47 deletions
+51
-47
include/yaml-cpp/value/detail/iterator.h
include/yaml-cpp/value/detail/iterator.h
+0
-22
include/yaml-cpp/value/detail/iterator_fwd.h
include/yaml-cpp/value/detail/iterator_fwd.h
+38
-0
include/yaml-cpp/value/iterator.h
include/yaml-cpp/value/iterator.h
+12
-22
include/yaml-cpp/value/value.h
include/yaml-cpp/value/value.h
+1
-3
No files found.
include/yaml-cpp/value/detail/iterator.h
View file @
190a5567
...
...
@@ -8,25 +8,13 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/value/ptr.h"
#include "yaml-cpp/value/value.h"
#include <boost/iterator/iterator_facade.hpp>
#include <boost/utility/enable_if.hpp>
#include <list>
#include <utility>
#include <vector>
namespace
YAML
{
namespace
detail
{
class
node
;
struct
iterator_value
:
public
Value
,
std
::
pair
<
Value
,
Value
>
{
iterator_value
()
{}
explicit
iterator_value
(
const
Value
&
rhs
)
:
Value
(
rhs
)
{}
explicit
iterator_value
(
const
Value
&
key
,
const
Value
&
value
)
:
std
::
pair
<
Value
,
Value
>
(
key
,
value
)
{}
};
struct
iterator_type
{
enum
value
{
None
,
Sequence
,
Map
};
};
template
<
typename
V
,
typename
SeqIter
,
typename
MapIter
>
...
...
@@ -94,16 +82,6 @@ namespace YAML
SeqIter
m_seqIt
;
MapIter
m_mapIt
;
};
typedef
std
::
vector
<
node
*>
node_seq
;
typedef
std
::
pair
<
node
*
,
node
*>
kv_pair
;
typedef
std
::
list
<
kv_pair
>
node_map
;
typedef
node_seq
::
iterator
node_seq_iterator
;
typedef
node_seq
::
const_iterator
node_seq_const_iterator
;
typedef
node_map
::
iterator
node_map_iterator
;
typedef
node_map
::
const_iterator
node_map_const_iterator
;
}
}
...
...
include/yaml-cpp/value/detail/iterator_fwd.h
0 → 100644
View file @
190a5567
#ifndef VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define VALUE_DETAIL_ITERATOR_FWD_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/dll.h"
#include <list>
#include <utility>
#include <vector>
namespace
YAML
{
class
node
;
namespace
detail
{
struct
iterator_value
;
typedef
std
::
vector
<
node
*>
node_seq
;
typedef
std
::
pair
<
node
*
,
node
*>
kv_pair
;
typedef
std
::
list
<
kv_pair
>
node_map
;
typedef
node_seq
::
iterator
node_seq_iterator
;
typedef
node_seq
::
const_iterator
node_seq_const_iterator
;
typedef
node_map
::
iterator
node_map_iterator
;
typedef
node_map
::
const_iterator
node_map_const_iterator
;
template
<
typename
V
,
typename
SeqIter
,
typename
MapIter
>
class
iterator_base
;
}
typedef
detail
::
iterator_base
<
detail
::
iterator_value
,
detail
::
node_seq_iterator
,
detail
::
node_map_iterator
>
iterator
;
typedef
detail
::
iterator_base
<
const
detail
::
iterator_value
,
detail
::
node_seq_const_iterator
,
detail
::
node_map_const_iterator
>
const_iterator
;
}
#endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
include/yaml-cpp/value/iterator.h
View file @
190a5567
...
...
@@ -7,32 +7,22 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/value/value.h"
#include "yaml-cpp/value/detail/iterator_fwd.h"
#include "yaml-cpp/value/detail/iterator.h"
#include <list>
#include <utility>
#include <vector>
namespace
YAML
{
class
iterator
:
public
detail
::
iterator_base
<
detail
::
iterator_value
,
detail
::
node_seq_iterator
,
detail
::
node_map_iterator
>
{
private:
typedef
detail
::
iterator_base
<
detail
::
iterator_value
,
detail
::
node_seq_iterator
,
detail
::
node_map_iterator
>
base
;
public:
iterator
()
{}
explicit
iterator
(
detail
::
shared_memory_holder
pMemory
,
detail
::
node_seq_iterator
seqIt
)
:
base
(
pMemory
,
seqIt
)
{}
explicit
iterator
(
detail
::
shared_memory_holder
pMemory
,
detail
::
node_map_iterator
mapIt
)
:
base
(
pMemory
,
mapIt
)
{}
};
class
const_iterator
:
public
detail
::
iterator_base
<
const
detail
::
iterator_value
,
detail
::
node_seq_const_iterator
,
detail
::
node_map_const_iterator
>
{
private:
typedef
detail
::
iterator_base
<
const
detail
::
iterator_value
,
detail
::
node_seq_const_iterator
,
detail
::
node_map_const_iterator
>
base
;
public:
const_iterator
()
{}
explicit
const_iterator
(
detail
::
shared_memory_holder
pMemory
,
detail
::
node_seq_const_iterator
seqIt
)
:
base
(
pMemory
,
seqIt
)
{}
explicit
const_iterator
(
detail
::
shared_memory_holder
pMemory
,
detail
::
node_map_const_iterator
mapIt
)
:
base
(
pMemory
,
mapIt
)
{}
explicit
const_iterator
(
const
iterator
&
rhs
)
:
base
(
rhs
)
{}
};
namespace
detail
{
struct
iterator_value
:
public
Value
,
std
::
pair
<
Value
,
Value
>
{
iterator_value
()
{}
explicit
iterator_value
(
const
Value
&
rhs
)
:
Value
(
rhs
)
{}
explicit
iterator_value
(
const
Value
&
key
,
const
Value
&
value
)
:
std
::
pair
<
Value
,
Value
>
(
key
,
value
)
{}
};
}
}
#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
include/yaml-cpp/value/value.h
View file @
190a5567
...
...
@@ -9,13 +9,11 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/value/ptr.h"
#include "yaml-cpp/value/type.h"
#include "yaml-cpp/value/detail/iterator_fwd.h"
#include <stdexcept>
namespace
YAML
{
class
iterator
;
class
const_iterator
;
class
Value
{
public:
...
...
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