00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PRINTCAPENTRY_H
00021 #define PRINTCAPENTRY_H
00022
00023 #if !defined( _TDEPRINT_COMPILE ) && defined( __GNUC__ )
00024 #warning internal header, do not use except if you are a TDEPrint developer
00025 #endif
00026
00027 #include <tqstring.h>
00028 #include <tqmap.h>
00029 #include <tqstringlist.h>
00030 #include <tqtextstream.h>
00031
00039 class Field
00040 {
00041 public:
00042 enum Type { String, Integer, Boolean };
00043 Field() : type(String) {}
00044 Field(const Field &f) : type(f.type), name(f.name), value(f.value) {}
00045 Field& operator= (const Field& f)
00046 {
00047 type = f.type;
00048 name = f.name;
00049 value = f.value;
00050 return (*this);
00051 }
00052 TQString toString() const;
00053
00054 Type type;
00055 TQString name;
00056 TQString value;
00057 };
00058
00066 class PrintcapEntry
00067 {
00068 public:
00069 TQString name;
00070 TQStringList aliases;
00071 TQString comment;
00072 TQMap<TQString,Field> fields;
00073 TQString postcomment;
00074
00075 bool has(const TQString& f) const { return fields.contains(f); }
00076 TQString field(const TQString& f) const { return fields[f].value; }
00077 bool writeEntry(TQTextStream&);
00078 void addField(const TQString& name, Field::Type type = Field::Boolean, const TQString& value = TQString::null);
00079 };
00080
00081 #endif