1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#ifndef INCLUDED_PGPSECTION_
#define INCLUDED_PGPSECTION_
#include <iosfwd>
#include <string>
#include <bobcat/tempstream>
// determine the next pgp section and its line numbers
namespace FBB
{
class TempStream;
}
class PGPSection
{
FBB::TempStream &d_pgpMessage;
std::istream &d_in; // current input file
size_t d_entryOffset; // initial d_in offset
size_t d_offset; // location (so far) in d_in
size_t d_firstLine; // first line nr. of a PGP section
// line nr after recognizing a correct
size_t d_nextNr; // PGP section element
std::string d_line; // line read by nextLine()
// true if the only the section lines
bool d_pgpRanges; // should be reported
public:
PGPSection(std::istream &in, FBB::TempStream &pgpMessage);
// get a complete PGP MESSAGE
bool complete( //std::ostream &out
); // from the in-stream
// line-range of the current PGP section
std::pair<unsigned, unsigned> range() const;
private:
// in PGP section lines all chars must be
bool validChars() const; // printable and may not be blanks
bool nextLine();
void next();
bool empty();
bool lines();
bool lastLine();
bool endMessage();
void verbose(std::string const &what) const;
};
inline std::pair<unsigned, unsigned> PGPSection::range() const
{
return { d_firstLine, d_nextNr + 1 };
}
#endif
|