OFString Class Reference

a simple string class that implements a subset of std::string. More...

List of all members.

Public Types

typedef size_t size_type
 type that is used for lengths and offsets
typedef char value_type
 type that is contained in this
typedef const char * iterator
 this typedef can be used to iterate over an string.
typedef iterator const_iterator
 this is just an alias for iterator since iterator is already "const"

Public Member Functions

 OFString ()
 Default constructor.
 OFString (const OFString &str, size_t pos=0, size_t n=OFString_npos)
 Constructs a string from the given input string str.
 OFString (const char *s, size_t n)
 This constructor copies n characters starting at s, and constructs a string object initialized with the corresponding characters.
 OFString (const char *s)
 Constructs a string object from the array pointed to by the input pointer s.
 OFString (size_t rep, char c)
 Constructs a string object with the character c repeated rep times.
 ~OFString ()
 destructor
OFStringoperator= (const OFString &rhs)
 assigns the input string to the current string.
OFStringoperator= (const char *s)
 constructs a temporary string from the input s and assigns it to the current string.
OFStringoperator= (char s)
 constructs a temporary string from the input s and assigns it to the current string.
OFStringoperator+= (const OFString &rhs)
 Appends the input string to the current string.
OFStringoperator+= (const char *s)
 constructs a temporary string from the input s and appends it to the current string.
OFStringoperator+= (char s)
 constructs a temporary string from the input s and appends it to the current string.
OFStringappend (const OFString &str, size_t pos=0, size_t n=OFString_npos)
 Appends characters from the input string str to the current string object.
OFStringappend (const char *s, size_t n)
 constructs a temporary string from the input and appends it to the current string.
OFStringappend (const char *s)
 constructs a temporary string from the input and appends it to the current string.
OFStringappend (size_t rep, char c)
 constructs a temporary string from the input and appends it to the current string.
OFStringassign (const OFString &str, size_t pos, size_t n)
 Assigns characters from the input string str to the current string object.
OFStringassign (const OFString &str)
 Assigns input string str to the current string object.
OFStringassign (const char *s, size_t n)
 constructs a temporary string from the input and assigns it to the current string.
OFStringassign (const char *s)
 constructs a temporary string from the input and assigns it to the current string.
OFStringassign (size_t rep, char c)
 constructs a temporary string from the input and assigns it to the current string.
OFStringinsert (size_t pos1, const OFString &str, size_t pos2=0, size_t n=OFString_npos)
 Inserts at most n characters, starting at position pos2 of the input string str, into the current string.
OFStringinsert (size_t pos, const char *s, size_t n)
 constructs a temporary string from the input and inserts it into the current string.
OFStringinsert (size_t pos, const char *s)
 constructs a temporary string from the input and inserts it into the current string.
OFStringinsert (size_t pos, size_t rep, char c)
 constructs a temporary string from the input and inserts it into the current string.
OFStringerase (size_t pos=0, size_t n=OFString_npos)
 Removes up to n characters from the string starting from position pos.
OFStringreplace (size_t pos1, size_t n1, const OFString &str, size_t pos2=0, size_t n2=OFString_npos)
 replaces a range of characters in the current string with a range of characters taken from the input string str.
OFStringreplace (size_t pos, size_t n, const char *s, size_t n2)
 constructs a temporary string from the input and replaces the range [pos, n] in the current string with the constructed string.
OFStringreplace (size_t pos, size_t n, const char *s)
 constructs a temporary string from the input and replaces the range [pos, n] in the current string with the constructed string.
OFStringreplace (size_t pos, size_t n, size_t rep, char s)
 constructs a temporary string from the input and replaces the range [pos, n] in the current string with the constructed string.
const char & at (size_t pos) const
 returns a constant reference to the character at position pos of the current string.
char & at (size_t pos)
 returns a non-const reference to the character at position pos of the current string.
char operator[] (size_t pos) const
 returns the element at position pos of the current string.
char & operator[] (size_t pos)
 returns the element at position pos of the current string.
const char * c_str () const
 returns a pointer to the initial element of an array of length size()+1 whose first size() elements equal the corresponding elements of the current string and whose last element is a null character.
const char * data () const
 if size() is nonzero, this function returns a pointer to the initial element of an array whose first size() elements equal the corresponding elements of the string controlled by *this.
size_t size () const
 returns a count of the number of char-like objects currently in the string.
size_t length () const
 returns a count of the number of char-like objects currently in the string.
OFBool empty () const
 return true if the string is empty, false otherwise.
void resize (size_t n, char c= '\0')
 if n <= size(), truncates the string to length n else it pads the extra locations with c.
size_t capacity () const
 returns the size of the allocated storage in the string.
size_t max_size () const
 returns the maximum size of a string which could possibly by allocated.
void clear ()
 empty the string of all contents
void reserve (size_t res_arg)
 directive that informs a string of a planned change in size, so that it can manage the storage allocation accordingly.
size_t copy (char *s, size_t n, size_t pos=0) const
 replaces the string designated by s with a copy of a range of characters from the current string.
OFString substr (size_t pos=0, size_t n=OFString_npos) const
 returns a copy the substring consisting of at most n characters starting at position pos of the current string.
void swap (OFString &s)
 swaps the contents of the two strings.
int compare (const OFString &str) const
 determines the effective length rlen of the strings to compare as the smallest of size() and str.size().
int compare (size_t pos1, size_t n1, const OFString &str) const
 constructs a temporary string from this object and compares it with the input string
int compare (size_t pos1, size_t n1, const OFString &str, size_t pos2, size_t n2) const
 constructs a temporary string from this object and another temporary from the input and compares the two temporaries
int compare (const char *s) const
 constructs a temporary string from the input and compares it with the current string
int compare (size_t pos1, size_t n1, const char *s, size_t n2=OFString_npos) const
 constructs a temporary string from this object and another temporary from the input and compares the two temporaries
size_t find (const OFString &pattern, size_t pos=0) const
 determines the earliest occurrence of the input pattern in the current string object, starting from position pos in the current string.
size_t find (const char *pattern, size_t pos, size_t n) const
 creates a pattern string from the input and determines the earliest occurrence of the pattern in the current string object, starting from position pos in the current string.
size_t find (const char *pattern, size_t pos=0) const
 creates a pattern string from the input and determines the earliest occurrence of the pattern in the current string object, starting from position pos in the current string.
size_t find (char pattern, size_t pos=0) const
 creates a pattern string from the input and determines the earliest occurrence of the pattern in the current string object, starting from position pos in the current string.
size_t rfind (const OFString &pattern, size_t pos=OFString_npos) const
 scans the current string backwards, and finds the first occurrence of pattern in the string (from the back).
size_t rfind (const char *pattern, size_t pos, size_t n) const
 scans the current string backwards, and finds the first occurrence of pattern in the string (from the back).
size_t rfind (const char *pattern, size_t pos=OFString_npos) const
 scans the current string backwards, and finds the first occurrence of pattern in the string (from the back).
size_t rfind (char pattern, size_t pos=OFString_npos) const
 scans the current string backwards, and finds the first occurrence of pattern in the string (from the back).
size_t find_first_of (const OFString &str, size_t pos=0) const
 determines the first location, loc, between pos and the end of the current string, such that the character at loc matches at least one character from the set of characters.
size_t find_first_of (const char *s, size_t pos, size_t n) const
 determines the first location, loc, between pos and the end of the current string, such that the character at loc matches at least one character from the set of characters.
size_t find_first_of (const char *s, size_t pos=0) const
 determines the first location, loc, between pos and the end of the current string, such that the character at loc matches at least one character from the set of characters.
size_t find_first_of (char s, size_t pos=0) const
 determines the first location, loc, between pos and the end of the current string, such that the character at loc matches the given character.
size_t find_last_of (const OFString &str, size_t pos=OFString_npos) const
 determines the highest location, loc, up to pos, such that the character at loc matches at least one character from the set of characters.
size_t find_last_of (const char *s, size_t pos, size_t n) const
 determines the highest location, loc, up to pos, such that the character at loc matches at least one character from the set of characters.
size_t find_last_of (const char *s, size_t pos=OFString_npos) const
 determines the highest location, loc, up to pos, such that the character at loc matches at least one character from the set of characters.
size_t find_last_of (char s, size_t pos=OFString_npos) const
 determines the highest location, loc, up to pos, such that the character at loc matches the given character.
size_t find_first_not_of (const OFString &str, size_t pos=0) const
 determines the first location loc, between pos and the end of the current string, such that the character at loc does not match any character from the set of characters.
size_t find_first_not_of (const char *s, size_t pos, size_t n) const
 determines the first location loc, between pos and the end of the current string, such that the character at loc does not match any character from the set of characters.
size_t find_first_not_of (const char *s, size_t pos=0) const
 determines the first location loc, between pos and the end of the current string, such that the character at loc does not match any character from the set of characters.
size_t find_first_not_of (char c, size_t pos=0) const
 determines the first location loc, between pos and the end of the current string, such that the character at loc does not match the given character.
size_t find_last_not_of (const OFString &str, size_t pos=OFString_npos) const
 scans the current string up to the position pos and determines the highest location, loc, such that the character at loc does not match any character from the set of characters.
size_t find_last_not_of (const char *s, size_t pos, size_t n) const
 scans the current string up to the position pos and determines the highest location, loc, such that the character at loc does not match any character from the set of characters.
size_t find_last_not_of (const char *s, size_t pos=OFString_npos) const
 scans the current string up to the position pos and determines the highest location, loc, such that the character at loc does not match any character from the set of characters.
size_t find_last_not_of (char c, size_t pos=OFString_npos) const
 scans the current string up to the position pos and determines the highest location, loc, such that the character at loc does not match the given character.
iterator begin () const
 returns a constant iterator that points to the beginning of the string
iterator end () const
 returns a constant iterator that points after the last element of the string

Private Attributes

char * theCString
 the "C" string pointer
size_t theSize
 the length of theCString
size_t theCapacity
 the capacity of str


Detailed Description

a simple string class that implements a subset of std::string.

It does not implement iterators or traits and is not optimized for speed.

Definition at line 86 of file ofstring.h.


Member Typedef Documentation

typedef const char* OFString::iterator

this typedef can be used to iterate over an string.

Note: Normally you are allowed to modify items through an iterator, we do not allow this!

Definition at line 818 of file ofstring.h.


Constructor & Destructor Documentation

OFString::OFString (  ) 

Default constructor.

Constructs an empty string.

OFString::OFString ( const OFString str,
size_t  pos = 0,
size_t  n = OFString_npos 
)

Constructs a string from the given input string str.

The effective length rlen of the constructed string is the smaller of n and str.size() - pos, and the string is constructed by copying rlen characters starting at position pos of the input string str. The function throws an out-of-range error if pos > str.size().

Parameters:
str string to copy from
pos position to start copying from
n maximum number of characters to copy

OFString::OFString ( const char *  s,
size_t  n 
)

This constructor copies n characters starting at s, and constructs a string object initialized with the corresponding characters.

NOTE: If n > length(s), then junk characters are appended to the end of the string. i.e. n characters are copied regardless of the exact length of the array pointed to by the input pointer s.

Parameters:
s pointer to an array of char of length n. Must not be NULL.
n number of characters in array

OFString::OFString ( const char *  s  ) 

Constructs a string object from the array pointed to by the input pointer s.

It is assumed that s is not a null pointer.

Parameters:
s pointer to a zero-terminated C string. Must not be NULL.

OFString::OFString ( size_t  rep,
char  c 
)

Constructs a string object with the character c repeated rep times.

Reports a length error if rep equals npos.

Parameters:
rep number of repetitions
c character to construct from


Member Function Documentation

OFString& OFString::operator= ( const OFString rhs  ) 

assigns the input string to the current string.

Parameters:
rhs string to copy from
Returns:
reference to this object

OFString& OFString::operator= ( const char *  s  ) 

constructs a temporary string from the input s and assigns it to the current string.

Parameters:
s pointer to a zero-terminated C string. Must not be NULL.
Returns:
reference to this object

OFString& OFString::operator= ( char  s  ) 

constructs a temporary string from the input s and assigns it to the current string.

Parameters:
s character
Returns:
reference to this object

OFString& OFString::operator+= ( const OFString rhs  ) 

Appends the input string to the current string.

Parameters:
rhs string to append from
Returns:
reference to this object

OFString& OFString::operator+= ( const char *  s  ) 

constructs a temporary string from the input s and appends it to the current string.

Parameters:
s pointer to a zero-terminated C string. Must not be NULL.
Returns:
reference to this object

OFString& OFString::operator+= ( char  s  ) 

constructs a temporary string from the input s and appends it to the current string.

Parameters:
s character
Returns:
reference to this object

OFString& OFString::append ( const OFString str,
size_t  pos = 0,
size_t  n = OFString_npos 
)

Appends characters from the input string str to the current string object.

At most n characters, starting at position pos of str, are appended. The function reports an out-of-range error if pos > str.size().

Parameters:
str string to append from
pos position to start copying from
n maximum number of characters to copy
Returns:
reference to this object

OFString& OFString::append ( const char *  s,
size_t  n 
)

constructs a temporary string from the input and appends it to the current string.

Parameters:
s pointer to an array of char of length n. Must not be NULL.
n number of characters in array
Returns:
reference to this object

OFString& OFString::append ( const char *  s  ) 

constructs a temporary string from the input and appends it to the current string.

Parameters:
s pointer to a zero-terminated C string. Must not be NULL.
Returns:
reference to this object

OFString& OFString::append ( size_t  rep,
char  c 
)

constructs a temporary string from the input and appends it to the current string.

Parameters:
rep number of repetitions
c character to construct from
Returns:
reference to this object

OFString& OFString::assign ( const OFString str,
size_t  pos,
size_t  n 
)

Assigns characters from the input string str to the current string object.

At most n characters, starting at position pos of str, are appended. The function reports an out-of-range error if pos > str.size().

Parameters:
str string to append from
pos position to start copying from
n maximum number of characters to copy, can be OFString_npos
Returns:
reference to this object

OFString& OFString::assign ( const OFString str  ) 

Assigns input string str to the current string object.

Parameters:
str string to copy
Returns:
reference to this object

OFString& OFString::assign ( const char *  s,
size_t  n 
)

constructs a temporary string from the input and assigns it to the current string.

Parameters:
s pointer to an array of char of length n. Must not be NULL.
n number of characters in array
Returns:
reference to this object

OFString& OFString::assign ( const char *  s  ) 

constructs a temporary string from the input and assigns it to the current string.

Parameters:
s pointer to a zero-terminated C string. Must not be NULL.
Returns:
reference to this object

OFString& OFString::assign ( size_t  rep,
char  c 
)

constructs a temporary string from the input and assigns it to the current string.

Parameters:
rep number of repetitions
c character to construct from
Returns:
reference to this object

OFString& OFString::insert ( size_t  pos1,
const OFString str,
size_t  pos2 = 0,
size_t  n = OFString_npos 
)

Inserts at most n characters, starting at position pos2 of the input string str, into the current string.

The characters are inserted starting at position pos1 in the current string. The function reports an out-of-range error if pos > str.size().

Parameters:
pos1 position to insert at
str string to copy from
pos2 position to start copying from
n maximum number of characters to copy
Returns:
reference to this object

OFString& OFString::insert ( size_t  pos,
const char *  s,
size_t  n 
)

constructs a temporary string from the input and inserts it into the current string.

Parameters:
pos position to insert at
s pointer to an array of char of length n. Must not be NULL.
n number of characters in array
Returns:
reference to this object

OFString& OFString::insert ( size_t  pos,
const char *  s 
)

constructs a temporary string from the input and inserts it into the current string.

Parameters:
pos position to insert at
s pointer to a zero-terminated C string. Must not be NULL.
Returns:
reference to this object

OFString& OFString::insert ( size_t  pos,
size_t  rep,
char  c 
)

constructs a temporary string from the input and inserts it into the current string.

Parameters:
pos position to insert at
rep number of repetitions
c character to construct from
Returns:
reference to this object

OFString& OFString::erase ( size_t  pos = 0,
size_t  n = OFString_npos 
)

Removes up to n characters from the string starting from position pos.

Parameters:
pos position to start from
n number of characters to remove
Returns:
reference to this object

Referenced by clear().

OFString& OFString::replace ( size_t  pos1,
size_t  n1,
const OFString str,
size_t  pos2 = 0,
size_t  n2 = OFString_npos 
)

replaces a range of characters in the current string with a range of characters taken from the input string str.

The range to be replaced starts at position pos1 in the current string, and extends for n1 characters, or up to the end of the string, whichever comes first. The range of characters inserted starts at position pos2 of the input string str, and extends for n2 characters, or up to the end of the string str, whichever comes first.

Parameters:
pos1 position to insert at
n1 number of characters to replace
str string to copy from
pos2 position to start copying from
n2 maximum number of characters to copy
Returns:
reference to this object

OFString& OFString::replace ( size_t  pos,
size_t  n,
const char *  s,
size_t  n2 
)

constructs a temporary string from the input and replaces the range [pos, n] in the current string with the constructed string.

Parameters:
pos position to replace at
n number of characters to be replaced
s pointer to an array of char of length n. Must not be NULL.
n2 number of characters in array
Returns:
reference to this object

OFString& OFString::replace ( size_t  pos,
size_t  n,
const char *  s 
)

constructs a temporary string from the input and replaces the range [pos, n] in the current string with the constructed string.

Parameters:
pos position to replace at
n number of characters to be replaced
s pointer to a zero-terminated C string. Must not be NULL.
Returns:
reference to this object

OFString& OFString::replace ( size_t  pos,
size_t  n,
size_t  rep,
char  s 
)

constructs a temporary string from the input and replaces the range [pos, n] in the current string with the constructed string.

Parameters:
pos position to replace at
n number of characters to be replaced
rep number of repetitions
s character to construct from
Returns:
reference to this object

const char& OFString::at ( size_t  pos  )  const [inline]

returns a constant reference to the character at position pos of the current string.

if pos >= size(), throws out_of_range exception.

Parameters:
pos position in string
Returns:
const reference to character in string at pos

Definition at line 342 of file ofstring.h.

References theCString.

char& OFString::at ( size_t  pos  )  [inline]

returns a non-const reference to the character at position pos of the current string.

if pos >= size(), throws out_of_range exception.

Parameters:
pos position in string
Returns:
non-const reference to character in string at pos

Definition at line 354 of file ofstring.h.

References theCString.

char OFString::operator[] ( size_t  pos  )  const [inline]

returns the element at position pos of the current string.

Returns '\0' if pos == size().

Parameters:
pos position in string
Returns:
character in string at pos (by value)

Definition at line 365 of file ofstring.h.

References theCString.

char& OFString::operator[] ( size_t  pos  )  [inline]

returns the element at position pos of the current string.

The reference returned is invalid after a subsequent call to any non-const member function for the object.

Parameters:
pos position in string, must be < size().
Returns:
character in string at pos (by reference)

Definition at line 381 of file ofstring.h.

References theCString.

const char* OFString::c_str (  )  const [inline]

returns a pointer to the initial element of an array of length size()+1 whose first size() elements equal the corresponding elements of the current string and whose last element is a null character.

Returns:
C string for this string

Definition at line 392 of file ofstring.h.

References theCString.

Referenced by DcmUIDHandler::c_str(), DVInterface::getAnnotationText(), DVPSCurve::getCurveAxisUnitsX(), DVPSCurve::getCurveAxisUnitsY(), DVPSCurve::getCurveDescription(), DVPSCurve::getCurveLabel(), DiOverlayPlane::getDescription(), DiBaseLUT::getExplanation(), DVInstanceCache::getFilename(), OFConfigFileNode::getKeyword(), DiOverlayPlane::getLabel(), DiDocument::getPhotometricInterpretation(), DcmPresentationContextItem::getTransferSyntaxKey(), DVPSFilmSession::getUID(), OFConfigFileNode::getValue(), and DiMonoImage::getVoiTransformationExplanation().

const char* OFString::data (  )  const

if size() is nonzero, this function returns a pointer to the initial element of an array whose first size() elements equal the corresponding elements of the string controlled by *this.

If size() is zero, the member returns a non-null pointer that is copyable and can have zero added to it.

Returns:
pointer to char array for this string

size_t OFString::size (  )  const [inline]

returns a count of the number of char-like objects currently in the string.

Returns:
number of char-like objects currently in string

Definition at line 410 of file ofstring.h.

References theSize.

Referenced by length().

size_t OFString::length (  )  const [inline]

returns a count of the number of char-like objects currently in the string.

Returns:
number of char-like objects currently in string

Definition at line 419 of file ofstring.h.

References size().

Referenced by end().

OFBool OFString::empty ( void   )  const [inline]

return true if the string is empty, false otherwise.

Returns:
true if the string is empty, false otherwise.

Definition at line 427 of file ofstring.h.

Referenced by DiInputPixelTemplate< T1, T2 >::convert(), DiOverlayPlane::getDescription(), DiBaseLUT::getExplanation(), and DiOverlayPlane::getLabel().

void OFString::resize ( size_t  n,
char  c = '\0' 
)

if n <= size(), truncates the string to length n else it pads the extra locations with c.

Reports a length error if n equals OFString_npos.

Parameters:
n length to truncate string to
c character to pad extra locations with

size_t OFString::capacity (  )  const [inline]

returns the size of the allocated storage in the string.

Returns:
size of the allocated storage in the string

Definition at line 442 of file ofstring.h.

References theCapacity.

size_t OFString::max_size (  )  const [inline]

returns the maximum size of a string which could possibly by allocated.

Returns:
maximum size of a string which could possibly by allocated.

Definition at line 450 of file ofstring.h.

void OFString::reserve ( size_t  res_arg  ) 

directive that informs a string of a planned change in size, so that it can manage the storage allocation accordingly.

Reallocation of a string happens if and only if the current capacity is less than res_arg. After this call, capacity() is greater than or equal to res_arg if reallocation happens and equal to the previous value of capacity() otherwise.

Parameters:
res_arg string capacity to reserve

size_t OFString::copy ( char *  s,
size_t  n,
size_t  pos = 0 
) const

replaces the string designated by s with a copy of a range of characters from the current string.

The range copied begins at position pos of the current string and extends for n characters or up to the end of the current string, whichever comes first. Does not append a null object to the end of the string designated by s.

Parameters:
s character array to copy to
n size of character array
pos position in string to start copying from
Returns:
number of characters copied

OFString OFString::substr ( size_t  pos = 0,
size_t  n = OFString_npos 
) const

returns a copy the substring consisting of at most n characters starting at position pos of the current string.

Parameters:
pos position in string to start copying from
n number of characters to copy

void OFString::swap ( OFString s  ) 

swaps the contents of the two strings.

The time complexity of this function is linear.

Parameters:
s string to swap with

int OFString::compare ( const OFString str  )  const

determines the effective length rlen of the strings to compare as the smallest of size() and str.size().

The function then compares the two strings by calling strcmp(data(), str.data(), rlen). Returns: the nonzero result if the result of the comparison is nonzero. Otherwise, returns a value < 0 if size() < str.size(), a value of 0 if size() == str.size(), or a value > 0 if size() > str.size().

Parameters:
str string to compare to
Returns:
comparison result as described above

int OFString::compare ( size_t  pos1,
size_t  n1,
const OFString str 
) const

constructs a temporary string from this object and compares it with the input string

Parameters:
pos1 position to start copying from this object
n1 maximum number of characters to copy from this object
str string to compare to
Returns:
comparison result

int OFString::compare ( size_t  pos1,
size_t  n1,
const OFString str,
size_t  pos2,
size_t  n2 
) const

constructs a temporary string from this object and another temporary from the input and compares the two temporaries

Parameters:
pos1 position to start copying from this object
n1 maximum number of characters to copy from this object
str string to create second temporary from
pos2 position to start copying from in str
n2 maximum number of characters to copy from str
Returns:
comparison result

int OFString::compare ( const char *  s  )  const

constructs a temporary string from the input and compares it with the current string

Parameters:
s pointer to a zero-terminated C string. Must not be NULL.
Returns:
comparison result

int OFString::compare ( size_t  pos1,
size_t  n1,
const char *  s,
size_t  n2 = OFString_npos 
) const

constructs a temporary string from this object and another temporary from the input and compares the two temporaries

Parameters:
pos1 position to start copying from this object
n1 maximum number of characters to copy from this object
s pointer to an array of char of length n. Must not be NULL.
n2 number of characters in array s
Returns:
comparison result

size_t OFString::find ( const OFString pattern,
size_t  pos = 0 
) const

determines the earliest occurrence of the input pattern in the current string object, starting from position pos in the current string.

If find can determine such an occurrence, it returns the starting index of pattern in the current string. Otherwise, it returns string::npos.

Parameters:
pattern pattern to find
pos position to start searching from
Returns:
index of pattern as described above

size_t OFString::find ( const char *  pattern,
size_t  pos,
size_t  n 
) const

creates a pattern string from the input and determines the earliest occurrence of the pattern in the current string object, starting from position pos in the current string.

If find can determine such an occurrence, it returns the starting index of pattern in the current string. Otherwise, it returns string::npos.

Parameters:
pattern pointer to an array of char of length n. Must not be NULL.
pos position to start searching from
n number of characters in array
Returns:
index of pattern in string

size_t OFString::find ( const char *  pattern,
size_t  pos = 0 
) const

creates a pattern string from the input and determines the earliest occurrence of the pattern in the current string object, starting from position pos in the current string.

If find can determine such an occurrence, it returns the starting index of pattern in the current string. Otherwise, it returns string::npos.

Parameters:
pattern pointer to a zero-terminated C string. Must not be NULL.
pos position to start searching from
Returns:
index of pattern in string

size_t OFString::find ( char  pattern,
size_t  pos = 0 
) const

creates a pattern string from the input and determines the earliest occurrence of the pattern in the current string object, starting from position pos in the current string.

If find can determine such an occurrence, it returns the starting index of pattern in the current string. Otherwise, it returns string::npos.

Parameters:
pattern character
pos position to start searching from
Returns:
index of pattern in string

size_t OFString::rfind ( const OFString pattern,
size_t  pos = OFString_npos 
) const

scans the current string backwards, and finds the first occurrence of pattern in the string (from the back).

The starting index of the matched position in the current string should be less than or equal to the parameter pos. If a match is found, the starting index is returned; otherwise, the function returns string::npos.

Parameters:
pattern pattern to find
pos position to start searching from
Returns:
index of pattern as described above

size_t OFString::rfind ( const char *  pattern,
size_t  pos,
size_t  n 
) const

scans the current string backwards, and finds the first occurrence of pattern in the string (from the back).

The starting index of the matched position in the current string should be less than or equal to the parameter pos. If a match is found, the starting index is returned; otherwise, the function returns string::npos.

Parameters:
pattern pointer to an array of char of length n. Must not be NULL.
pos position to start searching from
n number of characters in array
Returns:
index of pattern in string

size_t OFString::rfind ( const char *  pattern,
size_t  pos = OFString_npos 
) const

scans the current string backwards, and finds the first occurrence of pattern in the string (from the back).

The starting index of the matched position in the current string should be less than or equal to the parameter pos. If a match is found, the starting index is returned; otherwise, the function returns string::npos.

Parameters:
pattern pointer to a zero-terminated C string. Must not be NULL.
pos position to start searching from
Returns:
index of pattern in string

size_t OFString::rfind ( char  pattern,
size_t  pos = OFString_npos 
) const

scans the current string backwards, and finds the first occurrence of pattern in the string (from the back).

The starting index of the matched position in the current string should be less than or equal to the parameter pos. If a match is found, the starting index is returned; otherwise, the function returns string::npos.

Parameters:
pattern character
pos position to start searching from
Returns:
index of pattern in string

size_t OFString::find_first_of ( const OFString str,
size_t  pos = 0 
) const

determines the first location, loc, between pos and the end of the current string, such that the character at loc matches at least one character from the set of characters.

If such a location can be determined, it is returned. Otherwise, the function returns string::npos.

Parameters:
str set of characters to find
pos position to start searching from
Returns:
index of character as described above

size_t OFString::find_first_of ( const char *  s,
size_t  pos,
size_t  n 
) const

determines the first location, loc, between pos and the end of the current string, such that the character at loc matches at least one character from the set of characters.

If such a location can be determined, it is returned. Otherwise, the function returns string::npos.

Parameters:
s set of characters to find, pointer to an array of char of length n. Must not be NULL.
pos position to start searching from
n number of characters in array
Returns:
index of pattern in string

size_t OFString::find_first_of ( const char *  s,
size_t  pos = 0 
) const

determines the first location, loc, between pos and the end of the current string, such that the character at loc matches at least one character from the set of characters.

If such a location can be determined, it is returned. Otherwise, the function returns string::npos.

Parameters:
s set of characters to find, pointer to a zero-terminated C string. Must not be NULL.
pos position to start searching from
Returns:
index of pattern in string

size_t OFString::find_first_of ( char  s,
size_t  pos = 0 
) const

determines the first location, loc, between pos and the end of the current string, such that the character at loc matches the given character.

If such a location can be determined, it is returned. Otherwise, the function returns string::npos.

Parameters:
s character to find
pos position to start searching from
Returns:
index of character

size_t OFString::find_last_of ( const OFString str,
size_t  pos = OFString_npos 
) const

determines the highest location, loc, up to pos, such that the character at loc matches at least one character from the set of characters.

If such a location can be determined, it is returned. Otherwise, the function returns string::npos.

Parameters:
str set of characters to find
pos position to start searching from
Returns:
index of character as described above

size_t OFString::find_last_of ( const char *  s,
size_t  pos,
size_t  n 
) const

determines the highest location, loc, up to pos, such that the character at loc matches at least one character from the set of characters.

If such a location can be determined, it is returned. Otherwise, the function returns string::npos.

Parameters:
s set of characters to find, pointer to an array of char of length n. Must not be NULL.
pos position to start searching from
n number of characters in array
Returns:
index of pattern in string

size_t OFString::find_last_of ( const char *  s,
size_t  pos = OFString_npos 
) const

determines the highest location, loc, up to pos, such that the character at loc matches at least one character from the set of characters.

If such a location can be determined, it is returned. Otherwise, the function returns string::npos.

Parameters:
s set of characters to find, pointer to a zero-terminated C string. Must not be NULL.
pos position to start searching from
Returns:
index of pattern in string

size_t OFString::find_last_of ( char  s,
size_t  pos = OFString_npos 
) const

determines the highest location, loc, up to pos, such that the character at loc matches the given character.

If such a location can be determined, it is returned. Otherwise, the function returns string::npos.

Parameters:
s character to find
pos position to start searching from
Returns:
index of character

size_t OFString::find_first_not_of ( const OFString str,
size_t  pos = 0 
) const

determines the first location loc, between pos and the end of the current string, such that the character at loc does not match any character from the set of characters.

If such a location is found, it is returned. Otherwise, the function returns string::npos.

Parameters:
str set of characters to find
pos position to start searching from
Returns:
index of character as described above

size_t OFString::find_first_not_of ( const char *  s,
size_t  pos,
size_t  n 
) const

determines the first location loc, between pos and the end of the current string, such that the character at loc does not match any character from the set of characters.

If such a location is found, it is returned. Otherwise, the function returns string::npos.

Parameters:
s set of characters to find, pointer to an array of char of length n. Must not be NULL.
pos position to start searching from
n number of characters in array
Returns:
index of pattern in string

size_t OFString::find_first_not_of ( const char *  s,
size_t  pos = 0 
) const

determines the first location loc, between pos and the end of the current string, such that the character at loc does not match any character from the set of characters.

If such a location is found, it is returned. Otherwise, the function returns string::npos.

Parameters:
s set of characters to find, pointer to a zero-terminated C string. Must not be NULL.
pos position to start searching from
Returns:
index of pattern in string

size_t OFString::find_first_not_of ( char  c,
size_t  pos = 0 
) const

determines the first location loc, between pos and the end of the current string, such that the character at loc does not match the given character.

If such a location is found, it is returned. Otherwise, the function returns string::npos.

Parameters:
c character to find
pos position to start searching from
Returns:
index of character

size_t OFString::find_last_not_of ( const OFString str,
size_t  pos = OFString_npos 
) const

scans the current string up to the position pos and determines the highest location, loc, such that the character at loc does not match any character from the set of characters.

If such a location is found, it is returned. Otherwise, the function returns string::npos.

Parameters:
str set of characters to find
pos position to start searching from
Returns:
index of character as described above

size_t OFString::find_last_not_of ( const char *  s,
size_t  pos,
size_t  n 
) const

scans the current string up to the position pos and determines the highest location, loc, such that the character at loc does not match any character from the set of characters.

If such a location is found, it is returned. Otherwise, the function returns string::npos.

Parameters:
s set of characters to find, pointer to an array of char of length n. Must not be NULL.
pos position to start searching from
n number of characters in array
Returns:
index of pattern in string

size_t OFString::find_last_not_of ( const char *  s,
size_t  pos = OFString_npos 
) const

scans the current string up to the position pos and determines the highest location, loc, such that the character at loc does not match any character from the set of characters.

If such a location is found, it is returned. Otherwise, the function returns string::npos.

Parameters:
s set of characters to find, pointer to a zero-terminated C string. Must not be NULL.
pos position to start searching from
Returns:
index of pattern in string

size_t OFString::find_last_not_of ( char  c,
size_t  pos = OFString_npos 
) const

scans the current string up to the position pos and determines the highest location, loc, such that the character at loc does not match the given character.

If such a location is found, it is returned. Otherwise, the function returns string::npos.

Parameters:
c character to find
pos position to start searching from
Returns:
index of character

iterator OFString::begin (  )  const [inline]

returns a constant iterator that points to the beginning of the string

Returns:
iterator to the beginning of the string

Definition at line 826 of file ofstring.h.

References theCString.

Referenced by end().

iterator OFString::end (  )  const [inline]

returns a constant iterator that points after the last element of the string

Returns:
iterator after the last element of the string

Definition at line 831 of file ofstring.h.

References begin(), and length().


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


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1