but with a Clear() method the dynamic allocated buffer can be easily reused added: DbTextStream a special version of a stream used to create a database string query everything is escaped by default added: DbBase a base class with some basic methods for communicating with the database added: DbConn a class for managing connection to the database changed: some refactoring in Db class git-svn-id: svn://ttmath.org/publicrep/winix/trunk@655 e52654a7-88a9-db11-a3e9-0013d4bc506e
127 lines
1.4 KiB
C++
Executable File
127 lines
1.4 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include "textstream.h"
|
|
|
|
|
|
|
|
|
|
void TextStream::Clear()
|
|
{
|
|
buffer.clear();
|
|
}
|
|
|
|
const std::string & TextStream::Str() const
|
|
{
|
|
return buffer;
|
|
}
|
|
|
|
|
|
const char * TextStream::CStr() const
|
|
{
|
|
return buffer.c_str();
|
|
}
|
|
|
|
|
|
|
|
TextStream & TextStream::operator<<(const char * str)
|
|
{
|
|
buffer += str;
|
|
|
|
return *this;
|
|
}
|
|
|
|
TextStream & TextStream::operator<<(const std::string * str)
|
|
{
|
|
buffer += *str;
|
|
|
|
return *this;
|
|
}
|
|
|
|
TextStream & TextStream::operator<<(const std::string & str)
|
|
{
|
|
buffer += str;
|
|
|
|
return *this;
|
|
}
|
|
|
|
TextStream & TextStream::operator<<(char v)
|
|
{
|
|
buffer += v;
|
|
|
|
return *this;
|
|
}
|
|
|
|
|
|
TextStream & TextStream::operator<<(int v)
|
|
{
|
|
char buf[50];
|
|
|
|
sprintf(buf, "%d", v);
|
|
buffer += buf;
|
|
|
|
return *this;
|
|
}
|
|
|
|
|
|
TextStream & TextStream::operator<<(long v)
|
|
{
|
|
char buf[50];
|
|
|
|
sprintf(buf, "%ld", v);
|
|
buffer += buf;
|
|
|
|
return *this;
|
|
}
|
|
|
|
|
|
TextStream & TextStream::operator<<(unsigned int v)
|
|
{
|
|
char buf[50];
|
|
|
|
sprintf(buf, "%u", v);
|
|
buffer += buf;
|
|
|
|
return *this;
|
|
}
|
|
|
|
|
|
TextStream & TextStream::operator<<(unsigned long v)
|
|
{
|
|
char buf[50];
|
|
|
|
sprintf(buf, "%lu", v);
|
|
buffer += buf;
|
|
|
|
return *this;
|
|
}
|
|
|
|
|
|
TextStream & TextStream::operator<<(double v)
|
|
{
|
|
char buf[50];
|
|
|
|
sprintf(buf, "%f", v);
|
|
buffer += buf;
|
|
|
|
return *this;
|
|
}
|
|
|
|
|
|
TextStream & TextStream::operator<<(const void * v)
|
|
{
|
|
char buf[50];
|
|
|
|
sprintf(buf, "%p", v);
|
|
buffer += buf;
|
|
|
|
return *this;
|
|
}
|
|
|