StormByte-Config 3.0.0
C++26 configuration-document module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Config::Item::Comment< T > Class Template Reference

#include <StormByte/config/item/comment.hxx>

Inheritance diagram for StormByte::Config::Item::Comment< T >:
Collaboration diagram for StormByte::Config::Item::Comment< T >:

Public Member Functions

 Comment (const StormByte::Safe::String &comment)
 Constructs a Comment with a Base-owned string.
 Comment (StormByte::Safe::String &&comment)
 Constructs a Comment by moving a Base-owned string.
 Comment (const char *comment)
 Constructs a Comment from a NUL-terminated string.
 Comment (const Comment &comment)
 Copy constructor.
 Comment (Comment &&comment) noexcept
 Move constructor.
Comment & operator= (const Comment &comment)
 Copy assignment operator.
Comment & operator= (Comment &&comment) noexcept
 Move assignment operator.
 ~Comment () noexcept override
 Destructor, defined in the Config module.
bool Equals (const Base &other) const noexcept override
 Polymorphic equality comparison.
StormByte::Safe::String Serialize (const int &indent_level) const noexcept override
 Serializes the comment item.
constexpr Item::Type Type () const noexcept override
 Gets the item type.
constexpr StormByte::Config::Item::CommentType CommentType () const noexcept
 Gets the comment syntax.
constexpr std::string_view CommentTypeToString () const noexcept
 Converts comment syntax to its text representation.
StormByte::Safe::String & Text () noexcept
 Gets mutable comment text.
const StormByte::Safe::String & Text () const noexcept
 Gets const comment text.
PointerType Clone () const override
 Clones the comment on Base's heap.
PointerType Move () override
 Moves the comment to Base's heap.
 ~Comment () noexcept
 Destructor for Bash single-line comments.
 ~Comment () noexcept
 Destructor for C single-line comments.
 ~Comment () noexcept
 Destructor for C multi-line comments.
bool Equals (const Base &other) const noexcept
 Equality for Bash single-line comments.
bool Equals (const Base &other) const noexcept
 Equality for C single-line comments.
bool Equals (const Base &other) const noexcept
 Equality for C multi-line comments.
StormByte::Safe::String Serialize (const int &indent_level) const noexcept
 Serializes a Bash single-line comment.
StormByte::Safe::String Serialize (const int &indent_level) const noexcept
 Serializes a C single-line comment.
StormByte::Safe::String Serialize (const int &indent_level) const noexcept
 Serializes a C multi-line comment.
Public Member Functions inherited from StormByte::Config::Item::Base
 Base () noexcept
 Constructor.
 Base (const StormByte::Safe::String &name)
 Constructor.
 Base (const Base &base) noexcept
 Copy constructor.
 Base (Base &&base) noexcept
 Move constructor.
Base & operator= (const Base &base) noexcept
 Assignment operator.
Base & operator= (Base &&base) noexcept
 Move assignment operator.
 ~Base () noexcept override
 Destructor.
bool operator== (const Base &base) const noexcept
 Compares two items.
bool operator!= (const Base &base) const noexcept
 Compares two items.
constexpr const StormByte::Safe::String & Name () const noexcept
 Gets the name of the item.
void Name (std::string_view name)
 Sets the name of the item.
constexpr std::string_view TypeToString () const noexcept
 Gets the type as string.
template<class T>
decltype(auto) As ()
 Typed view of this item.
template<class T>
decltype(auto) As () const
 Typed view of this item.
Public Member Functions inherited from StormByte::Safe::Clonable< Base, StormByte::Safe::Shared< Base > >
constexpr Clonable ()=default
constexpr Clonable & operator= (const Clonable &)=default
virtual constexpr ~Clonable () noexcept=default

Static Public Attributes

static constexpr bool CommentTag = true
 Identifies this as a comment item.

Additional Inherited Members

Public Types inherited from StormByte::Safe::Clonable< Base, StormByte::Safe::Shared< Base > >
typedef SmartPointer PointerType
Static Public Member Functions inherited from StormByte::Config::Item::Base
static bool IsNameValid (std::string_view name) noexcept
 Checks if name is valid.
Static Public Member Functions inherited from StormByte::Safe::Clonable< Base, StormByte::Safe::Shared< Base > >
static PointerType MakePointer (Args &&... args)
Protected Attributes inherited from StormByte::Config::Item::Base
StormByte::Safe::String m_name
 Name of the item.

Detailed Description

template<CommentType T>
class StormByte::Config::Item::Comment< T >
@class Comment
@brief Comment item using Bash, C++ line, or C/C++ block syntax.
Template Parameters
TComment syntax (CommentType).

Constructor & Destructor Documentation

◆ Comment() [1/5]

template<CommentType T>
StormByte::Config::Item::Comment< T >::Comment ( const StormByte::Safe::String & comment)

Constructs a Comment with a Base-owned string.

Parameters
commentThe comment string.

◆ Comment() [2/5]

template<CommentType T>
StormByte::Config::Item::Comment< T >::Comment ( StormByte::Safe::String && comment)

Constructs a Comment by moving a Base-owned string.

Parameters
commentThe comment string.

◆ Comment() [3/5]

template<CommentType T>
StormByte::Config::Item::Comment< T >::Comment ( const char * comment)

Constructs a Comment from a NUL-terminated string.

Parameters
commentComment text.

◆ Comment() [4/5]

template<CommentType T>
StormByte::Config::Item::Comment< T >::Comment ( const Comment< T > & comment)

Copy constructor.

Parameters
commentComment to copy.

◆ Comment() [5/5]

template<CommentType T>
StormByte::Config::Item::Comment< T >::Comment ( Comment< T > && comment)
noexcept

Move constructor.

Parameters
commentComment to move.

◆ ~Comment() [1/4]

template<CommentType T>
StormByte::Config::Item::Comment< T >::~Comment ( )
overridenoexcept

Destructor, defined in the Config module.

◆ ~Comment() [2/4]

Destructor for Bash single-line comments.

◆ ~Comment() [3/4]

Destructor for C single-line comments.

◆ ~Comment() [4/4]

Destructor for C multi-line comments.

Member Function Documentation

◆ Clone()

template<CommentType T>
PointerType StormByte::Config::Item::Comment< T >::Clone ( ) const
overridevirtual

Clones the comment on Base's heap.

Returns
Cloned comment pointer.

Implements StormByte::Safe::Clonable< Base, StormByte::Safe::Shared< Base > >.

◆ CommentType()

template<CommentType T>
StormByte::Config::Item::CommentType StormByte::Config::Item::Comment< T >::CommentType ( ) const
inlineconstexprnoexcept

Gets the comment syntax.

Returns
Comment syntax.

◆ CommentTypeToString()

template<CommentType T>
std::string_view StormByte::Config::Item::Comment< T >::CommentTypeToString ( ) const
inlineconstexprnoexcept

Converts comment syntax to its text representation.

Returns
Comment syntax string.

◆ Equals() [1/4]

bool StormByte::Config::Item::Comment< CommentType::MultiLineC >::Equals ( const Base & other) const
virtualnoexcept

Equality for C multi-line comments.

Parameters
otherThe other item.
Returns
True when both comments match.

Implements StormByte::Config::Item::Base.

◆ Equals() [2/4]

bool StormByte::Config::Item::Comment< CommentType::SingleLineC >::Equals ( const Base & other) const
virtualnoexcept

Equality for C single-line comments.

Parameters
otherThe other item.
Returns
True when both comments match.

Implements StormByte::Config::Item::Base.

◆ Equals() [3/4]

bool StormByte::Config::Item::Comment< CommentType::SingleLineBash >::Equals ( const Base & other) const
virtualnoexcept

Equality for Bash single-line comments.

Parameters
otherThe other item.
Returns
True when both comments match.

Implements StormByte::Config::Item::Base.

◆ Equals() [4/4]

template<CommentType T>
bool StormByte::Config::Item::Comment< T >::Equals ( const Base & other) const
overridevirtualnoexcept

Polymorphic equality comparison.

Parameters
otherThe other item.
Returns
True when type, name, and text match.

Implements StormByte::Config::Item::Base.

◆ Move()

template<CommentType T>
PointerType StormByte::Config::Item::Comment< T >::Move ( )
overridevirtual

Moves the comment to Base's heap.

Returns
Moved comment pointer.

Implements StormByte::Safe::Clonable< Base, StormByte::Safe::Shared< Base > >.

◆ operator=() [1/2]

template<CommentType T>
Comment & StormByte::Config::Item::Comment< T >::operator= ( Comment< T > && comment)
noexcept

Move assignment operator.

Parameters
commentComment to move.
Returns
Reference to this Comment.

◆ operator=() [2/2]

template<CommentType T>
Comment & StormByte::Config::Item::Comment< T >::operator= ( const Comment< T > & comment)

Copy assignment operator.

Parameters
commentComment to copy.
Returns
Reference to this Comment.

◆ Serialize() [1/4]

StormByte::Safe::String StormByte::Config::Item::Comment< CommentType::MultiLineC >::Serialize ( const int & indent_level) const
virtualnoexcept

Serializes a C multi-line comment.

Parameters
indent_levelIndentation level.
Returns
Serialized comment.

Reimplemented from StormByte::Config::Item::Base.

◆ Serialize() [2/4]

StormByte::Safe::String StormByte::Config::Item::Comment< CommentType::SingleLineC >::Serialize ( const int & indent_level) const
virtualnoexcept

Serializes a C single-line comment.

Parameters
indent_levelIndentation level.
Returns
Serialized comment.

Reimplemented from StormByte::Config::Item::Base.

◆ Serialize() [3/4]

StormByte::Safe::String StormByte::Config::Item::Comment< CommentType::SingleLineBash >::Serialize ( const int & indent_level) const
virtualnoexcept

Serializes a Bash single-line comment.

Parameters
indent_levelIndentation level.
Returns
Serialized comment.

Reimplemented from StormByte::Config::Item::Base.

◆ Serialize() [4/4]

template<CommentType T>
StormByte::Safe::String StormByte::Config::Item::Comment< T >::Serialize ( const int & indent_level) const
overridevirtualnoexcept

Serializes the comment item.

Parameters
indent_levelIndentation level.
Returns
Serialized text.

Reimplemented from StormByte::Config::Item::Base.

◆ Text() [1/2]

template<CommentType T>
const StormByte::Safe::String & StormByte::Config::Item::Comment< T >::Text ( ) const
inlinenoexcept

Gets const comment text.

Returns
Comment text.

◆ Text() [2/2]

template<CommentType T>
StormByte::Safe::String & StormByte::Config::Item::Comment< T >::Text ( )
inlinenoexcept

Gets mutable comment text.

Returns
Comment text.

◆ Type()

template<CommentType T>
Item::Type StormByte::Config::Item::Comment< T >::Type ( ) const
inlineconstexproverridevirtualnoexcept

Gets the item type.

Returns
Item type.

Implements StormByte::Config::Item::Base.

Member Data Documentation

◆ CommentTag

template<CommentType T>
bool StormByte::Config::Item::Comment< T >::CommentTag = true
staticconstexpr

Identifies this as a comment item.


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