nomlib
Toggle main menu visibility
Loading...
Searching...
No Matches
include
nomlib
ptree
ValueIteratorBase.hpp
1
/******************************************************************************
2
3
nomlib - C++11 cross-platform game engine
4
5
Copyright (c) 2013, 2014 Jeffrey Carpenter <i8degrees@gmail.com>
6
All rights reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
1. Redistributions of source code must retain the above copyright notice, this
12
list of conditions and the following disclaimer.
13
2. Redistributions in binary form must reproduce the above copyright notice,
14
this list of conditions and the following disclaimer in the documentation
15
and/or other materials provided with the distribution.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
******************************************************************************/
29
#ifndef NOMLIB_SYSTEM_PTREE_VALUE_ITERATOR_BASE_HPP
30
#define NOMLIB_SYSTEM_PTREE_VALUE_ITERATOR_BASE_HPP
31
32
#include <vector>
33
#include <iterator>
34
35
#include "export.hpp"
36
#include "nomlib/config.hpp"
37
#include "nomlib/ptree/ptree_config.hpp"
38
#include "nomlib/ptree/ptree_types.hpp"
39
#include "nomlib/ptree/ptree_forwards.hpp"
40
#include "nomlib/ptree/Value.hpp"
41
42
namespace
nom {
43
44
class
NOM_EXPORT
ValueIteratorBase
45
{
46
public
:
47
typedef
ValueIteratorBase
SelfType;
48
typedef
ValueIteratorBase
* RawPtr;
49
typedef
nom::size_type DifferenceType;
50
typedef
Value
& ValueTypeReference;
51
typedef
Value
* ValueTypePointer;
52
53
enum
IteratorType
54
{
55
Null = 0,
// Type 0 (default)
56
ObjectValues
// Type 7
57
};
58
60
ValueIteratorBase
();
61
63
virtual
~ValueIteratorBase
();
64
65
ValueIteratorBase
(
const
ObjectIterator& rhs);
66
71
bool
valid
()
const
;
72
77
ArrayIndex
index
()
const
;
78
86
const
char
*
key
()
const
;
87
90
bool
key
(
const
std::string& member)
const
;
91
92
bool
operator ==(
const
SelfType& rhs)
const
;
93
94
bool
operator !=(
const
SelfType& rhs)
const
;
95
96
DifferenceType operator -(
const
SelfType& rhs)
const
;
97
98
protected
:
99
void
copy(
const
SelfType& rhs);
100
ValueTypeReference dereference()
const
;
101
ValueTypePointer pointer()
const
;
102
void
increment();
103
void
decrement();
104
DifferenceType distance(
const
SelfType& rhs)
const
;
105
106
private
:
107
enum
IteratorType type()
const
;
108
110
ObjectIterator
object_
;
111
112
enum
IteratorType type_;
113
};
114
115
}
// namespace nom
116
117
#endif
// include guard defined
nom::Value
Generic interface for opaque data containers.
Definition
Value.hpp:44
nom::ValueIteratorBase::ValueIteratorBase
ValueIteratorBase()
Default constructor.
nom::ValueIteratorBase::~ValueIteratorBase
virtual ~ValueIteratorBase()
Destructor.
nom::ValueIteratorBase::valid
bool valid() const
query validity of the object.
nom::ValueIteratorBase::key
const char * key() const
Obtain the current index or member key value.
nom::ValueIteratorBase::key
bool key(const std::string &member) const
Query if the member key exists at the current position of the iterator object.
nom::ValueIteratorBase::object_
ObjectIterator object_
A pointer to the object type iterator.
Definition
ValueIteratorBase.hpp:110
nom::ValueIteratorBase::index
ArrayIndex index() const
Obtain the index of the referenced value.
Generated on
for nomlib by
1.18.0