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
ff1a8fc5
Commit
ff1a8fc5
authored
Sep 09, 2011
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started writing new iterators
parent
7bbf712c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
8 deletions
+87
-8
include/yaml-cpp/value.h
+1
-0
include/yaml-cpp/value/detail/node.h
+10
-0
include/yaml-cpp/value/detail/node_data.h
+11
-0
include/yaml-cpp/value/detail/node_ref.h
+10
-0
include/yaml-cpp/value/impl.h
+6
-5
include/yaml-cpp/value/iterator.h
+3
-2
include/yaml-cpp/value/value.h
+3
-1
src/value/detail/node_data.cpp
+43
-0
No files found.
include/yaml-cpp/value.h
View file @
ff1a8fc5
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include "yaml-cpp/value/value.h"
#include "yaml-cpp/value/value.h"
#include "yaml-cpp/value/impl.h"
#include "yaml-cpp/value/impl.h"
#include "yaml-cpp/value/convert.h"
#include "yaml-cpp/value/convert.h"
#include "yaml-cpp/value/iterator.h"
#include "yaml-cpp/value/detail/impl.h"
#include "yaml-cpp/value/detail/impl.h"
#endif // VALUE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#endif // VALUE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
include/yaml-cpp/value/detail/node.h
View file @
ff1a8fc5
...
@@ -32,7 +32,17 @@ namespace YAML
...
@@ -32,7 +32,17 @@ namespace YAML
void
set_type
(
ValueType
::
value
type
)
{
m_pRef
->
set_type
(
type
);
}
void
set_type
(
ValueType
::
value
type
)
{
m_pRef
->
set_type
(
type
);
}
void
set_null
()
{
m_pRef
->
set_null
();
}
void
set_null
()
{
m_pRef
->
set_null
();
}
void
set_scalar
(
const
std
::
string
&
scalar
)
{
m_pRef
->
set_scalar
(
scalar
);
}
void
set_scalar
(
const
std
::
string
&
scalar
)
{
m_pRef
->
set_scalar
(
scalar
);
}
// size/iterator
std
::
size_t
size
()
const
{
return
m_pRef
->
size
();
}
const_iterator
begin
(
shared_memory_holder
pMemory
)
const
{
return
static_cast
<
const
node_ref
&>
(
*
m_pRef
).
begin
(
pMemory
);
}
iterator
begin
(
shared_memory_holder
pMemory
)
{
return
m_pRef
->
begin
(
pMemory
);
}
const_iterator
end
(
shared_memory_holder
pMemory
)
const
{
return
static_cast
<
const
node_ref
&>
(
*
m_pRef
).
end
(
pMemory
);
}
iterator
end
(
shared_memory_holder
pMemory
)
{
return
m_pRef
->
end
(
pMemory
);
}
// sequence
void
append
(
node
&
node
,
shared_memory_holder
pMemory
)
{
m_pRef
->
append
(
node
,
pMemory
);
}
void
append
(
node
&
node
,
shared_memory_holder
pMemory
)
{
m_pRef
->
append
(
node
,
pMemory
);
}
// indexing
// indexing
...
...
include/yaml-cpp/value/detail/node_data.h
View file @
ff1a8fc5
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/dll.h"
#include "yaml-cpp/value/iterator.h"
#include "yaml-cpp/value/ptr.h"
#include "yaml-cpp/value/ptr.h"
#include "yaml-cpp/value/type.h"
#include "yaml-cpp/value/type.h"
#include <boost/utility.hpp>
#include <boost/utility.hpp>
...
@@ -30,6 +31,16 @@ namespace YAML
...
@@ -30,6 +31,16 @@ namespace YAML
ValueType
::
value
type
()
const
{
return
m_isDefined
?
m_type
:
ValueType
::
Undefined
;
}
ValueType
::
value
type
()
const
{
return
m_isDefined
?
m_type
:
ValueType
::
Undefined
;
}
const
std
::
string
&
scalar
()
const
{
return
m_scalar
;
}
const
std
::
string
&
scalar
()
const
{
return
m_scalar
;
}
// size/iterator
std
::
size_t
size
()
const
;
const_iterator
begin
(
shared_memory_holder
pMemory
)
const
;
iterator
begin
(
shared_memory_holder
pMemory
);
const_iterator
end
(
shared_memory_holder
pMemory
)
const
;
iterator
end
(
shared_memory_holder
pMemory
);
// sequence
void
append
(
node
&
node
,
shared_memory_holder
pMemory
);
void
append
(
node
&
node
,
shared_memory_holder
pMemory
);
// indexing
// indexing
...
...
include/yaml-cpp/value/detail/node_ref.h
View file @
ff1a8fc5
...
@@ -30,6 +30,16 @@ namespace YAML
...
@@ -30,6 +30,16 @@ namespace YAML
void
set_null
()
{
ensure_data_exists
();
m_pData
->
set_null
();
}
void
set_null
()
{
ensure_data_exists
();
m_pData
->
set_null
();
}
void
set_scalar
(
const
std
::
string
&
scalar
)
{
ensure_data_exists
();
m_pData
->
set_scalar
(
scalar
);
}
void
set_scalar
(
const
std
::
string
&
scalar
)
{
ensure_data_exists
();
m_pData
->
set_scalar
(
scalar
);
}
// size/iterator
std
::
size_t
size
()
const
{
return
m_pData
?
m_pData
->
size
()
:
0
;
}
const_iterator
begin
(
shared_memory_holder
pMemory
)
const
{
return
m_pData
?
static_cast
<
const
node_data
&>
(
*
m_pData
).
begin
(
pMemory
)
:
const_iterator
();
}
iterator
begin
(
shared_memory_holder
pMemory
)
{
return
m_pData
?
m_pData
->
begin
(
pMemory
)
:
iterator
();
}
const_iterator
end
(
shared_memory_holder
pMemory
)
const
{
return
m_pData
?
static_cast
<
const
node_data
&>
(
*
m_pData
).
end
(
pMemory
)
:
const_iterator
();
}
iterator
end
(
shared_memory_holder
pMemory
)
{
return
m_pData
?
m_pData
->
end
(
pMemory
)
:
iterator
();
}
// sequence
void
append
(
node
&
node
,
shared_memory_holder
pMemory
)
{
ensure_data_exists
();
m_pData
->
append
(
node
,
pMemory
);
}
void
append
(
node
&
node
,
shared_memory_holder
pMemory
)
{
ensure_data_exists
();
m_pData
->
append
(
node
,
pMemory
);
}
// indexing
// indexing
...
...
include/yaml-cpp/value/impl.h
View file @
ff1a8fc5
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "yaml-cpp/value/value.h"
#include "yaml-cpp/value/value.h"
#include "yaml-cpp/value/iterator.h"
#include "yaml-cpp/value/detail/memory.h"
#include "yaml-cpp/value/detail/memory.h"
#include "yaml-cpp/value/detail/node.h"
#include "yaml-cpp/value/detail/node.h"
#include <string>
#include <string>
...
@@ -127,27 +128,27 @@ namespace YAML
...
@@ -127,27 +128,27 @@ namespace YAML
// size/iterator
// size/iterator
inline
std
::
size_t
Value
::
size
()
const
inline
std
::
size_t
Value
::
size
()
const
{
{
return
0
;
return
m_pNode
->
size
()
;
}
}
inline
const_iterator
Value
::
begin
()
const
inline
const_iterator
Value
::
begin
()
const
{
{
return
const_iterator
(
);
return
static_cast
<
const
detail
::
node
&>
(
*
m_pNode
).
begin
(
m_pMemory
);
}
}
inline
iterator
Value
::
begin
()
inline
iterator
Value
::
begin
()
{
{
return
iterator
(
);
return
m_pNode
->
begin
(
m_pMemory
);
}
}
inline
const_iterator
Value
::
end
()
const
inline
const_iterator
Value
::
end
()
const
{
{
return
const_iterator
(
);
return
static_cast
<
const
detail
::
node
&>
(
*
m_pNode
).
end
(
m_pMemory
);
}
}
inline
iterator
Value
::
end
()
inline
iterator
Value
::
end
()
{
{
return
iterator
(
);
return
m_pNode
->
end
(
m_pMemory
);
}
}
// sequence
// sequence
...
...
include/yaml-cpp/value/iterator.h
View file @
ff1a8fc5
...
@@ -7,11 +7,12 @@
...
@@ -7,11 +7,12 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/dll.h"
#include "yaml-cpp/value/detail/iterator.h"
namespace
YAML
namespace
YAML
{
{
struct
iterator
{};
class
iterator
:
public
detail
::
iterator_base
<
detail
::
iterator_value
,
detail
::
node_seq_iterator
,
detail
::
node_map_iterator
>
{};
struct
const_iterator
{};
class
const_iterator
:
public
detail
::
iterator_base
<
const
detail
::
iterator_value
,
detail
::
node_seq_const_iterator
,
detail
::
node_map_const_iterator
>
{};
}
}
#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
include/yaml-cpp/value/value.h
View file @
ff1a8fc5
...
@@ -7,13 +7,15 @@
...
@@ -7,13 +7,15 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/dll.h"
#include "yaml-cpp/value/iterator.h"
#include "yaml-cpp/value/ptr.h"
#include "yaml-cpp/value/ptr.h"
#include "yaml-cpp/value/type.h"
#include "yaml-cpp/value/type.h"
#include <stdexcept>
#include <stdexcept>
namespace
YAML
namespace
YAML
{
{
class
iterator
;
class
const_iterator
;
class
Value
class
Value
{
{
public
:
public
:
...
...
src/value/detail/node_data.cpp
View file @
ff1a8fc5
...
@@ -60,6 +60,49 @@ namespace YAML
...
@@ -60,6 +60,49 @@ namespace YAML
m_scalar
=
scalar
;
m_scalar
=
scalar
;
}
}
// size/iterator
std
::
size_t
node_data
::
size
()
const
{
return
0
;
}
const_iterator
node_data
::
begin
(
shared_memory_holder
pMemory
)
const
{
switch
(
m_type
)
{
case
ValueType
:
:
Sequence
:
return
const_iterator
(
pMemory
,
m_sequence
.
begin
());
case
ValueType
:
:
Map
:
return
const_iterator
(
pMemory
,
m_map
.
begin
());
default
:
return
const_iterator
();
}
}
iterator
node_data
::
begin
(
shared_memory_holder
pMemory
)
{
switch
(
m_type
)
{
case
ValueType
:
:
Sequence
:
return
iterator
(
pMemory
,
m_sequence
.
begin
());
case
ValueType
:
:
Map
:
return
iterator
(
pMemory
,
m_map
.
begin
());
default
:
return
iterator
();
}
}
const_iterator
node_data
::
end
(
shared_memory_holder
pMemory
)
const
{
switch
(
m_type
)
{
case
ValueType
:
:
Sequence
:
return
const_iterator
(
pMemory
,
m_sequence
.
end
());
case
ValueType
:
:
Map
:
return
const_iterator
(
pMemory
,
m_map
.
end
());
default
:
return
const_iterator
();
}
}
iterator
node_data
::
end
(
shared_memory_holder
pMemory
)
{
switch
(
m_type
)
{
case
ValueType
:
:
Sequence
:
return
iterator
(
pMemory
,
m_sequence
.
end
());
case
ValueType
:
:
Map
:
return
iterator
(
pMemory
,
m_map
.
end
());
default
:
return
iterator
();
}
}
// sequence
void
node_data
::
append
(
node
&
node
,
shared_memory_holder
/* pMemory */
)
void
node_data
::
append
(
node
&
node
,
shared_memory_holder
/* pMemory */
)
{
{
if
(
m_type
!=
ValueType
::
Sequence
)
if
(
m_type
!=
ValueType
::
Sequence
)
...
...
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