bool QGStringBuffer::open( int m ) { 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; }
int QGStringBuffer::putch( int ch ) { //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::writeBlock( const char *p, uint len ) { //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; }
QCString getMscImageMapFromFile(const QCString& inFile, const QCString& outDir, const QCString& relPath,const QCString& context) { QCString outFile = inFile + ".map"; //printf("*** running:getMscImageMapFromFile \n"); // chdir to the output dir, so dot can find the font file. QCString oldDir = QDir::currentDirPath().utf8(); // go to the html output directory (i.e. path) QDir::setCurrent(outDir); //printf("Going to dir %s\n",QDir::currentDirPath().data()); QCString mscExe = Config_getString("MSCGEN_PATH")+"mscgen"+portable_commandExtension(); QCString mscArgs = "-T ismap -i \""; mscArgs+=inFile; QFileInfo fi(inFile); mscArgs+="\" -o \""; mscArgs+=outFile + "\""; int exitCode; portable_sysTimerStart(); if ((exitCode=portable_system(mscExe,mscArgs,FALSE))!=0) { portable_sysTimerStop(); QDir::setCurrent(oldDir); return ""; } portable_sysTimerStop(); QGString result; FTextStream tmpout(&result); convertMapFile(tmpout, outFile, relPath, context); QDir().remove(outFile); QDir::setCurrent(oldDir); return result.data(); }
bool QGStringBuffer::at( int pos ) { #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 marshalQGString(StorageIntf *s,const QGString &str) { uint l=str.length(); marshalUInt(s,l); if (l>0) s->write(str.data(),l); }
uint QGStringBuffer::size() const { return m_str ? m_str->length() : 0; }