casacore
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
casacore::SubString Class Reference

More...

#include <String.h>

Public Member Functions

 operator const string () const
 Make a string. More...
 
 SubString (const SubString &)=default
 Default copy constructor. More...
 
SubStringoperator= (const SubString &str)
 Assignment. More...
 
SubStringoperator= (const String &str)
 
SubStringoperator= (const Char *s)
 
SubStringoperator= (const Char c)
 
const Charchars () const
 Get as (const) C array. More...
 
string::size_type length () const
 Obtain length. More...
 

Private Member Functions

 SubString (const string &str, string::size_type pos, string::size_type len)
 Constructor (there are no public constructors) More...
 

Private Attributes

const string & ref_p
 Referenced string. More...
 
string::size_type pos_p
 Start of sub-string. More...
 
string::size_type len_p
 Length of sub-string. More...
 

Friends

class String
 

Detailed Description

SubString help class to be used in at, before,...

Synopsis

The SubString class can only be used by the String class to be able to operate the Casacore defined replacement operators at, before, after, through, from. The class is used transparently in operations like:

string.at(2,3) = "five";

If the SubString starts at a position outside the length of the original string (like e.g. in after(1000000)), a zero length string is created (not an exception thrown like in standard string operations).

Definition at line 61 of file String.h.

Constructor & Destructor Documentation

◆ SubString() [1/2]

casacore::SubString::SubString ( const SubString )
default

Default copy constructor.

◆ SubString() [2/2]

casacore::SubString::SubString ( const string &  str,
string::size_type  pos,
string::size_type  len 
)
inlineprivate

Constructor (there are no public constructors)

Definition at line 1015 of file String.h.

Member Function Documentation

◆ chars()

const Char * casacore::SubString::chars ( ) const
inline

Get as (const) C array.

Definition at line 1022 of file String.h.

References String.

◆ length()

string::size_type casacore::SubString::length ( ) const
inline

Obtain length.

Definition at line 79 of file String.h.

References len_p.

◆ operator const string()

casacore::SubString::operator const string ( ) const
inline

Make a string.

Definition at line 66 of file String.h.

References len_p, pos_p, and ref_p.

◆ operator=() [1/4]

SubString& casacore::SubString::operator= ( const Char s)

◆ operator=() [2/4]

SubString& casacore::SubString::operator= ( const Char  c)

◆ operator=() [3/4]

SubString& casacore::SubString::operator= ( const String str)

◆ operator=() [4/4]

SubString& casacore::SubString::operator= ( const SubString str)

Assignment.

Friends And Related Function Documentation

◆ String

friend class String
friend

Definition at line 64 of file String.h.

Referenced by chars().

Member Data Documentation

◆ len_p

string::size_type casacore::SubString::len_p
private

Length of sub-string.

Definition at line 92 of file String.h.

Referenced by length(), and operator const string().

◆ pos_p

string::size_type casacore::SubString::pos_p
private

Start of sub-string.

Definition at line 90 of file String.h.

Referenced by operator const string().

◆ ref_p

const string& casacore::SubString::ref_p
private

Referenced string.

Definition at line 88 of file String.h.

Referenced by operator const string().


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