00001 #ifndef pairs_h
00002 #define pairs_h
00003
00004 #include <string>
00005 #include <list>
00006
00008 class Pairs
00009 {
00010 private:
00011
00013 typedef struct Pair
00014 {
00015 std::string::size_type first;
00016 std::string::size_type second;
00017 };
00018
00019 typedef std::list<Pair> Pair_list;
00020 typedef std::list<Pair>::iterator Pair_list_it;
00021
00022 Pair_list pairs;
00023
00024 public:
00026 Pairs( std::string line , std::string::size_type startpos = 0);
00027
00029 void add( std::string::size_type first,
00030 std::string::size_type second );
00031
00032 void clear();
00033
00035
00036 bool is_in_pair( std::string::size_type pos );
00037
00039 void extract( std::string line, std::string::size_type startpos = 0 );
00040
00041 private:
00043
00044 bool is_in_pair( std::string::size_type pos,
00045 std::string::size_type pair1,
00046 std::string::size_type pair2 ) const ;
00047 };
00048
00049 #endif