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

Comment item (#, // or /* *\/). More...

#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::String::String &comment)
 Constructs a Comment with the given string.
 
 Comment (StormByte::String::String &&comment)
 Move constructor from comment string.
 
 Comment (const char *comment)
 Constructs a Comment from a C string.
 
 Comment (const Comment &base)=default
 Copy constructor.
 
 Comment (Comment &&base) noexcept=default
 Move constructor.
 
Comment & operator= (const Comment &base)=default
 Copy assignment operator.
 
Comment & operator= (Comment &&base) noexcept=default
 Move assignment operator.
 
 ~Comment () noexcept override
 Destructor.
 
bool Equals (const Base &other) const noexcept override
 Polymorphic equality comparison.
 
StormByte::String::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 string.
 
StormByte::String::String & Text () noexcept
 Comment text.
 
const StormByte::String::String & Text () const noexcept
 Comment text.
 
PointerType Clone () const override
 Clones the comment.
 
PointerType Move () override
 Moves the comment.
 
 ~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::String::String Serialize (const int &indent_level) const noexcept
 Serializes a bash single-line comment.
 
StormByte::String::String Serialize (const int &indent_level) const noexcept
 Serializes a C single-line comment.
 
StormByte::String::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::String::String &name)
 Constructor.
 
 Base (const Base &base) noexcept=default
 Copy constructor.
 
 Base (Base &&base) noexcept=default
 Move constructor.
 
Base & operator= (const Base &base) noexcept=default
 Assignment operator.
 
Base & operator= (Base &&base) noexcept=default
 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::String::String & Name () const noexcept
 Gets the name of the item.
 
constexpr void Name (const StormByte::String::String &name)
 Sets 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::Clonable< Base, StormByte::Shared< Base > >
constexpr Clonable ()=default
 
constexpr Clonable (const Clonable &)=default
 
constexpr Clonable (Clonable &&) noexcept=default
 
constexpr Clonable & operator= (const Clonable &)=default
 
constexpr Clonable & operator= (Clonable &&) noexcept=default
 
virtual constexpr ~Clonable () noexcept=default
 

Static Public Attributes

static constexpr bool CommentTag = true
 

Additional Inherited Members

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

Detailed Description

template<CommentType T>
class StormByte::Config::Item::Comment< T >

Comment item (#, // or /* *\/).

Template Parameters
TComment syntax (CommentType).

Constructor & Destructor Documentation

◆ Comment() [1/5]

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

Constructs a Comment with the given string.

Parameters
commentThe comment string.

◆ Comment() [2/5]

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

Move constructor from comment string.

Parameters
commentComment string.

◆ Comment() [3/5]

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

Constructs a Comment from a C string.

Parameters
commentComment text.

◆ Comment() [4/5]

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

Copy constructor.

Parameters
baseComment to copy.

◆ Comment() [5/5]

template<CommentType T>
StormByte::Config::Item::Comment< T >::Comment ( Comment< T > &&  base)
defaultnoexcept

Move constructor.

Parameters
baseComment to move.

◆ ~Comment() [1/4]

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

Destructor.

Defined in this module so catch matches across a DLL.

◆ ~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
inlineoverridevirtual

Clones the comment.

Returns
Cloned comment.

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

◆ CommentType()

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

Gets the comment syntax.

Returns
Comment syntax.

◆ CommentTypeToString()

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

Converts comment syntax to string.

Returns
Comment syntax string.

◆ Equals() [1/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 if both are the same specialization and text.

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 if both are the same specialization and text.

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

◆ Equals() [3/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 if both are the same specialization and text.

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 to compare against.
Returns
true if both are the same comment specialization and content.

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

◆ Move()

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

Moves the comment.

Returns
Moved comment.

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

◆ operator=() [1/2]

template<CommentType T>
Comment & StormByte::Config::Item::Comment< T >::operator= ( Comment< T > &&  base)
defaultnoexcept

Move assignment operator.

Parameters
baseComment to move.
Returns
Reference to this Comment.

◆ operator=() [2/2]

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

Copy assignment operator.

Parameters
baseComment to copy.
Returns
Reference to this Comment.

◆ Serialize() [1/4]

StormByte::String::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 text.

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

◆ Serialize() [2/4]

StormByte::String::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 text.

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

◆ Serialize() [3/4]

StormByte::String::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 text.

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

◆ Serialize() [4/4]

template<CommentType T>
StormByte::String::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::String::String & StormByte::Config::Item::Comment< T >::Text ( ) const
inlinenoexcept

Comment text.

Returns
Text payload.

◆ Text() [2/2]

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

Comment text.

Returns
Text payload.

◆ Type()

template<CommentType T>
constexpr 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>
constexpr bool StormByte::Config::Item::Comment< T >::CommentTag = true
staticconstexpr

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