casacore
Loading...
Searching...
No Matches
casacore::SubString Class Reference

More...

#include <String.h>

Public Member Functions

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

Private Member Functions

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

Private Attributes

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

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 185 of file String.h.

Constructor & Destructor Documentation

◆ SubString() [1/2]

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

Default copy constructor.

References SubString().

Referenced by operator=(), operator=(), operator=(), operator=(), and SubString().

◆ SubString() [2/2]

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

Constructor (there are no public constructors).

Definition at line 923 of file String.h.

References len_p, length(), operator const std::string(), pos_p, and ref_p.

Member Function Documentation

◆ chars()

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

Get as (const) C array.

Definition at line 930 of file String.h.

References String.

Referenced by operator=().

◆ length()

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

Obtain length.

Definition at line 210 of file String.h.

References len_p, and length().

Referenced by length(), and SubString().

◆ operator const std::string()

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

Make a string.

Definition at line 191 of file String.h.

References len_p, pos_p, and ref_p.

Referenced by SubString().

◆ operator=() [1/4]

SubString & casacore::SubString::operator= ( const char * s)

References DEPRECATED, and SubString().

◆ operator=() [2/4]

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

References chars(), DEPRECATED, and SubString().

◆ operator=() [3/4]

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

References DEPRECATED, String, and SubString().

◆ operator=() [4/4]

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

Assignment.

References DEPRECATED, and SubString().

◆ String

friend class String
friend

Definition at line 188 of file String.h.

References String.

Referenced by chars(), operator=(), and String.

Member Data Documentation

◆ len_p

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

Length of sub-string.

Definition at line 222 of file String.h.

Referenced by length(), operator const std::string(), and SubString().

◆ pos_p

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

Start of sub-string.

Definition at line 220 of file String.h.

Referenced by operator const std::string(), and SubString().

◆ ref_p

const std::string& casacore::SubString::ref_p
private

Referenced string.

Definition at line 218 of file String.h.

Referenced by operator const std::string(), and SubString().


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