Panda3D
 All Classes Functions Variables Enumerations
rangeDescription.h
1 // Filename: rangeDescription.h
2 // Created by: drose (07Sep03)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef RANGEDESCRIPTION_H
16 #define RANGEDESCRIPTION_H
17 
18 #include "pandatoolbase.h"
19 #include "pvector.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : RangeDescription
23 // Description : This describes a sparse range of Unicode character
24 // codes for conversion that may be specified on the
25 // command line.
26 ////////////////////////////////////////////////////////////////////
28 public:
30 
31  bool parse_parameter(const string &param);
32  INLINE void add_singleton(int code);
33  INLINE void add_range(int from_code, int to_code);
34  INLINE bool is_empty() const;
35 
36  void output(ostream &out) const;
37 
38 private:
39  bool parse_word(const string &word);
40  bool parse_code(const string &word, int &code);
41  bool parse_bracket(const string &str);
42 
43 private:
44  class Range {
45  public:
46  INLINE Range(int code);
47  INLINE Range(int from_code, int to_code);
48 
49  int _from_code;
50  int _to_code;
51  };
52 
53  typedef pvector<Range> RangeList;
54  RangeList _range_list;
55 
56  friend class RangeIterator;
57 };
58 
59 INLINE ostream &operator << (ostream &out, const RangeDescription &range);
60 
61 #include "rangeDescription.I"
62 
63 #endif
64 
Walks through all the Unicode characters described by a RangeDescription class.
Definition: rangeIterator.h:28
bool parse_parameter(const string &param)
Parses a string of comma- and hyphen-delimited unicode values, in decimal and/or hex, including possible bracket-delimited ASCII characters, as may have been passed on a command line.
bool is_empty() const
Returns true if there are no codes described in the range.
This describes a sparse range of Unicode character codes for conversion that may be specified on the ...