00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef RANGEDESCRIPTION_H
00016 #define RANGEDESCRIPTION_H
00017
00018 #include "pandatoolbase.h"
00019 #include "pvector.h"
00020
00021
00022
00023
00024
00025
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