My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FTextStream Class Reference

Simplified and optimized version of QTextStream. More...

#include <ftextstream.h>

Public Member Functions

 FTextStream ()
 
 FTextStream (QIODevice *)
 
 FTextStream (QGString *)
 
 FTextStream (FILE *)
 
virtual ~FTextStream ()
 
QIODevice * device () const
 
void setDevice (QIODevice *)
 
void unsetDevice ()
 
FTextStreamoperator<< (char)
 
FTextStreamoperator<< (const char *)
 
FTextStreamoperator<< (const QString &)
 
FTextStreamoperator<< (const QCString &)
 
FTextStreamoperator<< (signed short)
 
FTextStreamoperator<< (unsigned short)
 
FTextStreamoperator<< (signed int)
 
FTextStreamoperator<< (unsigned int)
 
FTextStreamoperator<< (signed long)
 
FTextStreamoperator<< (unsigned long)
 
FTextStreamoperator<< (float)
 
FTextStreamoperator<< (double)
 

Private Member Functions

FTextStreamoutput_int (ulong n, bool neg)
 

Private Attributes

QIODevice * m_dev
 
bool m_owndev
 

Detailed Description

Simplified and optimized version of QTextStream.

Definition at line 11 of file ftextstream.h.

Constructor & Destructor Documentation

FTextStream::FTextStream ( )

Definition at line 145 of file ftextstream.cpp.

References m_dev, and m_owndev.

{
m_dev = 0;
m_owndev = FALSE;
}
FTextStream::FTextStream ( QIODevice *  dev)

Definition at line 151 of file ftextstream.cpp.

References m_dev, and m_owndev.

{
m_dev = dev;
m_owndev = FALSE;
}
FTextStream::FTextStream ( QGString *  s)

Definition at line 157 of file ftextstream.cpp.

References m_dev, and m_owndev.

{
((QGStringBuffer*)m_dev)->open( IO_WriteOnly );
m_owndev = TRUE;
}
FTextStream::FTextStream ( FILE *  fh)

Definition at line 164 of file ftextstream.cpp.

References m_dev, and m_owndev.

{
m_dev = new QFile;
((QFile *)m_dev)->open( IO_WriteOnly, fh);
m_owndev = TRUE;
}
FTextStream::~FTextStream ( )
virtual

Definition at line 171 of file ftextstream.cpp.

References m_dev, and m_owndev.

{
if (m_owndev) delete m_dev;
m_dev = 0;
}

Member Function Documentation

QIODevice * FTextStream::device ( ) const

Definition at line 177 of file ftextstream.cpp.

References m_dev.

Referenced by LatexCodeGenerator::setTextStream(), and HtmlCodeGenerator::setTextStream().

{
return m_dev;
}
FTextStream & FTextStream::operator<< ( char  c)
inline

Definition at line 49 of file ftextstream.h.

References m_dev.

Referenced by operator<<(), and output_int().

{
if (m_dev) m_dev->putch(c);
return *this;
}
FTextStream & FTextStream::operator<< ( const char *  s)
inline

Definition at line 55 of file ftextstream.h.

References m_dev.

{
uint len = qstrlen( s );
if (m_dev) m_dev->writeBlock( s, len );
return *this;
}
FTextStream & FTextStream::operator<< ( const QString &  s)
inline

Definition at line 62 of file ftextstream.h.

References operator<<().

{
return operator<<(s.data());
}
FTextStream & FTextStream::operator<< ( const QCString &  s)
inline

Definition at line 67 of file ftextstream.h.

References operator<<().

{
return operator<<(s.data());
}
FTextStream & FTextStream::operator<< ( signed short  i)

Definition at line 215 of file ftextstream.cpp.

References output_int().

{
return output_int( i, i < 0 );
}
FTextStream & FTextStream::operator<< ( unsigned short  i)

Definition at line 220 of file ftextstream.cpp.

References output_int().

{
return output_int( i, FALSE );
}
FTextStream & FTextStream::operator<< ( signed int  i)

Definition at line 225 of file ftextstream.cpp.

References output_int().

{
return output_int( i, i < 0 );
}
FTextStream & FTextStream::operator<< ( unsigned int  i)

Definition at line 230 of file ftextstream.cpp.

References output_int().

{
return output_int( i, FALSE );
}
FTextStream & FTextStream::operator<< ( signed long  i)

Definition at line 235 of file ftextstream.cpp.

References output_int().

{
return output_int( i, i < 0 );
}
FTextStream & FTextStream::operator<< ( unsigned long  i)

Definition at line 240 of file ftextstream.cpp.

References output_int().

{
return output_int( i, FALSE );
}
FTextStream & FTextStream::operator<< ( float  f)

Definition at line 245 of file ftextstream.cpp.

{
return *this << (double)f;
}
FTextStream & FTextStream::operator<< ( double  d)

Definition at line 250 of file ftextstream.cpp.

{
char buf[64];
sprintf(buf,"%f",d);
return *this << buf;
}
FTextStream & FTextStream::output_int ( ulong  n,
bool  neg 
)
private

Definition at line 197 of file ftextstream.cpp.

References operator<<().

Referenced by operator<<().

{
char buf[20];
char *p = &buf[19];
*p = '\0';
if ( neg )
{
n = (ulong)(-(long)n);
}
do
{
*--p = ((int)(n%10)) + '0';
n /= 10;
} while ( n );
if ( neg ) *--p = '-';
return operator<<(p);
}
void FTextStream::setDevice ( QIODevice *  dev)
void FTextStream::unsetDevice ( )

Definition at line 192 of file ftextstream.cpp.

References setDevice().

Referenced by OutputGenerator::endPlainFile(), EclipseHelp::finalize(), and HtmlHelp::finalize().

{
}

Member Data Documentation

QIODevice* FTextStream::m_dev
private

Definition at line 38 of file ftextstream.h.

Referenced by device(), FTextStream(), operator<<(), setDevice(), and ~FTextStream().

bool FTextStream::m_owndev
private

Definition at line 39 of file ftextstream.h.

Referenced by FTextStream(), setDevice(), and ~FTextStream().


The documentation for this class was generated from the following files: