ORIGINAL
Loading...
Searching...
No Matches
original::wrapper< TYPE > Class Template Referenceabstract

Base class for linked value containers with formatted output. More...

#include <wrapper.h>

Inheritance diagram for original::wrapper< TYPE >:
Inheritance graph
Collaboration diagram for original::wrapper< TYPE >:
Collaboration graph

Public Member Functions

virtual TYPE & getVal ()=0
 Accesses the contained value (mutable).
 
virtual const TYPE & getVal () const =0
 Accesses the contained value (immutable).
 
virtual void setVal (TYPE data)=0
 Updates the contained value.
 
virtual wrappergetPPrev () const =0
 Retrieves previous node in container sequence.
 
virtual wrappergetPNext () const =0
 Retrieves next node in container sequence.
 
 ~wrapper () override=default
 Destructor for the wrapper class.
 
std::string className () const override
 Provides class identifier for diagnostics. See original::printable::className()
 
std::string toString (bool enter) const override
 Generates formatted diagnostic string. See original::printable::toString()
 
- Public Member Functions inherited from original::printable
 operator std::string () const
 Explicit conversion to std::string.
 
 operator const char * () const
 Explicit conversion to C-style string.
 
const char * toCString (bool enter) const
 Direct C-string access with formatting control.
 
template<typename TYPE>
auto formatString (const TYPE &t) -> std::string
 
template<typename TYPE>
auto formatCString (const TYPE &t) -> const char *
 
template<typename TYPE>
auto formatEnum (const TYPE &t) -> std::string
 
template<typename TYPE>
auto formatString (TYPE *const &ptr) -> std::string
 

Additional Inherited Members

- Static Public Member Functions inherited from original::printable
template<typename TYPE>
static std::string formatString (const TYPE &t)
 Universal value-to-string conversion.
 
template<typename TYPE>
static std::string formatString (TYPE *const &ptr)
 Pointer-specific formatting.
 
template<typename TYPE>
static const char * formatCString (const TYPE &t)
 C-string cache for temporary usage.
 
template<typename TYPE>
static std::string formatEnum (const TYPE &t)
 Enum formatting utility.
 
template<>
auto formatString (const char &t) -> std::string
 
template<>
auto formatString (const bool &t) -> std::string
 
template<>
auto formatString (const char *const &ptr) -> std::string
 

Detailed Description

template<typename TYPE>
class original::wrapper< TYPE >

Base class for linked value containers with formatted output.

Template Parameters
TYPEType of encapsulated value

Combines three core capabilities:

  1. Value storage and access
  2. Node navigation
  3. Polymorphic string representation through printable interface

Constructor & Destructor Documentation

◆ ~wrapper()

template<typename TYPE>
original::wrapper< TYPE >::~wrapper ( )
overridedefault

Destructor for the wrapper class.

The destructor ensures proper cleanup of the object. Since wrapper is an abstract base class, the destructor is virtual to allow derived classes to perform their own cleanup as needed before the base class destructor is invoked.

Member Function Documentation

◆ className()

template<typename TYPE>
auto original::wrapper< TYPE >::className ( ) const
nodiscardoverridevirtual

Provides class identifier for diagnostics. See original::printable::className()

Base implementation returns "wrapper".

class my_wrapper : public wrapper<int> {
std::string className() const override { return "my_wrapper"; }
};
Base class for linked value containers with formatted output.
Definition wrapper.h:28
std::string className() const override
Provides class identifier for diagnostics. See original::printable::className()
Definition wrapper.h:100

Reimplemented from original::printable.

◆ getPNext()

template<typename TYPE>
virtual wrapper * original::wrapper< TYPE >::getPNext ( ) const
pure virtual

Retrieves next node in container sequence.

Returns
Pointer to successor node or nullptr if last element.

◆ getPPrev()

template<typename TYPE>
virtual wrapper * original::wrapper< TYPE >::getPPrev ( ) const
pure virtual

Retrieves previous node in container sequence.

Returns
Pointer to predecessor node or nullptr if first element.

◆ getVal() [1/2]

template<typename TYPE>
virtual const TYPE & original::wrapper< TYPE >::getVal ( ) const
pure virtual

Accesses the contained value (immutable).

Returns
Const reference to the stored value.

◆ getVal() [2/2]

template<typename TYPE>
virtual TYPE & original::wrapper< TYPE >::getVal ( )
pure virtual

Accesses the contained value (mutable).

Returns
Reference to the stored value.

◆ setVal()

template<typename TYPE>
virtual void original::wrapper< TYPE >::setVal ( TYPE data)
pure virtual

Updates the contained value.

Parameters
dataNew value to store.
Postcondition
getVal() == data

◆ toString()

template<typename TYPE>
auto original::wrapper< TYPE >::toString ( bool enter) const
nodiscardoverridevirtual

Generates formatted diagnostic string. See original::printable::toString()

Parameters
enterAdd trailing newline when true.
Returns
String in format "ClassName(address, value)".
wrapper<int>* w = new node<int>(42);
std::cout << w->toString(true); // "wrapper(@0x1234, 42)\n"
std::string toString(bool enter) const override
Generates formatted diagnostic string. See original::printable::toString()
Definition wrapper.h:106

Reimplemented from original::printable.


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