00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: TagRetrievalPos.h 00014 00015 Author: Klaus Kaempf <kkaempf@suse.de> 00016 Maintainer: Klaus Kaempf <kkaempf@suse.de> 00017 00018 Purpose: Keep data and provide functions for on-demand retrieval 00019 of cache values 00020 00021 /-*/ 00022 #ifndef TagRetrievalPos_h 00023 #define TagRetrievalPos_h 00024 00025 #include <iostream> 00026 #include <string> 00027 #include <list> 00028 00030 // 00031 // CLASS NAME : TagRetrievalPos 00032 // 00033 class TagRetrievalPos { 00034 private: 00035 std::streamoff _begin; 00036 std::streamoff _end; 00037 00038 // position stream and calculate expected characters 00039 int positionStream (std::istream & stream_fr) const; 00040 00041 static const unsigned bufferLen_i; 00042 static char buffer_ac[]; 00043 00044 public: 00045 static const std::streamoff nopos; 00046 TagRetrievalPos () : _begin(nopos), _end (nopos) {} 00047 TagRetrievalPos (std::streamoff begin, std::streamoff end) : _begin(begin), _end (end) {} 00048 ~TagRetrievalPos() {} 00049 00053 bool empty () const { return _end == nopos; } 00054 00058 const std::streamoff begin() const { return _begin; } 00059 const std::streamoff end() const { return _end; } 00060 00064 void set (std::streamoff begin, std::streamoff end) { 00065 if ( begin < end ) { 00066 _begin = begin; 00067 _end = end; 00068 } 00069 } 00070 00074 bool retrieveData (std::istream& input, std::string& data_r) const; 00075 00079 bool retrieveData (std::istream& input, std::list<std::string>& data_r) const; 00080 }; 00081 00082 #endif // TagRetrievalPos_h