OMNeT++ API 6.1
Discrete Event Simulation Library
opp_string Class Reference

Description

Lightweight string class, used internally in some parts of OMNeT++.

In simulation models it is better to use std::string or const char * instead.

opp_string has only one data member, a char* pointer. Allocation and deallocation of the contents takes place via opp_strdup() and operator delete.

Public Member Functions

 opp_string ()
 
 opp_string (const char *s)
 
 opp_string (const char *s, int n)
 
 opp_string (const std::string &s)
 
 opp_string (const opp_string &s)
 
 opp_string (opp_string &&s)
 
 ~opp_string ()
 
const char * c_str () const
 
std::string str () const
 
bool empty () const
 
char * buffer ()
 
int size () const
 
char * reserve (unsigned size)
 
const char * operator= (const char *s)
 
opp_stringoperator= (const opp_string &s)
 
opp_stringoperator= (const std::string &s)
 
bool operator< (const opp_string &s) const
 
bool operator== (const opp_string &s) const
 
bool operator!= (const opp_string &s) const
 
opp_stringoperator+= (const char *s)
 
opp_stringoperator+= (const opp_string &s)
 
opp_stringoperator+= (const std::string &s)
 
opp_string operator+ (const char *s)
 
opp_string operator+ (const opp_string &s)
 
opp_string operator+ (const std::string &s)
 

Constructor & Destructor Documentation

◆ opp_string() [1/6]

opp_string ( )
inline

Constructor.

◆ opp_string() [2/6]

opp_string ( const char *  s)
inline

Constructor.

References omnetpp::opp_strdup().

◆ opp_string() [3/6]

opp_string ( const char *  s,
int  n 
)
inline

Constructor.

◆ opp_string() [4/6]

opp_string ( const std::string &  s)
inline

Constructor.

References omnetpp::opp_strdup().

◆ opp_string() [5/6]

opp_string ( const opp_string s)
inline

Copy constructor.

References omnetpp::opp_strdup().

◆ opp_string() [6/6]

opp_string ( opp_string &&  s)
inline

Move constructor.

◆ ~opp_string()

~opp_string ( )
inline

Destructor.

Member Function Documentation

◆ c_str()

const char* c_str ( ) const
inline

Return pointer to the string.

Referenced by opp_string::operator+(), and cValue::set().

◆ str()

std::string str ( ) const
inline

Convert to std::string.

◆ empty()

bool empty ( ) const
inline

Null (empty) string or not.

◆ buffer()

char* buffer ( )
inline

Returns pointer to the internal buffer where the string is stored. It is allowed to write into the string via this pointer, but the length of the string should not be exceeded.

◆ size()

int size ( ) const
inline

Returns the length of the string.

◆ reserve()

char* reserve ( unsigned  size)
inline

Allocates a buffer of the given size.

◆ operator=() [1/3]

const char* operator= ( const char *  s)
inline

Deletes the old value and opp_strdup()'s the new value to create the object's own copy.

References omnetpp::opp_strdup().

◆ operator=() [2/3]

opp_string& operator= ( const opp_string s)
inline

Assignment.

References opp_string::operator=().

Referenced by opp_string::operator=().

◆ operator=() [3/3]

opp_string& operator= ( const std::string &  s)
inline

Assignment.

References opp_string::operator=().

Referenced by opp_string::operator=().

◆ operator<()

bool operator< ( const opp_string s) const
inline

Comparison.

References omnetpp::opp_strcmp().

◆ operator==()

bool operator== ( const opp_string s) const
inline

Comparison.

References omnetpp::opp_strcmp().

◆ operator!=()

bool operator!= ( const opp_string s) const
inline

Comparison.

References omnetpp::opp_strcmp().

◆ operator+=() [1/3]

opp_string& operator+= ( const char *  s)
inline

Concatenation

◆ operator+=() [2/3]

opp_string& operator+= ( const opp_string s)
inline

Concatenation

References opp_string::operator+=().

Referenced by opp_string::operator+=().

◆ operator+=() [3/3]

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

Concatenation

References opp_string::operator+=().

Referenced by opp_string::operator+=().

◆ operator+() [1/3]

opp_string operator+ ( const char *  s)
inline

Concatenation

◆ operator+() [2/3]

opp_string operator+ ( const opp_string s)
inline

Concatenation

References opp_string::c_str(), and opp_string::operator+().

Referenced by opp_string::operator+().

◆ operator+() [3/3]

opp_string operator+ ( const std::string &  s)
inline

Concatenation

References opp_string::operator+().

Referenced by opp_string::operator+().


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