Rosetta 3.3
Public Types | Public Member Functions | Static Public Attributes | Friends
ObjexxFCL::Cstring Class Reference

Cstring: C String Wrapper. More...

#include <Cstring.hh>

Collaboration diagram for ObjexxFCL::Cstring:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::size_t size_type
typedef std::size_t Size

Public Member Functions

 Cstring ()
 Default Constructor.
 Cstring (Cstring const &s)
 Copy Constructor.
 Cstring (c_cstring const s)
 C string Constructor: Implicit Conversion.
 Cstring (std::string const &s)
 std::string Constructor
 Cstring (Cstring const &s, size_type const len)
 Cstring + Length Constructor.
 Cstring (c_cstring const s, size_type const len)
 C string + Length Constructor.
 Cstring (std::string const &s, size_type const len)
 std::string + Length Constructor
 Cstring (char const c)
 char Constructor
 Cstring (size_type const len)
 Length Constructor.
 Cstring (int const len)
 Length Constructor.
virtual ~Cstring ()
 Destructor.
 operator c_cstring () const
 C string Conversion: Invalid after str_ is reallocated.
 operator cstring ()
 C string Conversion: Invalid after str_ is reallocated.
Cstringoperator= (Cstring const &s)
 Copy Assignment.
Cstringoperator= (c_cstring const s)
 cstring Assignment
Cstringoperator= (std::string const &s)
 std::string Assignment
Cstringoperator= (char const c)
 char Assignment
Cstringoperator+= (Cstring const &s)
 Cstring Append.
Cstringoperator+= (c_cstring const s)
 cstring Append
Cstringoperator+= (std::string const &s)
 std::string Append
Cstringoperator+= (char const c)
 char Append
bool empty () const
 Empty?
bool is_blank () const
 Blank?
bool not_blank () const
 Not blank?
bool has_any_of (Cstring const &s) const
 Has Any Character of a Cstring?
bool has_any_of (c_cstring const s) const
 Has Any Character of a cstring?
bool has_any_of (std::string const s) const
 Has Any Character of a std::string?
bool has_any_of (char const c) const
 Has a Character?
bool has (char const c) const
 Has a Character?
size_type length () const
 Length.
size_type len () const
 Length.
size_type size () const
 Size.
size_type len_trim () const
 Length Space-Trimmed.
size_type len_trim_whitespace () const
 Length Whitespace-Trimmed.
size_type find (char const c) const
 Find First Occurrence of a Character.
size_type find_last (char const c) const
 Find Last Occurrence of a Character.
Cstringlowercase ()
 Lowercase.
Cstringuppercase ()
 Uppercase.
Cstringleft_justify ()
 Left Justify.
Cstringright_justify ()
 Right Justify.
Cstringtrim ()
 Trim Trailing Space.
Cstringtrim_whitespace ()
 Trim Trailing Whitespace.
Cstringcenter ()
 Center.
Cstringcompress ()
 Compress Out Whitespace.
void swap (Cstring &s)
 swap( Cstring )
char operator[] (size_type const i) const
 Cstring[ i ] const.
char & operator[] (size_type const i)
 Cstring[ i ].
char operator[] (int const i) const
 Cstring[ i ] const.
char & operator[] (int const i)
 Cstring[ i ].
Cstring lowercased () const
 Lowercased Copy.
Cstring uppercased () const
 Uppercased Copy.
Cstring left_justified () const
 Left-Justified Copy.
Cstring right_justified () const
 Right-Justified Copy.
Cstring trimmed () const
 Space-Trimmed Copy.
Cstring trimmed_whitespace () const
 Whitespace-Trimmed Copy.
Cstring centered () const
 Centered Copy.
Cstring compressed () const
 Compressed Copy.

Static Public Attributes

static size_type const npos = static_cast< size_type >( -1 )

Friends

void swap (Cstring &s, Cstring &t)
 swap( Cstring, Cstring )
Cstring operator+ (Cstring const &s, Cstring const &t)
 Cstring + Cstring.
Cstring operator+ (Cstring const &s, c_cstring const t)
 Cstring + cstring.
Cstring operator+ (c_cstring const s, Cstring const &t)
 cstring + Cstring
Cstring operator+ (Cstring const &s, std::string const &t)
 Cstring + std::string.
Cstring operator+ (Cstring const &s, char const c)
 Cstring + char.
Cstring operator+ (char const c, Cstring const &t)
 char + Cstring
bool operator== (Cstring const &s, Cstring const &t)
 Cstring == Cstring.
bool operator!= (Cstring const &s, Cstring const &t)
 Cstring != Cstring.
bool operator== (Cstring const &s, c_cstring const t)
 Cstring == cstring.
bool operator== (c_cstring const t, Cstring const &s)
 cstring == Cstring
bool operator!= (Cstring const &s, c_cstring const t)
 Cstring != cstring.
bool operator!= (c_cstring const t, Cstring const &s)
 cstring != Cstring
bool operator== (Cstring const &s, std::string const &t)
 Cstring == std::string.
bool operator== (std::string const &t, Cstring const &s)
 std::string == Cstring
bool operator!= (Cstring const &s, std::string const &t)
 Cstring != std::string.
bool operator!= (std::string const &t, Cstring const &s)
 std::string != Cstring
bool operator== (Cstring const &s, char const c)
 Cstring == char.
bool operator== (char const c, Cstring const &s)
 char == Cstring
bool operator!= (Cstring const &s, char const c)
 Cstring != char.
bool operator!= (char const c, Cstring const &s)
 char != Cstring
bool equali (Cstring const &s, Cstring const &t)
 Cstring == Cstring Case-Insensitively?
bool equali (Cstring const &s, c_cstring const t)
 Cstring == cstring Case-Insensitively?
bool equali (c_cstring const s, Cstring const &t)
 cstring == Cstring Case-Insensitively?
bool equali (Cstring const &s, std::string const &t)
 Cstring == std::string Case-Insensitively?
bool equali (std::string const &s, Cstring const &t)
 std::string == Cstring Case-Insensitively?
bool equali (Cstring const &s, char const c)
 Cstring == char Case-Insensitively?
bool equali (char const c, Cstring const &s)
 char == Cstring Case-Insensitively?
std::ostream & operator<< (std::ostream &stream, Cstring const &s)
 Output to Stream.
std::istream & operator>> (std::istream &stream, Cstring &s)
 Input from Stream.

Detailed Description

Cstring: C String Wrapper.

Remarks:
  • A memory-managed C string (char*) wrapper for convenience when using a C-style interfaces
  • Explicit conversion from std::string
  • Implicit conversion from/to char* for argument passing
  • Automatic memory management
  • Invariant: Null-terminated upon return from any constructor or function

Member Typedef Documentation


Constructor & Destructor Documentation

ObjexxFCL::Cstring::Cstring ( ) [inline]
ObjexxFCL::Cstring::Cstring ( Cstring const &  s) [inline]

Copy Constructor.

ObjexxFCL::Cstring::Cstring ( c_cstring const  s) [inline]

C string Constructor: Implicit Conversion.

ObjexxFCL::Cstring::Cstring ( std::string const &  s) [inline, explicit]

std::string Constructor

References len().

ObjexxFCL::Cstring::Cstring ( Cstring const &  s,
size_type const  len 
) [inline]

Cstring + Length Constructor.

References len(), and length().

ObjexxFCL::Cstring::Cstring ( c_cstring const  s,
size_type const  len 
) [inline]

C string + Length Constructor.

References len().

ObjexxFCL::Cstring::Cstring ( std::string const &  s,
size_type const  len 
) [inline]

std::string + Length Constructor

References len().

ObjexxFCL::Cstring::Cstring ( char const  c) [inline, explicit]

char Constructor

ObjexxFCL::Cstring::Cstring ( size_type const  len) [inline, explicit]

Length Constructor.

References len().

ObjexxFCL::Cstring::Cstring ( int const  len) [inline, explicit]

Length Constructor.

References len().

virtual ObjexxFCL::Cstring::~Cstring ( ) [inline, virtual]

Destructor.


Member Function Documentation

Cstring & ObjexxFCL::Cstring::center ( )
Cstring ObjexxFCL::Cstring::centered ( ) const [inline]

Centered Copy.

References Cstring().

Cstring & ObjexxFCL::Cstring::compress ( )

Compress Out Whitespace.

References color_pdb::i, len(), ObjexxFCL::NULLC(), ObjexxFCL::SPACE(), and ObjexxFCL::TAB().

Cstring ObjexxFCL::Cstring::compressed ( ) const [inline]

Compressed Copy.

References Cstring().

bool ObjexxFCL::Cstring::empty ( ) const [inline]

Empty?

Cstring::size_type ObjexxFCL::Cstring::find ( char const  c) const

Find First Occurrence of a Character.

References color_pdb::i, and npos.

Cstring::size_type ObjexxFCL::Cstring::find_last ( char const  c) const

Find Last Occurrence of a Character.

References color_pdb::i, and npos.

bool ObjexxFCL::Cstring::has ( char const  c) const

Has a Character?

References color_pdb::i.

bool ObjexxFCL::Cstring::has_any_of ( std::string const  s) const

Has Any Character of a std::string?

References color_pdb::i.

bool ObjexxFCL::Cstring::has_any_of ( char const  c) const

Has a Character?

References color_pdb::i.

bool ObjexxFCL::Cstring::has_any_of ( Cstring const &  s) const

Has Any Character of a Cstring?

References color_pdb::i, and length().

bool ObjexxFCL::Cstring::has_any_of ( c_cstring const  s) const

Has Any Character of a cstring?

References color_pdb::i.

bool ObjexxFCL::Cstring::is_blank ( ) const [inline]

Blank?

References len_trim().

Cstring ObjexxFCL::Cstring::left_justified ( ) const [inline]

Left-Justified Copy.

References Cstring().

Cstring & ObjexxFCL::Cstring::left_justify ( )

Left Justify.

References color_pdb::i, len(), and ObjexxFCL::SPACE().

Referenced by center().

size_type ObjexxFCL::Cstring::len ( ) const [inline]
Cstring::size_type ObjexxFCL::Cstring::len_trim ( ) const

Length Space-Trimmed.

References color_pdb::i, and ObjexxFCL::SPACE().

Referenced by center(), is_blank(), not_blank(), trim(), and trimmed().

Cstring::size_type ObjexxFCL::Cstring::len_trim_whitespace ( ) const

Length Whitespace-Trimmed.

References color_pdb::i, ObjexxFCL::NULLC(), ObjexxFCL::SPACE(), and ObjexxFCL::TAB().

Referenced by trim_whitespace(), and trimmed_whitespace().

size_type ObjexxFCL::Cstring::length ( ) const [inline]
Cstring & ObjexxFCL::Cstring::lowercase ( )

Lowercase.

References color_pdb::i.

Cstring ObjexxFCL::Cstring::lowercased ( ) const [inline]

Lowercased Copy.

References Cstring().

bool ObjexxFCL::Cstring::not_blank ( ) const [inline]

Not blank?

References len_trim().

ObjexxFCL::Cstring::operator c_cstring ( ) const [inline]

C string Conversion: Invalid after str_ is reallocated.

ObjexxFCL::Cstring::operator cstring ( ) [inline]

C string Conversion: Invalid after str_ is reallocated.

Cstring& ObjexxFCL::Cstring::operator+= ( c_cstring const  s) [inline]

cstring Append

References Cstring().

Cstring& ObjexxFCL::Cstring::operator+= ( std::string const &  s) [inline]

std::string Append

References Cstring().

Cstring& ObjexxFCL::Cstring::operator+= ( char const  c) [inline]

char Append

References Cstring().

Cstring& ObjexxFCL::Cstring::operator+= ( Cstring const &  s) [inline]

Cstring Append.

References Cstring().

Cstring& ObjexxFCL::Cstring::operator= ( c_cstring const  s) [inline]

cstring Assignment

References len().

Cstring& ObjexxFCL::Cstring::operator= ( char const  c) [inline]

char Assignment

Cstring& ObjexxFCL::Cstring::operator= ( std::string const &  s) [inline]

std::string Assignment

References len().

Cstring& ObjexxFCL::Cstring::operator= ( Cstring const &  s) [inline]

Copy Assignment.

References len(), and length().

char ObjexxFCL::Cstring::operator[] ( int const  i) const [inline]

Cstring[ i ] const.

Note:
Overload prevents ambiguity with built-in operator[] with int arguments

References color_pdb::i.

char& ObjexxFCL::Cstring::operator[] ( int const  i) [inline]

Cstring[ i ].

Note:
Overload prevents ambiguity with built-in operator[] with int arguments

References color_pdb::i.

char& ObjexxFCL::Cstring::operator[] ( size_type const  i) [inline]

Cstring[ i ].

References color_pdb::i.

char ObjexxFCL::Cstring::operator[] ( size_type const  i) const [inline]

Cstring[ i ] const.

References color_pdb::i.

Cstring ObjexxFCL::Cstring::right_justified ( ) const [inline]

Right-Justified Copy.

References Cstring().

Cstring & ObjexxFCL::Cstring::right_justify ( )

Right Justify.

References color_pdb::i, len(), and ObjexxFCL::SPACE().

size_type ObjexxFCL::Cstring::size ( ) const [inline]

Size.

void ObjexxFCL::Cstring::swap ( Cstring s) [inline]

swap( Cstring )

Referenced by ObjexxFCL::swap().

Cstring& ObjexxFCL::Cstring::trim ( ) [inline]

Trim Trailing Space.

References len_trim().

Cstring& ObjexxFCL::Cstring::trim_whitespace ( ) [inline]

Trim Trailing Whitespace.

References len_trim_whitespace().

Cstring ObjexxFCL::Cstring::trimmed ( ) const [inline]

Space-Trimmed Copy.

References Cstring(), and len_trim().

Cstring ObjexxFCL::Cstring::trimmed_whitespace ( ) const [inline]

Whitespace-Trimmed Copy.

References Cstring(), and len_trim_whitespace().

Cstring & ObjexxFCL::Cstring::uppercase ( )

Uppercase.

References color_pdb::i.

Cstring ObjexxFCL::Cstring::uppercased ( ) const [inline]

Uppercased Copy.

References Cstring().


Friends And Related Function Documentation

bool equali ( Cstring const &  s,
Cstring const &  t 
) [friend]

Cstring == Cstring Case-Insensitively?

bool equali ( Cstring const &  s,
c_cstring const  t 
) [friend]

Cstring == cstring Case-Insensitively?

bool equali ( c_cstring const  s,
Cstring const &  t 
) [friend]

cstring == Cstring Case-Insensitively?

bool equali ( Cstring const &  s,
std::string const &  t 
) [friend]

Cstring == std::string Case-Insensitively?

bool equali ( std::string const &  s,
Cstring const &  t 
) [friend]

std::string == Cstring Case-Insensitively?

bool equali ( Cstring const &  s,
char const  c 
) [friend]

Cstring == char Case-Insensitively?

bool equali ( char const  c,
Cstring const &  s 
) [friend]

char == Cstring Case-Insensitively?

bool operator!= ( std::string const &  t,
Cstring const &  s 
) [friend]

std::string != Cstring

bool operator!= ( Cstring const &  s,
char const  c 
) [friend]

Cstring != char.

bool operator!= ( Cstring const &  s,
Cstring const &  t 
) [friend]
bool operator!= ( char const  c,
Cstring const &  s 
) [friend]

char != Cstring

bool operator!= ( Cstring const &  s,
std::string const &  t 
) [friend]

Cstring != std::string.

bool operator!= ( Cstring const &  s,
c_cstring const  t 
) [friend]

Cstring != cstring.

bool operator!= ( c_cstring const  t,
Cstring const &  s 
) [friend]

cstring != Cstring

Cstring operator+ ( Cstring const &  s,
Cstring const &  t 
) [friend]
Cstring operator+ ( c_cstring const  s,
Cstring const &  t 
) [friend]

cstring + Cstring

Cstring operator+ ( Cstring const &  s,
std::string const &  t 
) [friend]

Cstring + std::string.

Cstring operator+ ( Cstring const &  s,
char const  c 
) [friend]

Cstring + char.

Cstring operator+ ( Cstring const &  s,
c_cstring const  t 
) [friend]

Cstring + cstring.

Cstring operator+ ( char const  c,
Cstring const &  t 
) [friend]

char + Cstring

std::ostream& operator<< ( std::ostream &  stream,
Cstring const &  s 
) [friend]

Output to Stream.

bool operator== ( c_cstring const  t,
Cstring const &  s 
) [friend]

cstring == Cstring

bool operator== ( Cstring const &  s,
c_cstring const  t 
) [friend]

Cstring == cstring.

bool operator== ( Cstring const &  s,
Cstring const &  t 
) [friend]
bool operator== ( Cstring const &  s,
char const  c 
) [friend]

Cstring == char.

bool operator== ( Cstring const &  s,
std::string const &  t 
) [friend]

Cstring == std::string.

bool operator== ( std::string const &  t,
Cstring const &  s 
) [friend]

std::string == Cstring

bool operator== ( char const  c,
Cstring const &  s 
) [friend]

char == Cstring

std::istream& operator>> ( std::istream &  stream,
Cstring s 
) [friend]

Input from Stream.

void swap ( Cstring s,
Cstring t 
) [friend]

swap( Cstring, Cstring )


Member Data Documentation

Cstring::size_type const ObjexxFCL::Cstring::npos = static_cast< size_type >( -1 ) [static]

Referenced by find(), and find_last().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines