Semantic Object String.
More...
#include <sos.h>
|
| | SOS (const std::string &p_str) |
| | Ctor from string reference.
|
| |
|
| SOS (const SOS &p_other) |
| | Copy ctor.
|
| |
|
| ~SOS () override |
| | Dtor.
|
| |
|
| SOS (SOS &&)=delete |
| |
|
SOS & | operator= (const SOS &)=delete |
| |
|
SOS & | operator= (SOS &&)=delete |
| |
|
std::string | getString () const |
| | Getter for the string value.
|
| |
| std::string & | getStringRef () |
| | Getter for reference to the string value.
|
| |
| SOS * | dup () const override |
| | Creates a new instance as copy following the red book definition.
|
| |
| SOS * | clone () const override |
| | Creates a new instance as copy with deep cloning.
|
| |
| std::string | opequal () const override |
| | String representation of object for operators '=', 'cvs' and 'stack'.
|
| |
| std::string | opequalequal () const override |
| | String representation for operators '==' and 'pstack'.
|
| |
| OTCode | ot () const override |
| | Returns an OTCode.
|
| |
| std::string | type () const override |
| | Returns a type name.
|
| |
| bool | equal (const SO *p_other) const override |
| | Checks if this SO is equal to another SO.
|
| |
| bool | gt (OpError &p_ec, const SO *p_other) const override |
| | Greater than.
|
| |
| bool | ge (OpError &p_ec, const SO *p_other) const override |
| | Greater or equal.
|
| |
| size_t | getSize () const override |
| | Returns the size of the SO.
|
| |
| void | putCh (size_t p_index, int p_char) |
| | Sets a single character within the string.
|
| |
|
void | erase0 () |
| | Erases the fist character of the String.
|
| |
| void | replace (size_t p_pos, const std::string &p_src) |
| | Replaces characters at position p_pos.
|
| |
| virtual size_t | treeheight (size_t p_myheigth) const |
| | Tree Height.
|
| |
|
| SO () |
| | Ctor.
|
| |
| | SO (bool p_exec) |
| | Ctor.
|
| |
|
| SO (const SO &p_other) |
| | Copy ctor.
|
| |
|
| SO (SO &&)=delete |
| |
|
| SO () |
| | Ctor.
|
| |
| | SO (bool p_exec) |
| | Ctor.
|
| |
|
| SO (const SO &p_other) |
| | Copy ctor.
|
| |
| virtual | ~SO () |
| | Virtual dtor.
|
| |
|
| SO (SO &&)=delete |
| |
|
SO & | operator= (const SO &)=delete |
| |
|
SO & | operator= (SO &&)=delete |
| |
|
bool | getExec () const |
| | Getter for exec_.
|
| |
|
void | setExec (bool p_exec) |
| | Setter for exec_.
|
| |
|
| Counter (Counter< SO > &&)=delete |
| |
|
Counter< SO > & | operator= (const Counter< SO > &)=delete |
| |
|
Counter< SO > & | operator= (Counter< SO > &&)=delete |
| |
|
| bool | invariant () const noexcept override |
| | Checks class invariants.
|
| |
|
| Counter () |
| | Ctor.
|
| |
|
| Counter (const Counter< SO > &) |
| | Copy ctor.
|
| |
|
| ~Counter () |
| | Dtor.
|
| |
|
| ~DbC ()=default |
| | Protected dtor.
|
| |
|
|
std::shared_ptr< std::string > | str_ |
| | The string value.
|
| |
|
|
static size_t | getTotalCounter () |
| | Static getter for totaly created objects.
|
| |
|
static size_t | getAliveCounter () |
| | Static getter for objects alive.
|
| |
|
static size_t | getWatermarkCounter () |
| | Static getter for the object counter watermark.
|
| |
Semantic Object String.
- Invariant
- shared pointer is not null.
◆ SOS()
| SOS::SOS |
( |
const std::string & |
p_str | ) |
|
|
inlineexplicit |
Ctor from string reference.
- Parameters
-
◆ clone()
| SOS * SOS::clone |
( |
| ) |
const |
|
inlineoverridevirtual |
Creates a new instance as copy with deep cloning.
Default implementation falls back to dup().
Subclasses must override this if deep cloning is required.
- Returns
- SO * ... A deep copy.
- Postcondition
- return value != nullptr
-
return value maintains invariants
Reimplemented from SO.
◆ dup()
Creates a new instance as copy following the red book definition.
- Returns
- SO * ... A copy.
Implements SO.
◆ equal()
| bool SOS::equal |
( |
const SO * |
p_other | ) |
const |
|
inlineoverridevirtual |
Checks if this SO is equal to another SO.
Equality means:
SOL und SOM are always equal.
For SOD, SOF and SOK, share_ptr<> points to the same object.
For SOA, share_ptr<> points to the same object, but empty arrays are equal nonetheless.
For SOO and SOo the function pointer must be the same.
Otherwise the value must be the same, even for SOS with shared_ptr<>.
- Returns
- bool ... true if the SO's are of the same type and equal
- See also
- Will be used directly and unchanged as operator eq
- Parameters
-
| [in] | p_other | The object to compare with. |
Implements SO.
◆ ge()
| bool SOS::ge |
( |
OpError & |
p_ec, |
|
|
const SO * |
p_other |
|
) |
| const |
|
inlineoverridevirtual |
Greater or equal.
The redundancy between equal(), gt() and ge() is a matter of performance.
- Parameters
-
- Returns
- bool ... true is comparable and ge.
- Parameters
-
| [in] | p_other | The object to compare with. |
Reimplemented from SO.
◆ getSize()
| size_t SOS::getSize |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the size of the SO.
Default implementation returns 1 (for simple objects).
Override in subclasses to return the actual size (e.g., length of a string, number of elements in a composite).
Reimplemented from SO.
◆ getStringRef()
| std::string & SOS::getStringRef |
( |
| ) |
|
|
inline |
Getter for reference to the string value.
- Returns
- std::string & ... Reference to the internal string. The caller must not delete it.
◆ gt()
| bool SOS::gt |
( |
OpError & |
p_ec, |
|
|
const SO * |
p_other |
|
) |
| const |
|
inlineoverridevirtual |
Greater than.
The redundancy between equal(), gt() and ge() is a matter of performance.
- Parameters
-
- Returns
- bool ... true is comparable and gt.
- Parameters
-
| [in] | p_other | The object to compare with. |
Reimplemented from SO.
◆ invariant()
| bool SOS::invariant |
( |
| ) |
const |
|
inlineoverrideprotectedvirtualnoexcept |
Checks class invariants.
- Returns
- bool ... Indicates whether the class invariants are maintained.
Reimplemented from DbC.
◆ opequal()
| std::string SOS::opequal |
( |
| ) |
const |
|
inlineoverridevirtual |
String representation of object for operators '=', 'cvs' and 'stack'.
- Returns
- std::string ... The representation.
Reimplemented from SOcomposite.
◆ opequalequal()
| std::string SOS::opequalequal |
( |
| ) |
const |
|
inlineoverridevirtual |
String representation for operators '==' and 'pstack'.
This function attempts to produce a result that resembles the red book syntax
for creating the object.
- Returns
- std::string ... The representation.
Reimplemented from SO.
◆ ot()
Returns an OTCode.
A "manual" implementation of polymorphism, where C++-polymorphisms fail
- Returns
- OTCode ... The OTCode of the instance.
Implements SO.
◆ putCh()
| void SOS::putCh |
( |
size_t |
p_index, |
|
|
int |
p_char |
|
) |
| |
Sets a single character within the string.
- Precondition
- p_index < stringsize
- Parameters
-
| [in] | p_index | The index. No rangecheck takes place. |
| [in] | p_char | The character. |
◆ replace()
| void SOS::replace |
( |
size_t |
p_pos, |
|
|
const std::string & |
p_src |
|
) |
| |
|
inline |
Replaces characters at position p_pos.
- Precondition
- p_pos+p_src.size() <= this->size()
- Parameters
-
| [in] | p_pos | Position of the replacement. |
| [in] | p_src | The new characters. |
◆ type()
| std::string SOS::type |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns a type name.
- Returns
- std::string ... The type name of the instance.
Implements SO.
The documentation for this class was generated from the following files: