Qore Programming Language  1.12.0
UnicodeCharacterIterator.h
1 /*
2  UnicodeCharacterIterator.h
3 
4  Qore Programming Language
5 
6  Copyright (C) 2003 - 2022 Qore Technologies, s.r.o.
7 
8  Permission is hereby granted, free of charge, to any person obtaining a
9  copy of this software and associated documentation files (the "Software"),
10  to deal in the Software without restriction, including without limitation
11  the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  and/or sell copies of the Software, and to permit persons to whom the
13  Software is furnished to do so, subject to the following conditions:
14 
15  The above copyright notice and this permission notice shall be included in
16  all copies or substantial portions of the Software.
17 
18  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  DEALINGS IN THE SOFTWARE.
25 
26  Note that the Qore library is released under a choice of three open-source
27  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
28  information.
29 */
30 
31 #ifndef _QORE_UNICODECHARACTERITERATOR_H
32 #define _QORE_UNICODECHARACTERITERATOR_H
33 
34 class UnicodeCharacterIterator {
35 public:
37  DLLEXPORT UnicodeCharacterIterator(const QoreString& str);
38 
40  DLLEXPORT ~UnicodeCharacterIterator();
41 
43  DLLEXPORT bool next(ExceptionSink* xsink);
44 
46  DLLEXPORT int getValue() const;
47 
49  DLLEXPORT bool valid() const;
50 
51 protected:
52  const QoreString& str;
53  int current_code = -1;
54  size_t byte_pos = 0;
55 
56 private:
57  UnicodeCharacterIterator(const UnicodeCharacterIterator&) = delete;
58  UnicodeCharacterIterator& operator=(const UnicodeCharacterIterator&) = delete;
59 };
60 
61 #endif
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93