00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __QUERY_H__
00025 #define __QUERY_H__
00026
00027 #include <vector>
00028 #include <list>
00029 #include <string>
00030
00031 BEGIN_NAMESPACE( classad )
00032
00033 class ClassAdCollection;
00034 class ExprTree;
00035 class ClassAd;
00036
00037 class LocalCollectionQuery {
00038 public:
00039 LocalCollectionQuery( );
00040 ~LocalCollectionQuery( );
00041
00042 void Bind( ClassAdCollection * );
00043 bool Query( const std::string &viewName, ExprTree *constraint=NULL );
00044 void Clear( );
00045
00046 void ToFirst(void);
00047 bool IsAtFirst( ) const { return( itr==keys.begin( ) ); }
00048 bool Current( std::string &key );
00049 bool Next( std::string &key );
00050 bool Prev( std::string &key );
00051 void ToAfterLast(void);
00052 bool IsAfterLast(void) const { return( itr==keys.end( ) ); }
00053
00054 typedef std::vector<std::string>::iterator iterator;
00055 typedef std::vector<std::string>::const_iterator const_iterator;
00056
00057 iterator begin() { return keys.begin(); }
00058 const_iterator begin() const { return keys.begin(); }
00059 iterator end() { return keys.end(); }
00060 const_iterator end() const { return keys.end(); }
00061
00062 private:
00063 ClassAdCollection *collection;
00064 std::vector<std::string> keys;
00065 std::vector<std::string>::iterator itr;
00066 };
00067
00068
00069 END_NAMESPACE
00070
00071 #endif
00072