ISLEman
ftextstream.h
1 #ifndef FTEXTSTREAM_H
2 #define FTEXTSTREAM_H
3 
4 #include <stdio.h>
5 
6 #include <qiodevice.h>
7 #include <qstring.h>
8 #include <qgstring.h>
9 
12 {
13  public:
14  FTextStream();
16  FTextStream( QGString * );
17  FTextStream( FILE * );
18  virtual ~FTextStream();
19 
20  QIODevice *device() const;
21  void setDevice( QIODevice * );
22  void unsetDevice();
23 
24  FTextStream &operator<<( char );
25  FTextStream &operator<<( const char *);
26  FTextStream &operator<<( const QString & );
27  FTextStream &operator<<( const QCString & );
28  FTextStream &operator<<( signed short );
29  FTextStream &operator<<( unsigned short );
30  FTextStream &operator<<( signed int );
31  FTextStream &operator<<( unsigned int );
32  FTextStream &operator<<( signed long );
33  FTextStream &operator<<( unsigned long );
34  FTextStream &operator<<( float );
35  FTextStream &operator<<( double );
36 
37  private:
38  QIODevice *m_dev;
39  bool m_owndev;
40  FTextStream &output_int( ulong n, bool neg );
41 
42  private: // Disabled copy constructor and operator=
43 #if defined(Q_DISABLE_COPY)
44  FTextStream( const FTextStream & );
45  FTextStream &operator=( const FTextStream & );
46 #endif
47 };
48 
49 inline FTextStream &FTextStream::operator<<( char c)
50 {
51  if (m_dev) m_dev->putch(c);
52  return *this;
53 }
54 
55 inline FTextStream &FTextStream::operator<<( const char* s)
56 {
57  uint len = qstrlen( s );
58  if (m_dev) m_dev->writeBlock( s, len );
59  return *this;
60 }
61 
62 inline FTextStream &FTextStream::operator<<( const QString & s)
63 {
64  return operator<<(s.data());
65 }
66 
67 inline FTextStream &FTextStream::operator<<( const QCString &s)
68 {
69  return operator<<(s.data());
70 }
71 
72 typedef FTextStream & (*FTSFUNC)(FTextStream &);// manipulator function
73 
74 inline FTextStream &operator<<( FTextStream &s, FTSFUNC f )
75 { return (*f)( s ); }
76 
77 inline FTextStream &endl( FTextStream & s)
78 {
79  return s << '\n';
80 }
81 
82 #endif // FTEXTSTREAM_H
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
const char * data() const
Definition: qstring.h:542
virtual int writeBlock(const char *data, uint len)=0
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition: qcstring.h:207
This is an alternative implementation of QCString.
Definition: qgstring.h:19
The QIODevice class is the base class of I/O devices.
Definition: qiodevice.h:88
This is an alternative implementation of QCString.
Definition: qcstring.h:131
virtual int putch(int)=0