1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
//dllStrings.h
#if !defined(STRINGS_H)
#define STRINGS_H
#define EXPANSION_FACTOR 2
#define MINIMUM_ALLOCATION 16
class __declspec(dllexport) String
{
public:
String();
String(const TCHAR);
String(const TCHAR*);
String(const String&);
String(const int, bool);
String(const int, const TCHAR);
String(int);
#ifdef x64
String(size_t);
String(SSIZE_T);
#endif
String(unsigned int);
String(double);
String& operator=(const TCHAR);
String& operator=(const TCHAR*);
String& operator=(const String&);
String& operator=(int iNum);
#ifdef x64
String& operator=(size_t iNum);
String& operator=(SSIZE_T iNum);
#endif
String& operator=(unsigned int iNum);
String& operator=(double dblNum);
String operator+(const TCHAR);
String operator+(const TCHAR*);
String operator+(String&);
String& operator+=(const TCHAR ch); //Add TCHAR to this
String& operator+=(const String&); //Adds a String to this and assigns it to left of equal sign
String& operator+=(const TCHAR*); //Adds a TCHAR*to this and assigns it to left of equal sign
bool operator==(String&); //Compares Strings For Case Sensitive Equality
bool operator==(const TCHAR*); //Compares String Against TCHAR* For Case Sensitive Equality
bool operator!=(TCHAR*); //Compares String Against TCHAR* For Case Sensitive Inequality
TCHAR operator()(size_t iZeroBasedOffset); //Returns TCHAR At Zero Based Offset In this
String Allocate(size_t); //Allocates a String with a specified buffer size
String& Make(const TCHAR, size_t); //Returns reference to this with iCount ch TCHARs in it
String Left(size_t); //Returns String of iNum Left Most TTCHARs of this
String Right(size_t); //Returns String of iNum Right Most TTCHARs of this
String Mid(size_t, size_t); //Returns String consisting of number of TTCHARs from some offset
String Replace(TCHAR*, TCHAR*); //Returns String with 1st TCHAR* parameter replaced with 2nd TCHAR* parameter
String Remove(TCHAR*); //Returns A String With All The TCHARs In A TCHAR* Removed (Individual TCHAR removal)
String Remove(const TCHAR*, bool); //Returns a String with 1st parameter removed. 2nd is bool for case sensitivity.
String& Retain(TCHAR* pStr); //Eliminates From this Any Characters Not Found In pStr (individual character removal)
int InStr(const TCHAR*, bool blnCaseSensitive, bool blnStartLeft); //Returns one based case sensitive/insensitive offset of a particular TCHAR pStr in a String, starting from left or right (left=true)
int InStr(const String&, bool blnCaseSensitive, bool blnStartLeft); //Returns one based case sensitive/insensitive offset of where a particular String is in another String, starting from left or right (left=true)
int ParseCount(const TCHAR); //Returns count of Strings delimited by a TTCHAR passed as a parameter
void Parse(String*, TCHAR); //Returns array of Strings in first parameter as delimited by 2nd TTCHAR delimiter
void Format(double dblNumber, size_t iFldLen, size_t iDecPlaces); //Returns this by converting double to String with commas every three digits, in iFDldWidth and iDecimal places
void Format(double dblNum, int iFldWth, int iDecimal, bool blnRightJustified); //Modifies this By Converting double to String With int iFieldWidth, int iDecimal Places, and bool blnRightJustified Formatting
void Format(size_t iNum, int iFldLen, TCHAR cSeperator, bool blnRightJustified); //Modifies this By Converting size_t To cSeperator Delimited String R/L Justified Within iFldLen String. iFldLen Can Be Zero And Whole String Is Output In Field Large Enough To Contain It
void Format(SSIZE_T iNum, int iFldLen, TCHAR cSeperator, bool blnRightJustified); //Modifies this By Converting SSIZE_T To cSeperator Delimited String R/L Justified Within iFldLen String. iFldLen Can Be Zero And String Is Output
void Money(double dblNum, size_t iFldLen, size_t iOffsetDollarSign); //Inserts commas every 3 digits into iFldLen String and inserts '$' sign at one based iOffsetDollarSign
void Money(double dblNum, size_t iFldLen, bool blnDollarSign); //Inserts commas every 3 digits into iFldLen String and inserts '$' sign right in front of leftmost digit
void SetChar(size_t, TCHAR); //Sets TCHAR at zero based offset in this
void LTrim(); //Returns String with leading spaces/tabs removed
void RTrim(); //Returns String with spaces/tabs removed from end
void Trim(); //Returns String with both leading and trailing whitespace removed
int iVal(); //Returns integral value of String
int Len(); //Returns Length Of String Controlled By this
int Capacity(); //Returns Maximum Permissable TCHARacter Count (One Less Than Allocation).
TCHAR* lpStr(); //Returns TCHAR* To String
void Print(FILE*, bool); //Outputs String To Console With Or Without CrLf.
void Print(FILE*, TCHAR*, bool); //Outputs String To Console With Or Without CrLf.
void Print(TCHAR*, bool);
void Print(bool);
friend String operator+(TCHAR*, String&);
~String(); //String Destructor
private:
TCHAR* lpBuffer;
size_t iLen;
size_t iCapacity;
};
__declspec(dllexport) String operator+(TCHAR* lhs, String& rhs);
__declspec(dllexport) String Str(double dblNum);
#ifdef x64
String Str(int iNum);
String Str(unsigned int iNum);
String Str(SSIZE_T iNum);
String Str(size_t iNum);
#else
__declspec(dllexport) String Str(int iNum);
__declspec(dllexport) String Str(unsigned int iNum);
#endif
|