Brief description of class still missing. More...
#include <AbstractStream.h>
Public Types | |
| enum | ClassId { StandardId = 0, StringId, FileId, LogViewId, CustomId } |
Public Member Functions | |
| AbstractStream () | |
| virtual ClassId | classId () const =0 |
| void | endl () |
| void | flush () |
| void | freeze (bool b) |
| bool | isFrozen () const |
| AbstractStream * | next () const |
| AbstractStream & | operator<< (const QString &val) |
| AbstractStream & | operator<< (int val) |
| AbstractStream & | operator<< (double val) |
| AbstractStream & | operator<< (const char *val) |
| AbstractStream & | operator<< (QChar val) |
| AbstractStream & | operator<< (char val) |
| AbstractStream * | previous () const |
| void | setNext (AbstractStream *s) |
| void | setPrefix (const QString &prefix) |
| void | setPrevious (AbstractStream *s) |
| virtual | ~AbstractStream () |
Protected Member Functions | |
| virtual void | flushStream ()=0 |
| void | lock () |
| virtual void | sendToStream (const QString &val)=0 |
| void | unlock () |
Brief description of class still missing.
Full description of class still missing
{StandardId=0, StringId, FileId, LogViewId, CustomId};
| QGpCoreTools::AbstractStream::~AbstractStream | ( | ) | [virtual] |
References QGpCoreTools::SharedObject::removeReference(), and TRACE.
{
TRACE;
//printf("AbstractStream::~AbstractStream()... %p\n", this);
//printf("%s", CoreApplication::backTrace().toAscii().data());
if(_previous) {
removeReference(_previous);
}
}
| virtual ClassId QGpCoreTools::AbstractStream::classId | ( | ) | const [pure virtual] |
| void QGpCoreTools::AbstractStream::endl | ( | ) |
References flushStream(), and sendToStream().
Referenced by QGpCoreTools::endl(), and QGpCoreTools::FileStream::FileStream().
{
_mutex.lock();
if(!_frozen) {
switch(_prefixType) {
case NoPrefix:
sendToStream("\n");
break;
case String:
if(_lineOpen) {
sendToStream("\n");
_lineOpen=false;
} else {
sendToStream(_prefix1+"\n");
}
break;
case TimeStamp:
if(_lineOpen) {
sendToStream("\n");
_lineOpen=false;
} else {
sendToStream(timeStampedPrefix()+"\n");
}
break;
}
flushStream();
}
_mutex.unlock();
}
| void QGpCoreTools::AbstractStream::flush | ( | ) |
References flushStream().
Referenced by QGpCoreTools::flush().
{
_mutex.lock();
if(!_frozen) {
flushStream();
}
_mutex.unlock();
}
| virtual void QGpCoreTools::AbstractStream::flushStream | ( | ) | [protected, pure virtual] |
Implemented in QGpGuiTools::LogView, QGpCoreTools::FileStream, QGpCoreTools::StandardStream, and QGpCoreTools::StringStream.
| void QGpCoreTools::AbstractStream::freeze | ( | bool | b | ) | [inline] |
Referenced by QGpCoreTools::CoreApplicationPrivate::freezeStream().
{_frozen=b;}
| bool QGpCoreTools::AbstractStream::isFrozen | ( | ) | const [inline] |
{return _frozen;}
| void QGpCoreTools::AbstractStream::lock | ( | ) | [inline, protected] |
Referenced by QGpGuiTools::LogView::clear(), QGpGuiTools::LogView::flushBuffer(), and QGpGuiTools::LogView::operator=().
{_mutex.lock();}
| AbstractStream* QGpCoreTools::AbstractStream::next | ( | ) | const [inline] |
Referenced by QGpCoreTools::CoreApplicationPrivate::endRedirectStream().
{return _next;}
| AbstractStream & QGpCoreTools::AbstractStream::operator<< | ( | const QString & | val | ) |
References sendToStream().
{
_mutex.lock();
if(!_frozen) {
switch(_prefixType) {
case NoPrefix:
sendToStream(val);
break;
case String:
if(!_lineOpen) {
sendToStream(_prefix1);
_lineOpen=true;
}
if(val.contains("\n")) {
QString s=val;
s.replace("\n", "\n"+_prefix1);
sendToStream(s);
} else {
sendToStream(val);
}
break;
case TimeStamp: {
QString prefix=timeStampedPrefix();
if(!_lineOpen) {
sendToStream(prefix);
_lineOpen=true;
}
if(val.contains("\n")) {
QString s=val;
s.replace("\n", "\n"+prefix);
sendToStream(s);
} else {
sendToStream(val);
}
}
break;
}
}
_mutex.unlock();
return *this;
}
| AbstractStream& QGpCoreTools::AbstractStream::operator<< | ( | int | val | ) | [inline] |
| AbstractStream& QGpCoreTools::AbstractStream::operator<< | ( | double | val | ) | [inline] |
| AbstractStream& QGpCoreTools::AbstractStream::operator<< | ( | const char * | val | ) | [inline] |
| AbstractStream& QGpCoreTools::AbstractStream::operator<< | ( | QChar | val | ) | [inline] |
| AbstractStream& QGpCoreTools::AbstractStream::operator<< | ( | char | val | ) | [inline] |
References operator<<().
Referenced by operator<<().
{return operator<<(QString(QChar::fromAscii(val)));}
| AbstractStream* QGpCoreTools::AbstractStream::previous | ( | ) | const [inline] |
Referenced by QGpCoreTools::CoreApplicationPrivate::endRedirectStream().
{return _previous;}
| virtual void QGpCoreTools::AbstractStream::sendToStream | ( | const QString & | val | ) | [protected, pure virtual] |
Implemented in QGpGuiTools::LogView, QGpCoreTools::FileStream, QGpCoreTools::StandardStream, and QGpCoreTools::StringStream.
Referenced by endl(), and operator<<().
| void QGpCoreTools::AbstractStream::setNext | ( | AbstractStream * | s | ) | [inline] |
Referenced by QGpCoreTools::CoreApplicationPrivate::beginRedirectStream(), and QGpCoreTools::CoreApplicationPrivate::endRedirectStream().
{_next=s;}
| void QGpCoreTools::AbstractStream::setPrefix | ( | const QString & | prefix | ) |
If prefix contains "%t", it is replaced by current time
{
if(prefix.isEmpty()) {
_prefixType=NoPrefix;
} else {
int i=prefix.indexOf("%t");
if(i==-1) {
_prefixType=String;
_prefix1=prefix;
} else {
_prefixType=TimeStamp;
_prefix1=prefix.left(i);
_prefix2=prefix.mid(i+2);
}
_lineOpen=false; // Disregarded when in NoPrefix mode
}
}
References QGpCoreTools::SharedObject::addReference(), and QGpCoreTools::SharedObject::removeReference().
Referenced by QGpCoreTools::CoreApplicationPrivate::beginRedirectStream(), and QGpCoreTools::CoreApplicationPrivate::endRedirectStream().
{
if(_previous) {
AbstractStream::removeReference(_previous);
}
_previous=s;
if(_previous) {
_previous->addReference();
}
}
| void QGpCoreTools::AbstractStream::unlock | ( | ) | [inline, protected] |
Referenced by QGpGuiTools::LogView::clear(), QGpGuiTools::LogView::flushBuffer(), and QGpGuiTools::LogView::operator=().
{_mutex.unlock();}