Panda3D
rangeDescription.h
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 rangeDescription.h
10  * @author drose
11  * @date 2003-09-07
12  */
13 
14 #ifndef RANGEDESCRIPTION_H
15 #define RANGEDESCRIPTION_H
16 
17 #include "pandatoolbase.h"
18 #include "pvector.h"
19 
20 /**
21  * This describes a sparse range of Unicode character codes for conversion
22  * that may be specified on the command line.
23  */
25 public:
27 
28  bool parse_parameter(const std::string &param);
29  INLINE void add_singleton(int code);
30  INLINE void add_range(int from_code, int to_code);
31  INLINE bool is_empty() const;
32 
33  void output(std::ostream &out) const;
34 
35 private:
36  bool parse_word(const std::string &word);
37  bool parse_code(const std::string &word, int &code);
38  bool parse_bracket(const std::string &str);
39 
40 private:
41  class Range {
42  public:
43  INLINE Range(int code);
44  INLINE Range(int from_code, int to_code);
45 
46  int _from_code;
47  int _to_code;
48  };
49 
50  typedef pvector<Range> RangeList;
51  RangeList _range_list;
52 
53  friend class RangeIterator;
54 };
55 
56 INLINE std::ostream &operator << (std::ostream &out, const RangeDescription &range);
57 
58 #include "rangeDescription.I"
59 
60 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_empty() const
Returns true if there are no codes described in the range.
bool parse_parameter(const std::string &param)
Parses a string of comma- and hyphen-delimited unicode values, in decimal and/or hex,...
Walks through all the Unicode characters described by a RangeDescription class.
Definition: rangeIterator.h:26
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This describes a sparse range of Unicode character codes for conversion that may be specified on the ...