Panda3D
|
00001 // Filename: rangeDescription.h 00002 // Created by: drose (07Sep03) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef RANGEDESCRIPTION_H 00016 #define RANGEDESCRIPTION_H 00017 00018 #include "pandatoolbase.h" 00019 #include "pvector.h" 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Class : RangeDescription 00023 // Description : This describes a sparse range of Unicode character 00024 // codes for conversion that may be specified on the 00025 // command line. 00026 //////////////////////////////////////////////////////////////////// 00027 class RangeDescription { 00028 public: 00029 RangeDescription(); 00030 00031 bool parse_parameter(const string ¶m); 00032 INLINE void add_singleton(int code); 00033 INLINE void add_range(int from_code, int to_code); 00034 INLINE bool is_empty() const; 00035 00036 void output(ostream &out) const; 00037 00038 private: 00039 bool parse_word(const string &word); 00040 bool parse_code(const string &word, int &code); 00041 bool parse_bracket(const string &str); 00042 00043 private: 00044 class Range { 00045 public: 00046 INLINE Range(int code); 00047 INLINE Range(int from_code, int to_code); 00048 00049 int _from_code; 00050 int _to_code; 00051 }; 00052 00053 typedef pvector<Range> RangeList; 00054 RangeList _range_list; 00055 00056 friend class RangeIterator; 00057 }; 00058 00059 INLINE ostream &operator << (ostream &out, const RangeDescription &range); 00060 00061 #include "rangeDescription.I" 00062 00063 #endif 00064