Rosetta
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

◆ Size

typedef std::size_t ObjexxFCL::Cstring::Size

◆ size_type

typedef std::size_t ObjexxFCL::Cstring::size_type

Constructor & Destructor Documentation

◆ Cstring() [1/10]

ObjexxFCL::Cstring::Cstring ( )
inline

◆ Cstring() [2/10]

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

Copy Constructor.

References docking::s, and str_.

◆ Cstring() [3/10]

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

C string Constructor: Implicit Conversion.

References docking::s, and str_.

◆ Cstring() [4/10]

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

std::string Constructor

References len(), docking::s, and str_.

◆ Cstring() [5/10]

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

Cstring + Length Constructor.

References len(), docking::s, and str_.

◆ Cstring() [6/10]

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

C string + Length Constructor.

References len(), docking::s, and str_.

◆ Cstring() [7/10]

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

std::string + Length Constructor

References len(), docking::s, and str_.

◆ Cstring() [8/10]

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

◆ Cstring() [9/10]

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

Length Constructor.

References len(), and str_.

◆ Cstring() [10/10]

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

Length Constructor.

References len(), and str_.

◆ ~Cstring()

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

Destructor.

References str_.

Member Function Documentation

◆ center()

Cstring & ObjexxFCL::Cstring::center ( )

◆ centered()

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

Centered Copy.

References Cstring().

◆ compress()

Cstring & ObjexxFCL::Cstring::compress ( )

◆ compressed()

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

Compressed Copy.

References Cstring().

Referenced by pyrosetta.distributed.cluster.io.IO::_save_results().

◆ empty()

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

Empty?

References str_.

◆ find()

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

Find First Occurrence of a Character.

References kmeans_adaptive_kernel_density_bb_dependent_rotlib::c, create_a3b_hbs::i, npos, and str_.

◆ find_last()

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

Find Last Occurrence of a Character.

References kmeans_adaptive_kernel_density_bb_dependent_rotlib::c, create_a3b_hbs::i, npos, and str_.

◆ has()

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

◆ has_any_of() [1/4]

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

Has Any Character of a cstring?

References create_a3b_hbs::i, create_a3b_hbs::j, docking::s, and str_.

◆ has_any_of() [2/4]

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

◆ has_any_of() [3/4]

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

Has Any Character of a Cstring?

References create_a3b_hbs::i, create_a3b_hbs::j, docking::s, and str_.

◆ has_any_of() [4/4]

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

Has Any Character of a std::string?

References create_a3b_hbs::i, create_a3b_hbs::j, docking::s, and str_.

◆ is_blank()

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

Blank?

References len_trim().

◆ left_justified()

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

Left-Justified Copy.

References Cstring().

◆ left_justify()

Cstring & ObjexxFCL::Cstring::left_justify ( )

Left Justify.

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

Referenced by center().

◆ len()

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

Length.

References str_.

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

◆ len_trim()

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

Length Space-Trimmed.

References create_a3b_hbs::i, ObjexxFCL::SPACE(), and str_.

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

◆ len_trim_whitespace()

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

◆ length()

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

◆ lowercase()

Cstring & ObjexxFCL::Cstring::lowercase ( )

Lowercase.

References create_a3b_hbs::i, and str_.

◆ lowercased()

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

Lowercased Copy.

References Cstring().

◆ not_blank()

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

Not blank?

References len_trim().

◆ operator c_cstring()

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

C string Conversion: Invalid after str_ is reallocated.

References str_.

◆ operator cstring()

ObjexxFCL::Cstring::operator cstring ( )
inline

C string Conversion: Invalid after str_ is reallocated.

References str_.

◆ operator+=() [1/4]

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

cstring Append

References Cstring(), and docking::s.

◆ operator+=() [2/4]

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

◆ operator+=() [3/4]

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

Cstring Append.

References Cstring(), and docking::s.

◆ operator+=() [4/4]

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

std::string Append

References Cstring(), and docking::s.

◆ operator=() [1/4]

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

cstring Assignment

References len(), docking::s, and str_.

◆ operator=() [2/4]

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

◆ operator=() [3/4]

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

Copy Assignment.

References len(), docking::s, and str_.

◆ operator=() [4/4]

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

std::string Assignment

References len(), docking::s, and str_.

◆ operator[]() [1/4]

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

Cstring[ i ].

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

References create_a3b_hbs::i, and str_.

◆ operator[]() [2/4]

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

Cstring[ i ] const.

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

References create_a3b_hbs::i, and str_.

◆ operator[]() [3/4]

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

Cstring[ i ].

References create_a3b_hbs::i, and str_.

◆ operator[]() [4/4]

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

Cstring[ i ] const.

References create_a3b_hbs::i, and str_.

◆ right_justified()

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

Right-Justified Copy.

References Cstring().

◆ right_justify()

Cstring & ObjexxFCL::Cstring::right_justify ( )

Right Justify.

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

◆ size()

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

Size.

References str_.

◆ swap()

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

swap( Cstring )

References docking::s, str_, and ObjexxFCL::swap().

◆ trim()

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

Trim Trailing Space.

References len_trim(), and str_.

◆ trim_whitespace()

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

Trim Trailing Whitespace.

References len_trim_whitespace(), and str_.

◆ trimmed()

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

Space-Trimmed Copy.

References Cstring(), and len_trim().

◆ trimmed_whitespace()

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

Whitespace-Trimmed Copy.

References Cstring(), and len_trim_whitespace().

◆ uppercase()

Cstring & ObjexxFCL::Cstring::uppercase ( )

Uppercase.

References create_a3b_hbs::i, and str_.

◆ uppercased()

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

Uppercased Copy.

References Cstring().

Friends And Related Function Documentation

◆ equali [1/7]

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

cstring == Cstring Case-Insensitively?

◆ equali [2/7]

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

char == Cstring Case-Insensitively?

◆ equali [3/7]

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

Cstring == cstring Case-Insensitively?

◆ equali [4/7]

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

Cstring == char Case-Insensitively?

◆ equali [5/7]

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

Cstring == Cstring Case-Insensitively?

◆ equali [6/7]

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

Cstring == std::string Case-Insensitively?

◆ equali [7/7]

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

std::string == Cstring Case-Insensitively?

◆ operator!= [1/7]

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

cstring != Cstring

◆ operator!= [2/7]

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

char != Cstring

◆ operator!= [3/7]

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

Cstring != cstring.

◆ operator!= [4/7]

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

Cstring != char.

◆ operator!= [5/7]

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

◆ operator!= [6/7]

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

Cstring != std::string.

◆ operator!= [7/7]

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

std::string != Cstring

◆ operator+ [1/6]

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

cstring + Cstring

◆ operator+ [2/6]

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

char + Cstring

◆ operator+ [3/6]

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

Cstring + cstring.

◆ operator+ [4/6]

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

Cstring + char.

◆ operator+ [5/6]

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

◆ operator+ [6/6]

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

Cstring + std::string.

◆ operator<<

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

Output to Stream.

◆ operator== [1/7]

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

cstring == Cstring

◆ operator== [2/7]

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

char == Cstring

◆ operator== [3/7]

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

Cstring == cstring.

◆ operator== [4/7]

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

Cstring == char.

◆ operator== [5/7]

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

◆ operator== [6/7]

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

Cstring == std::string.

◆ operator== [7/7]

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

std::string == Cstring

◆ operator>>

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

Input from Stream.

◆ swap

void swap ( Cstring s,
Cstring t 
)
friend

swap( Cstring, Cstring )

Member Data Documentation

◆ npos

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

Referenced by find(), and find_last().

◆ str_

char* ObjexxFCL::Cstring::str_
private

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