00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: TagCacheRetrieval.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 Purpose: Keep data and provide functions for on-demand retrieval 00019 of cache values 00020 00021 /-*/ 00022 #ifndef TagCacheRetrieval_h 00023 #define TagCacheRetrieval_h 00024 00025 #include <iosfwd> 00026 #include <string> 00027 #include <fstream> 00028 00029 #include <y2util/Pathname.h> 00030 #include <y2util/TaggedParser.h> 00031 #include <y2util/TagRetrievalPos.h> 00032 00033 #include <y2util/TagCacheRetrievalPtr.h> 00034 00036 // 00037 // CLASS NAME : TagCacheRetrieval 00038 // 00039 class TagCacheRetrieval : public CountedRep { 00040 REP_BODY(TagCacheRetrieval); 00041 private: 00042 // the name of the file 00043 std::string _name; 00044 00045 // hint to keep stream open 00046 bool _keep_open; 00047 00048 // the stream to read data from 00049 std::ifstream _stream; 00050 00051 public: 00052 00053 TagCacheRetrieval (const Pathname& filename); 00054 ~TagCacheRetrieval(); 00055 00056 void startRetrieval(); 00057 void stopRetrieval(); 00058 00063 std::string& getName (void) { return _name; } 00064 00068 bool retrieveData (const TagRetrievalPos& pos, std::list<std::string> &data_r); 00069 bool retrieveData (const TagRetrievalPos& pos, std::string &data_r); 00070 }; 00071 00073 00074 #endif // TagCacheRetrieval_h