Panda3D
Loading...
Searching...
No Matches
pandatool
src
egg-mkfont
rangeIterator.cxx
Go to the documentation of this file.
1
/**
2
* PANDA 3D SOFTWARE
3
* Copyright (c) Carnegie Mellon University. All rights reserved.
4
*
5
* All use of this software is subject to the terms of the revised BSD
6
* license. You should have received a copy of this license along
7
* with this source code in a file named "LICENSE."
8
*
9
* @file rangeIterator.cxx
10
* @author drose
11
* @date 2003-09-07
12
*/
13
14
#include "
rangeIterator.h
"
15
16
/**
17
* Constructs an iterator to walk through the codes on the descriptor. It is
18
* important not to modify the RangeDescription object during the lifetime of
19
* the iterator.
20
*/
21
RangeIterator::
22
RangeIterator
(
const
RangeDescription
&desc) :
23
_desc(desc)
24
{
25
_it = _desc._range_list.begin();
26
if
(_it == _desc._range_list.end()) {
27
_code = -1;
28
}
else
{
29
_code = (*_it)._from_code;
30
_codes_generated.insert(_code);
31
}
32
}
33
34
/**
35
* Advances the iterator to the next code. Returns true if there is a next
36
* code, or false if there are no mode codes.
37
*/
38
bool
RangeIterator::
39
next
() {
40
do
{
41
if
(_it == _desc._range_list.end()) {
42
return
false
;
43
}
44
45
if
(_code < (*_it)._to_code) {
46
_code++;
47
48
}
else
{
49
_it++;
50
if
(_it == _desc._range_list.end()) {
51
_code = -1;
52
return
false
;
53
}
54
55
_code = (*_it)._from_code;
56
}
57
58
// If this code has already been generated, repeat and skip to the next
59
// one.
60
}
while
(!_codes_generated.insert(_code).second);
61
62
return
true
;
63
}
RangeDescription
This describes a sparse range of Unicode character codes for conversion that may be specified on the ...
Definition
rangeDescription.h:24
RangeIterator::next
bool next()
Advances the iterator to the next code.
Definition
rangeIterator.cxx:39
RangeIterator::RangeIterator
RangeIterator(const RangeDescription &desc)
Constructs an iterator to walk through the codes on the descriptor.
Definition
rangeIterator.cxx:22
rangeIterator.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Generated on Mon Jan 8 2024 17:18:45 for Panda3D by
1.10.0