printcapentry.h
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( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
00024 #warning internal header, do not use except if you are a KDEPrint developer
00025 #endif
00026 
00027 #include <qstring.h>
00028 #include <qmap.h>
00029 #include <qstringlist.h>
00030 #include <qtextstream.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     QString toString() const;
00053 
00054     Type    type;
00055     QString name;
00056     QString value;
00057 };
00058 
00066 class PrintcapEntry
00067 {
00068 public:
00069     QString         name;
00070     QStringList     aliases;
00071     QString         comment;
00072     QMap<QString,Field> fields;
00073     QString         postcomment;
00074 
00075     bool has(const QString& f) const    { return fields.contains(f); }
00076     QString field(const QString& f) const   { return fields[f].value; }
00077     bool writeEntry(QTextStream&);
00078     void addField(const QString& name, Field::Type type = Field::Boolean, const QString& value = QString::null);
00079 };
00080 
00081 #endif
 
This file is part of the documentation for kdeprint Library Version 3.2.0.