• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeprint
 

kdeprint

  • kdeprint
  • lpr
printcapentry.cpp
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (c) 2001,2002 Michael Goffioul <kdeprint@swing.be>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License version 2 as published by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  **/
19 
20 #include "printcapentry.h"
21 
22 TQString Field::toString() const
23 {
24  TQString s = name;
25  switch (type)
26  {
27  case String:
28  s += ("=" + value);
29  break;
30  case Integer:
31  s += ("#" + value);
32  break;
33  case Boolean:
34  if (!value.toInt())
35  s += "@";
36  break;
37  }
38  return s;
39 }
40 
41 bool PrintcapEntry::writeEntry(TQTextStream& t)
42 {
43  t << comment << endl;
44  t << name;
45  if (aliases.count() > 0)
46  t << '|' << aliases.join("|");
47  t << ':';
48  for (TQMap<TQString,Field>::ConstIterator it=fields.begin(); it!=fields.end(); ++it)
49  {
50  t << '\\' << endl << " :";
51  t << (*it).name;
52  switch ((*it).type)
53  {
54  case Field::String:
55  t << '=' << (*it).value << ':';
56  break;
57  case Field::Integer:
58  t << '#' << (*it).value << ':';
59  break;
60  case Field::Boolean:
61  t << ':';
62  break;
63  default:
64  t << endl << endl;
65  return false;
66  }
67  }
68  t << endl;
69  if (!postcomment.isEmpty())
70  t << postcomment << endl;
71  t << endl;
72  return true;
73 }
74 
75 void PrintcapEntry::addField(const TQString& name, Field::Type type, const TQString& value)
76 {
77  Field f;
78  f.name = name;
79  f.type = type;
80  f.value = value;
81  fields[name] = f;
82 }

kdeprint

Skip menu "kdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdeprint

Skip menu "kdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeprint by doxygen 1.8.13
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |