VR-Link API Documentation for HLA Evolved
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends

Instances of DtString are used to represent strings. More...

+ Inheritance diagram for DtString:
+ Collaboration diagram for DtString:

List of all members.

Public Member Functions

 DtString ()
 default constructor, creates an empty string
 DtString (const char *str)
 additional constructors
 DtString (const char *str, int length)
 fixed length string constructor
virtual ~DtString ()
 destructor
 DtString (const DtString &orig)
 copy constructor
virtual operator const char * () const
 cast operator
DtStringclone () const
 clone operator
virtual void tokenize (const char delimiter, std::vector< DtString > &tokens) const
 Tokenize the string baseed on the input character.
virtual int toInt (bool *ok=0) const
 Conversion to integer, if ok is provided ok is set if conversion succeeds.
virtual unsigned int toUInt (bool *ok=0) const
 Conversion to unsigned integer, if ok is provided ok is set if conversion succeeds.
virtual float toFloat (bool *ok=0) const
 Convert to floating point.
virtual double toDouble (bool *ok=0) const
 Convert to double precision floating point.
virtual bool toBoolean (bool *ok=0) const
 Convert to double precision floating point.
virtual void toUpper ()
 Convert this string's alphabetic characters to uppercase.
virtual void toLower ()
 Convert this string's alphabetic characters to lowercase.
virtual int findChar (const char ch)
 Search the string for first occurrence of a character and return its index.
virtual int findLastChar (const char ch)
 Search the string for the last occurrence of a character and return its index.
virtual int findString (const DtString &string) const
 Search the string for the first occurrence of another string and return the starting index.
virtual int findLastString (const DtString &string)
 Search the string for the last occurrence of another string and return the starting index.
bool snipFrontToLast (const char ch)
bool snipBackToFirst (const char ch)
virtual int count (const char ch) const
 Returns the number of occurrences of the character.
virtual int length () const
 length() - Exactly the same as size():
virtual int size () const
 size() - returns the length of the string not including the terminating '\0'
const char * string () const
 string() - Returns a char * representation of the DtString: deprecated
const char * c_str () const
 Returns a char* representation of the DtString;.
bool isEmpty () const
 returns true if the string is empty, where empty is size() == 0
 DtString (double val)
 Constructors for creating DtString representations of numbers.
 DtString (int val)
 Constructors for creating DtString representations of numbers.
 DtString (long val)
 Constructors for creating DtString representations of numbers.
 DtString (char val)
 Constructors for creating DtString representations of numbers.
 DtString (unsigned int val)
 Constructors for creating DtString representations of numbers.
 DtString (unsigned long val)
 Constructors for creating DtString representations of numbers.
DtStringoperator= (const DtString &orig)
 assignment operators
DtStringoperator= (const char *orig)
 assignment operators
virtual bool caseCompare (const DtString &str) const
 Case-insensitive string compare.
virtual bool caseCompare (const char *str) const
 Case-insensitive string compare.
virtual const char & operator[] (int index) const
 index operator
virtual char & operator[] (int index)
 index operator
virtual bool snipFront (const char ch, bool toLastCh=false)
 Truncates everything before or after the character, including the character, respectively.
virtual bool snipBack (const char ch, bool fromFirstCh=false)
 Truncates everything before or after the character, including the character, respectively.
virtual bool chompFront ()
 Remove all whitespace at front or back of a string.
virtual bool chompBack ()
 Remove all whitespace at front or back of a string.

Static Public Member Functions

static const DtStringnullString ()
 a Null representation of a string, which is the same as an empty string

Protected Types

enum  { theDefaultBufferSize = 64 }

Protected Member Functions

void clear ()
 Deletes the string, and sets the myString pointer to NULL.
void setString (const char *str)
 Set/Get for myString - char pointer that holds the string.

Protected Attributes

char myDefaultBuffer [theDefaultBufferSize]
char * myString
 Use this buffer if possible.
bool myStringAlloced
 &myDefaultBuffer[0], or a ptr to heap memory if needed
unsigned int myBufSize
 Does myString need to be deleted when done?

Static Protected Attributes

static const int theMaxInsertionStringSize
 current buffer size

Friends

std::ostream & operator<< (std::ostream &os, const DtString &str)
std::istream & operator>> (std::istream &is, DtString &str)
bool operator== (const DtString &str1, const DtString &str2)
 comparison operators
bool operator< (const DtString &str1, const DtString &str2)
 comparison operators
bool operator<= (const DtString &str1, const DtString &str2)
 comparison operators
bool operator> (const DtString &str1, const DtString &str2)
 comparison operators
bool operator>= (const DtString &str1, const DtString &str2)
 comparison operators
bool operator!= (const DtString &str1, const DtString &str2)
 comparison operators
virtual bool operator== (const char *str) const
 comparison operators
virtual bool operator< (const char *str) const
 comparison operators
virtual bool operator<= (const char *str) const
 comparison operators
virtual bool operator> (const char *str) const
 comparison operators
virtual bool operator>= (const char *str) const
 comparison operators
virtual bool operator!= (const char *str) const
 comparison operators
DtString operator+ (const DtString &str1, const DtString &str2)
 concatenation operators
DtString operator+ (const char *str1, const DtString &str2)
 concatenation operators
virtual DtString operator+ (const char *str) const
 concatenation operators
virtual DtStringoperator+= (const char *str)
 concatenation operators
virtual DtStringoperator+= (const DtString &str)
 concatenation operators

Detailed Description

Instances of DtString are used to represent strings.

DtString is a robust string implementation which allows the developer to easily manipulate strings quickly.


Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
theDefaultBufferSize 

Constructor & Destructor Documentation

default constructor, creates an empty string

DtString::DtString ( const char *  str)

additional constructors

DtString::DtString ( const char *  str,
int  length 
)

fixed length string constructor

DtString::DtString ( double  val)

Constructors for creating DtString representations of numbers.

For example, These constructors allow you to write statements such as DtString msg = DtString("The value is ") + DtString(5) + DtString("\n"); Above, msg.string() is "The value is 5\n";

DtString::DtString ( int  val)

Constructors for creating DtString representations of numbers.

For example, These constructors allow you to write statements such as DtString msg = DtString("The value is ") + DtString(5) + DtString("\n"); Above, msg.string() is "The value is 5\n";

DtString::DtString ( long  val)

Constructors for creating DtString representations of numbers.

For example, These constructors allow you to write statements such as DtString msg = DtString("The value is ") + DtString(5) + DtString("\n"); Above, msg.string() is "The value is 5\n";

DtString::DtString ( char  val)

Constructors for creating DtString representations of numbers.

For example, These constructors allow you to write statements such as DtString msg = DtString("The value is ") + DtString(5) + DtString("\n"); Above, msg.string() is "The value is 5\n";

DtString::DtString ( unsigned int  val)

Constructors for creating DtString representations of numbers.

For example, These constructors allow you to write statements such as DtString msg = DtString("The value is ") + DtString(5) + DtString("\n"); Above, msg.string() is "The value is 5\n";

DtString::DtString ( unsigned long  val)

Constructors for creating DtString representations of numbers.

For example, These constructors allow you to write statements such as DtString msg = DtString("The value is ") + DtString(5) + DtString("\n"); Above, msg.string() is "The value is 5\n";

virtual DtString::~DtString ( ) [virtual]

destructor

DtString::DtString ( const DtString orig)

copy constructor


Member Function Documentation

const char* DtString::c_str ( ) const
virtual bool DtString::caseCompare ( const DtString str) const [virtual]

Case-insensitive string compare.

Returns true if the strings are equal except for differences in case.

virtual bool DtString::caseCompare ( const char *  str) const [virtual]

Case-insensitive string compare.

Returns true if the strings are equal except for differences in case.

virtual bool DtString::chompBack ( ) [virtual]

Remove all whitespace at front or back of a string.

virtual bool DtString::chompFront ( ) [virtual]

Remove all whitespace at front or back of a string.

void DtString::clear ( ) [protected]

Deletes the string, and sets the myString pointer to NULL.

Non-virtual, because only called by destructor, and non-virtual members. myString is set to NULL, so it should be allocated some memory if operators are to be used on the string.

clone operator

virtual int DtString::count ( const char  ch) const [virtual]

Returns the number of occurrences of the character.

virtual int DtString::findChar ( const char  ch) [virtual]

Search the string for first occurrence of a character and return its index.

Return values:
-1if the character was not found.
virtual int DtString::findLastChar ( const char  ch) [virtual]

Search the string for the last occurrence of a character and return its index.

Return values:
-1if the character was not found.
virtual int DtString::findLastString ( const DtString string) [virtual]

Search the string for the last occurrence of another string and return the starting index.

Return values:
-1if the character was not found.
virtual int DtString::findString ( const DtString string) const [virtual]

Search the string for the first occurrence of another string and return the starting index.

Return values:
-1if the character was not found.
bool DtString::isEmpty ( ) const [inline]

returns true if the string is empty, where empty is size() == 0

virtual int DtString::length ( ) const [virtual]

length() - Exactly the same as size():

Deprecated:
Use DtString::size()
static const DtString& DtString::nullString ( ) [static]

a Null representation of a string, which is the same as an empty string

virtual DtString::operator const char * ( ) const [virtual]

cast operator

virtual bool DtString::operator!= ( const char *  str) const [virtual]

comparison operators

virtual DtString DtString::operator+ ( const char *  str) const [virtual]

concatenation operators

virtual DtString& DtString::operator+= ( const char *  str) [virtual]

concatenation operators

virtual DtString& DtString::operator+= ( const DtString str) [virtual]

concatenation operators

virtual bool DtString::operator< ( const char *  str) const [virtual]

comparison operators

virtual bool DtString::operator<= ( const char *  str) const [virtual]

comparison operators

DtString& DtString::operator= ( const DtString orig)

assignment operators

Reimplemented in DtFilename.

DtString& DtString::operator= ( const char *  orig)

assignment operators

Reimplemented in DtFilename.

virtual bool DtString::operator== ( const char *  str) const [virtual]

comparison operators

virtual bool DtString::operator> ( const char *  str) const [virtual]

comparison operators

virtual bool DtString::operator>= ( const char *  str) const [virtual]

comparison operators

virtual const char& DtString::operator[] ( int  index) const [virtual]

index operator

virtual char& DtString::operator[] ( int  index) [virtual]

index operator

void DtString::setString ( const char *  str) [protected]

Set/Get for myString - char pointer that holds the string.

Non-virtual, because only called by constructor.

virtual int DtString::size ( ) const [virtual]

size() - returns the length of the string not including the terminating '\0'

Referenced by DtF18EntityEncoder::encodeSpecialF18Attribute().

virtual bool DtString::snipBack ( const char  ch,
bool  fromFirstCh = false 
) [virtual]

Truncates everything before or after the character, including the character, respectively.

Normally, snipFront stops at the first occurrence of "ch", and snipBack stops at the last occurrence of "ch". The second argument flags reverse this. Return value is true if "ch" was found in the string. Does not include the null terminator (only searches characters counted by size).

bool DtString::snipBackToFirst ( const char  ch) [inline]
virtual bool DtString::snipFront ( const char  ch,
bool  toLastCh = false 
) [virtual]

Truncates everything before or after the character, including the character, respectively.

Normally, snipFront stops at the first occurrence of "ch", and snipBack stops at the last occurrence of "ch". The second argument flags reverse this. Return value is true if "ch" was found in the string. Does not include the null terminator (only searches characters counted by size).

bool DtString::snipFrontToLast ( const char  ch) [inline]
const char* DtString::string ( ) const

string() - Returns a char * representation of the DtString: deprecated

Deprecated:
Use DtString::c_str().
virtual bool DtString::toBoolean ( bool *  ok = 0) const [virtual]

Convert to double precision floating point.

If ok is provided ok is set if conversion succeeds.

Return values:
0if unable to convert.
virtual double DtString::toDouble ( bool *  ok = 0) const [virtual]

Convert to double precision floating point.

If ok is provided ok is set if conversion succeeds.

Return values:
0if unable to convert.
virtual float DtString::toFloat ( bool *  ok = 0) const [virtual]

Convert to floating point.

If ok is provided ok is set if conversion succeeds.

Return values:
0if unable to convert.
virtual int DtString::toInt ( bool *  ok = 0) const [virtual]

Conversion to integer, if ok is provided ok is set if conversion succeeds.

Return values:
0if unable to convert.
virtual void DtString::tokenize ( const char  delimiter,
std::vector< DtString > &  tokens 
) const [virtual]

Tokenize the string baseed on the input character.

Disregards trailing delimiter.

virtual void DtString::toLower ( ) [virtual]

Convert this string's alphabetic characters to lowercase.

Referenced by DtToLower().

virtual unsigned int DtString::toUInt ( bool *  ok = 0) const [virtual]

Conversion to unsigned integer, if ok is provided ok is set if conversion succeeds.

Return values:
0if unable to convert.
virtual void DtString::toUpper ( ) [virtual]

Convert this string's alphabetic characters to uppercase.

Referenced by DtToUpper().


Friends And Related Function Documentation

bool operator!= ( const DtString str1,
const DtString str2 
) [friend]

comparison operators

DtString operator+ ( const DtString str1,
const DtString str2 
) [friend]

concatenation operators

DtString operator+ ( const char *  str1,
const DtString str2 
) [friend]

concatenation operators

bool operator< ( const DtString str1,
const DtString str2 
) [friend]

comparison operators

std::ostream& operator<< ( std::ostream &  os,
const DtString str 
) [friend]
bool operator<= ( const DtString str1,
const DtString str2 
) [friend]

comparison operators

bool operator== ( const DtString str1,
const DtString str2 
) [friend]

comparison operators

bool operator> ( const DtString str1,
const DtString str2 
) [friend]

comparison operators

bool operator>= ( const DtString str1,
const DtString str2 
) [friend]

comparison operators

std::istream& operator>> ( std::istream &  is,
DtString str 
) [friend]

Member Data Documentation

unsigned int DtString::myBufSize [protected]

Does myString need to be deleted when done?

char* DtString::myString [protected]

Use this buffer if possible.

bool DtString::myStringAlloced [protected]

&myDefaultBuffer[0], or a ptr to heap memory if needed

(for large strings)

const int DtString::theMaxInsertionStringSize [static, protected]

current buffer size


The documentation for this class was generated from the following file:

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)