Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | Friends | List of all members
ObjexxFCL::Cstring Class Reference

Cstring: C String Wrapper. More...

#include <Cstring.hh>

Public Types

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

Public Member Functions

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

Static Public Attributes

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

Private Attributes

char * str_
 String. More...
 

Friends

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

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.

References str_.

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

C string Constructor: Implicit Conversion.

References str_.

ObjexxFCL::Cstring::Cstring ( std::string const &  s)
inlineexplicit

std::string Constructor

References len(), and str_.

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

Cstring + Length Constructor.

References len(), length(), and str_.

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

C string + Length Constructor.

References len(), and str_.

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

std::string + Length Constructor

References len(), and str_.

ObjexxFCL::Cstring::Cstring ( char const  c)
inlineexplicit

char Constructor

References str_.

ObjexxFCL::Cstring::Cstring ( size_type const  len)
inlineexplicit

Length Constructor.

References len(), and str_.

ObjexxFCL::Cstring::Cstring ( int const  len)
inlineexplicit

Length Constructor.

References len(), and str_.

virtual ObjexxFCL::Cstring::~Cstring ( )
inlinevirtual

Destructor.

References str_.

Member Function Documentation

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

Centered Copy.

References Cstring().

Cstring & ObjexxFCL::Cstring::compress ( )
Cstring ObjexxFCL::Cstring::compressed ( ) const
inline

Compressed Copy.

References Cstring().

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

Empty?

References str_.

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

Find First Occurrence of a Character.

References npos, and str_.

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

Find Last Occurrence of a Character.

References npos, and str_.

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

Has a Character?

References str_.

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

Has Any Character of a Cstring?

References basic::options::OptionKeys::frags::j, length(), and str_.

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

Has Any Character of a cstring?

References basic::options::OptionKeys::frags::j, and str_.

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

Has Any Character of a std::string?

References basic::options::OptionKeys::frags::j, and str_.

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

Has a Character?

References str_.

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 len(), ObjexxFCL::SPACE(), and str_.

Referenced by center().

size_type ObjexxFCL::Cstring::len ( ) const
inline

Length.

References str_.

Referenced by compress(), Cstring(), left_justify(), operator=(), and right_justify().

Cstring::size_type ObjexxFCL::Cstring::len_trim ( ) const

Length Space-Trimmed.

References ObjexxFCL::SPACE(), and str_.

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

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

Length Whitespace-Trimmed.

References ObjexxFCL::NULLC(), ObjexxFCL::SPACE(), str_, and ObjexxFCL::TAB().

Referenced by trim_whitespace(), and trimmed_whitespace().

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

Lowercase.

References str_.

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.

References str_.

ObjexxFCL::Cstring::operator cstring ( )
inline

C string Conversion: Invalid after str_ is reallocated.

References str_.

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

Cstring Append.

References Cstring().

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

Copy Assignment.

References len(), length(), and str_.

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

cstring Assignment

References len(), and str_.

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

std::string Assignment

References len(), and str_.

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

char Assignment

References str_.

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

Cstring[ i ] const.

References str_.

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

Cstring[ i ].

References str_.

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

Cstring[ i ] const.

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

References str_.

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

Cstring[ i ].

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

References str_.

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

Right-Justified Copy.

References Cstring().

Cstring & ObjexxFCL::Cstring::right_justify ( )

Right Justify.

References len(), ObjexxFCL::SPACE(), and str_.

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

Size.

References str_.

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

swap( Cstring )

References str_, and swap().

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

Trim Trailing Space.

References len_trim(), and str_.

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

Trim Trailing Whitespace.

References len_trim_whitespace(), and str_.

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 str_.

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!= ( Cstring const &  s,
Cstring const &  t 
)
friend
bool operator!= ( Cstring const &  s,
c_cstring const  t 
)
friend

Cstring != cstring.

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

cstring != Cstring

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!= ( Cstring const &  s,
char const  c 
)
friend

Cstring != char.

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

char != Cstring

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

Cstring + cstring.

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+ ( char const  c,
Cstring const &  t 
)
friend

char + Cstring

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

Output to Stream.

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

Cstring == cstring.

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

cstring == Cstring

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== ( Cstring const &  s,
char const  c 
)
friend

Cstring == char.

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().

char* ObjexxFCL::Cstring::str_
private

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