My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
QGStringBuffer Class Reference
Inheritance diagram for QGStringBuffer:

Public Member Functions

 QGStringBuffer (QGString *str)
 
 ~QGStringBuffer ()
 
bool open (int m)
 
void close ()
 
void flush ()
 
uint size () const
 
int at () const
 
bool at (int pos)
 
int readBlock (char *, uint)
 
int writeBlock (const char *p, uint len)
 
int getch ()
 
int putch (int ch)
 
int ungetch (int)
 

Protected Attributes

QGString * m_str
 

Private Member Functions

 QGStringBuffer (const QGStringBuffer &)
 
QGStringBufferoperator= (const QGStringBuffer &)
 

Detailed Description

Definition at line 6 of file ftextstream.cpp.

Constructor & Destructor Documentation

QGStringBuffer::QGStringBuffer ( QGString *  str)

Definition at line 31 of file ftextstream.cpp.

: m_str(str)
{
//printf("QGStringBuffer::QGStringBuffer(%p)\n",str);
}
QGStringBuffer::~QGStringBuffer ( )

Definition at line 36 of file ftextstream.cpp.

{
}
QGStringBuffer::QGStringBuffer ( const QGStringBuffer )
private

Member Function Documentation

int QGStringBuffer::at ( ) const

Definition at line 92 of file ftextstream.cpp.

{
return ioIndex;
}
bool QGStringBuffer::at ( int  pos)

Definition at line 97 of file ftextstream.cpp.

References m_str.

{
#if defined(CHECK_STATE)
if ( !isOpen() )
{
qWarning( "QGStringBuffer::at: Buffer is not open" );
return FALSE;
}
#endif
if ( (uint)pos >= m_str->length() )
{
#if defined(CHECK_RANGE)
qWarning( "QGStringBuffer::at: Index %d out of range", pos );
#endif
return FALSE;
}
ioIndex = pos;
return TRUE;
}
void QGStringBuffer::close ( )

Definition at line 74 of file ftextstream.cpp.

{
if ( isOpen() )
{
setFlags( IO_Direct );
ioIndex = 0;
}
}
void QGStringBuffer::flush ( )

Definition at line 83 of file ftextstream.cpp.

{
}
int QGStringBuffer::getch ( )
inline

Definition at line 19 of file ftextstream.cpp.

{ return -1; }
bool QGStringBuffer::open ( int  m)

Definition at line 40 of file ftextstream.cpp.

References m_str.

{
if ( !m_str )
{
#if defined(CHECK_STATE)
qWarning( "QGStringBuffer::open: No string" );
#endif
return FALSE;
}
if ( isOpen() )
{ // buffer already open
#if defined(CHECK_STATE)
qWarning( "QGStringBuffer::open: Buffer already open" );
#endif
return FALSE;
}
setMode( m );
if ( m & IO_Truncate )
{ // truncate buffer
m_str->truncate( 0 );
}
if ( m & IO_Append )
{ // append to end of buffer
ioIndex = m_str->length();
}
else
{
ioIndex = 0;
}
setState( IO_Open );
setStatus( 0 );
return TRUE;
}
QGStringBuffer& QGStringBuffer::operator= ( const QGStringBuffer )
private
int QGStringBuffer::putch ( int  ch)

Definition at line 130 of file ftextstream.cpp.

References m_str.

{
//printf("QGStringBuffer::putch(%d) m_str=%p ioIndex=%d\n",
// ch,m_str,ioIndex);
m_str->enlarge(ioIndex+2);
m_str->data()[ioIndex] = (char)ch;
ioIndex++;
m_str->data()[ioIndex] = '\0';
m_str->setLen(ioIndex);
return ch;
}
int QGStringBuffer::readBlock ( char *  ,
uint   
)
inline

Definition at line 17 of file ftextstream.cpp.

{ return -1; }
uint QGStringBuffer::size ( ) const

Definition at line 87 of file ftextstream.cpp.

References m_str.

{
return m_str ? m_str->length() : 0;
}
int QGStringBuffer::ungetch ( int  )
inline

Definition at line 21 of file ftextstream.cpp.

{ return -1; }
int QGStringBuffer::writeBlock ( const char *  p,
uint  len 
)

Definition at line 118 of file ftextstream.cpp.

References m_str.

{
//printf("QGStringBuffer::writeBlock(%p,%d) m_str=%p ioIndex=%d\n",p,len,
// m_str,ioIndex);
m_str->enlarge(ioIndex+len+1);
memcpy(m_str->data()+ioIndex,p,len);
ioIndex+=len;
m_str->data()[ioIndex]='\0';
m_str->setLen(ioIndex);
return len;
}

Member Data Documentation

QGString* QGStringBuffer::m_str
protected

Definition at line 24 of file ftextstream.cpp.

Referenced by at(), open(), putch(), size(), and writeBlock().


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