SqlStringBuffer Class Reference

#include <SqlStringBuffer.h>

List of all members.

Public Member Functions

 SqlStringBuffer (int storage, int size, int leftpad=0, int rightpad=0, uint text= 'x', uint pad= ' ', int leftBumper=mBumperLen, int rightBumper=mBumperLen)
bool verify ()
void randomize (uint start= 'A', uint lower= ' ', uint upper= '~')
void patternfill (uint start= 'A', uint lower= ' ', uint upper= '~')

Public Attributes

char * mStr
char * mRightP
char * mLeftP
const int mStorage
const int mSize
const int mLeftPad
const int mRightPad
const int mLeftBump
const int mRightBump
const int mTotal
string mS

Static Public Attributes

static const uint mBumperChar
static const int mBumperLen


Detailed Description

Definition at line 39 of file SqlStringBuffer.h.


Constructor & Destructor Documentation

SqlStringBuffer::SqlStringBuffer ( int  storage,
int  size,
int  leftpad = 0,
int  rightpad = 0,
uint  text = 'x',
uint  pad = ' ',
int  leftBumper = mBumperLen,
int  rightBumper = mBumperLen 
) [explicit]

Definition at line 39 of file SqlStringBuffer.cpp.

References mLeftBump, mLeftP, mLeftPad, mRightP, mS, mSize, mStorage, and mStr.

00048     : mStorage(storage),
00049       mSize(size),
00050       mLeftPad(leftpad),
00051       mRightPad(rightpad),
00052       mLeftBump(leftBumper),
00053       mRightBump(rightBumper),
00054       mTotal(storage + leftBumper + rightBumper),
00055       mS(mTotal, mBumperChar)
00056 {
00057     assert(leftBumper > 0);
00058     assert(rightBumper > 0);
00059     assert(storage == size + leftpad + rightpad);
00060 
00061     mLeftP = const_cast<char *>(mS.c_str()); // Too abusive of string()?
00062     mStr = mLeftP + mLeftBump;
00063     mRightP = mStr + mStorage;
00064 
00065     string padS(mStorage, pad);
00066     string textS(size, text);
00067 
00068     mS.replace(mLeftBump, mStorage, padS, 0, mStorage); // pad all first
00069     mS.replace(mLeftBump + mLeftPad, mSize, textS, 0, mSize);
00070 }


Member Function Documentation

bool SqlStringBuffer::verify (  ) 

Definition at line 74 of file SqlStringBuffer.cpp.

References mBumperChar, mLeftBump, mLeftPad, mRightBump, mRightPad, mS, mSize, and mTotal.

Referenced by SqlDateTest::testSqlDateToStr_Ascii(), SqlStringTest::testSqlStringAlterCase_Ascii(), SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), SqlStringTest::testSqlStringBuffer_UCS2(), SqlStringTest::testSqlStringCastFromApprox(), SqlStringTest::testSqlStringCastFromDecimal(), SqlStringTest::testSqlStringCastFromExact(), SqlStringTest::testSqlStringCastToApprox_Helper(), SqlStringTest::testSqlStringCastToChar(), SqlStringTest::testSqlStringCastToDecimal_Helper(), SqlStringTest::testSqlStringCastToExact_Helper(), SqlStringTest::testSqlStringCastToVarChar(), SqlStringAsciiTest::testSqlStringCat_Ascii_Fix(), SqlStringAsciiTest::testSqlStringCat_Ascii_Var(), SqlStringAsciiTest::testSqlStringCat_Ascii_Var2(), SqlStringTest::testSqlStringCat_Fix(), SqlStringTest::testSqlStringCat_Var(), SqlStringTest::testSqlStringCat_Var2(), SqlStringAsciiTest::testSqlStringCmp_Ascii_Fix_Helper(), SqlStringAsciiTest::testSqlStringCmp_Ascii_Var_Helper(), SqlStringTest::testSqlStringCmp_Bin_Helper(), SqlStringTest::testSqlStringCmp_Helper(), SqlStringTest::testSqlStringCpy_Fix(), SqlStringTest::testSqlStringCpy_Var(), SqlStringTest::testSqlStringOverlay(), SqlStringAsciiTest::testSqlStringOverlay_Ascii(), SqlStringTest::testSqlStringSubStr(), SqlStringAsciiTest::testSqlStringSubStr_Ascii(), SqlStringAsciiTest::testSqlStringToLower_Ascii(), SqlStringAsciiTest::testSqlStringToUpper_Ascii(), SqlStringAsciiTest::testSqlStringTrim_Ascii(), SqlStringTest::testSqlStringTrim_Helper(), and SqlDateTest::testSqlTimeToStr_Ascii().

00075 {
00076     string verS(mTotal, mBumperChar);
00077     if (mS.compare(0, mLeftBump, verS, 0, mLeftBump)) {
00078         return false;
00079     }
00080     if (mS.compare(
00081         mLeftBump + mLeftPad + mSize + mRightPad,
00082         mRightBump, verS, 0, mRightBump))
00083     {
00084         return false;
00085     }
00086     return true;
00087 }

void SqlStringBuffer::randomize ( uint  start = 'A',
uint  lower = ' ',
uint  upper = '~' 
)

Definition at line 90 of file SqlStringBuffer.cpp.

References mLeftBump, mLeftPad, mS, mSize, mStr, and patternfill().

Referenced by SqlStringTest::testSqlStringAlterCase_Case(), SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), SqlStringTest::testSqlStringCmp(), SqlStringAsciiTest::testSqlStringCmp_Ascii_Fix_EqLen(), SqlStringAsciiTest::testSqlStringCmp_Ascii_Var_EqLen(), SqlStringTest::testSqlStringCmp_Bin(), SqlStringTest::testSqlStringSubStr(), SqlStringAsciiTest::testSqlStringSubStr_Ascii(), SqlStringAsciiTest::testSqlStringToLower_Ascii(), and SqlStringAsciiTest::testSqlStringToUpper_Ascii().

00094 {
00095     patternfill(start, lower, upper);
00096     string r(mStr, mSize);
00097     random_shuffle(r.begin(), r.end());
00098     mS.replace(mLeftBump + mLeftPad, mSize, r);
00099 }

void SqlStringBuffer::patternfill ( uint  start = 'A',
uint  lower = ' ',
uint  upper = '~' 
)

Definition at line 102 of file SqlStringBuffer.cpp.

References mLeftBump, mLeftPad, mS, and mSize.

Referenced by randomize(), SqlStringTest::testSqlStringCmp(), SqlStringAsciiTest::testSqlStringCmp_Ascii_Fix_DiffLen(), SqlStringAsciiTest::testSqlStringCmp_Ascii_Var_DiffLen(), SqlStringTest::testSqlStringOverlay(), and SqlStringAsciiTest::testSqlStringOverlay_Ascii().

00106 {
00107     uint c = start; // deal with overflow easier than char
00108     int toGen = mSize;
00109 
00110     string r;
00111 
00112     while (toGen) {
00113         r.push_back(static_cast<unsigned char>(c));
00114         toGen--;
00115         if (++c > upper) {
00116             c = lower;
00117         }
00118     }
00119     mS.replace(mLeftBump + mLeftPad, mSize, r);
00120 }


Member Data Documentation

const uint SqlStringBuffer::mBumperChar [static]

Definition at line 42 of file SqlStringBuffer.h.

Referenced by SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), SqlStringTest::testSqlStringBuffer_UCS2(), and verify().

const int SqlStringBuffer::mBumperLen [static]

Definition at line 43 of file SqlStringBuffer.h.

char* SqlStringBuffer::mStr

Definition at line 70 of file SqlStringBuffer.h.

Referenced by randomize(), SqlStringBuffer(), SqlStringBufferUCS2::SqlStringBufferUCS2(), SqlDateTest::testSqlDateToStr_Ascii(), SqlStringTest::testSqlStringAlterCase_Ascii(), SqlStringTest::testSqlStringAlterCase_Case(), SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), SqlStringTest::testSqlStringCastFromApprox(), SqlStringTest::testSqlStringCastFromDecimal(), SqlStringTest::testSqlStringCastFromExact(), SqlStringTest::testSqlStringCastToApprox_Helper(), SqlStringTest::testSqlStringCastToChar(), SqlStringTest::testSqlStringCastToDecimal_Helper(), SqlStringTest::testSqlStringCastToExact_Helper(), SqlStringTest::testSqlStringCastToVarChar(), SqlStringAsciiTest::testSqlStringCat_Ascii_Fix(), SqlStringAsciiTest::testSqlStringCat_Ascii_Var(), SqlStringAsciiTest::testSqlStringCat_Ascii_Var2(), SqlStringTest::testSqlStringCat_Fix(), SqlStringTest::testSqlStringCat_Var(), SqlStringTest::testSqlStringCat_Var2(), SqlStringAsciiTest::testSqlStringCmp_Ascii_Fix_Helper(), SqlStringAsciiTest::testSqlStringCmp_Ascii_Var_Helper(), SqlStringTest::testSqlStringCmp_Bin(), SqlStringTest::testSqlStringCmp_Bin_Helper(), SqlStringTest::testSqlStringCmp_Helper(), SqlStringTest::testSqlStringCpy_Fix(), SqlStringTest::testSqlStringCpy_Var(), SqlStringTest::testSqlStringOverlay(), SqlStringAsciiTest::testSqlStringOverlay_Ascii(), SqlStringTest::testSqlStringPos(), SqlStringAsciiTest::testSqlStringPos_Ascii(), SqlStringTest::testSqlStringSubStr(), SqlStringAsciiTest::testSqlStringSubStr_Ascii(), SqlStringAsciiTest::testSqlStringToLower_Ascii(), SqlStringAsciiTest::testSqlStringToUpper_Ascii(), SqlStringAsciiTest::testSqlStringTrim_Ascii(), SqlStringTest::testSqlStringTrim_Helper(), and SqlDateTest::testSqlTimeToStr_Ascii().

char* SqlStringBuffer::mRightP

Definition at line 71 of file SqlStringBuffer.h.

Referenced by SqlStringBuffer(), SqlStringTest::testSqlStringBuffer_Ascii(), and SqlStringAsciiTest::testSqlStringBuffer_Ascii().

char* SqlStringBuffer::mLeftP

Definition at line 72 of file SqlStringBuffer.h.

Referenced by SqlStringBuffer(), SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), SqlStringTest::testSqlStringCastToApprox_Helper(), SqlStringTest::testSqlStringCastToChar(), SqlStringTest::testSqlStringCastToDecimal_Helper(), SqlStringTest::testSqlStringCastToExact_Helper(), SqlStringTest::testSqlStringCastToVarChar(), SqlStringTest::testSqlStringCpy_Fix(), SqlStringTest::testSqlStringSubStr(), and SqlStringAsciiTest::testSqlStringSubStr_Ascii().

const int SqlStringBuffer::mStorage

Definition at line 73 of file SqlStringBuffer.h.

Referenced by SqlStringBuffer(), SqlStringBufferUCS2::SqlStringBufferUCS2(), SqlStringTest::testSqlStringAlterCase_Ascii(), SqlStringTest::testSqlStringBuffer_Ascii(), and SqlStringAsciiTest::testSqlStringBuffer_Ascii().

const int SqlStringBuffer::mSize

Definition at line 74 of file SqlStringBuffer.h.

Referenced by patternfill(), randomize(), SqlStringBuffer(), SqlStringTest::testSqlStringAlterCase_Ascii(), SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), and verify().

const int SqlStringBuffer::mLeftPad

Definition at line 75 of file SqlStringBuffer.h.

Referenced by patternfill(), randomize(), SqlStringBuffer(), SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), and verify().

const int SqlStringBuffer::mRightPad

Definition at line 76 of file SqlStringBuffer.h.

Referenced by SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), and verify().

const int SqlStringBuffer::mLeftBump

Definition at line 77 of file SqlStringBuffer.h.

Referenced by patternfill(), randomize(), SqlStringBuffer(), and verify().

const int SqlStringBuffer::mRightBump

Definition at line 78 of file SqlStringBuffer.h.

Referenced by SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), and verify().

const int SqlStringBuffer::mTotal

Definition at line 79 of file SqlStringBuffer.h.

Referenced by verify().

string SqlStringBuffer::mS

Definition at line 80 of file SqlStringBuffer.h.

Referenced by patternfill(), randomize(), SqlStringBuffer(), SqlStringTest::testSqlStringBuffer_Ascii(), SqlStringAsciiTest::testSqlStringBuffer_Ascii(), and verify().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:47 2009 for Fennel by  doxygen 1.5.1