StormByte C++ Library: Config module 1.0.1.9999
StormByte-Config is the configuration module of the StormByte C++ suite.
Loading...
Searching...
No Matches
List of all members
StormByte::Config::Item::Comment< T > Class Template Referencefinal

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

#include <comment.hxx>

Inheritance diagram for StormByte::Config::Item::Comment< T >:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Config::Item::Comment< T >:
Collaboration graph
[legend]

Public Member Functions

Construction
 Comment (const std::string &comment)
 Constructs a Comment with the given string.
 
 Comment (std::string &&comment)
 Move constructor from comment string.
 
 Comment (const Comment &base)=default
 Copy constructor.
 
 Comment (Comment &&base)=default
 Move constructor.
 
Commentoperator= (const Comment &base)=default
 Copy assignment operator.
 
Commentoperator= (Comment &&base)=default
 Move assignment operator.
 
 ~Comment () noexcept override=default
 Destructor.
 
Access
bool Equals (const Base &other) const noexcept override
 Polymorphic equality comparison.
 
std::string Serialize (const int &indent_level) const noexcept override
 Serializes the comment item.
 
constexpr Item::Type Type () const noexcept override
 Gets the item type.
 
std::optional< CommentTypeGetCommentType () const noexcept override
 Returns the concrete comment type of this Comment specialization.
 
constexpr StormByte::Config::Item::CommentType CommentType () const noexcept
 Gets the comment syntax.
 
constexpr std::string CommentTypeToString () const noexcept
 Converts comment syntax to string.
 
PointerType Clone () const override
 Clones the comment.
 
PointerType Move () override
 Moves the comment.
 
- Public Member Functions inherited from StormByte::Config::Item::Value< std::string >
 Value (const T &value)
 Constructs a Value with the given value.
 
 Value (const char *value)
 Constructs a string Value from a C string.
 
 Value (const char *name, const char *value)
 Constructs a named string Value from C strings.
 
 Value (T &&value)
 Move constructor from value.
 
 Value (const std::string &name, const T &value)
 Constructs a named Value.
 
 Value (std::string &&name, T &&value)
 Constructs a named Value (move).
 
 Value (const std::string &name, const char *value)
 Named string constructor from C string value.
 
 Value (std::string &&name, const char *value)
 Named string constructor (move name) from C string value.
 
 Value (const Value &single)=default
 Copy constructor.
 
 Value (Value &&single) noexcept=default
 Move constructor.
 
Valueoperator= (const Value &single)=default
 Copy assignment operator.
 
Valueoperator= (Value &&single) noexcept=default
 Move assignment operator.
 
virtual ~Value () noexcept override=default
 Destructor.
 
bool Equals (const Base &other) const noexcept override
 Polymorphic equality comparison.
 
bool operator== (const Value< T > &single) const noexcept
 Checks if two Value objects are equal.
 
bool operator!= (const Value< T > &single) const noexcept
 Inequality operator.
 
T & operator* () noexcept
 Gets the item value (mutable).
 
const T & operator* () const noexcept
 Gets the item value (const).
 
std::string Serialize (const int &indent_level) const noexcept override
 Serializes the item to a string.
 
- Public Member Functions inherited from StormByte::Config::Item::Base
 Base ()=default
 Default constructor.
 
 Base (const std::string &name)
 Constructs a Base item with a name.
 
 Base (const Base &base)=default
 Copy constructor.
 
 Base (Base &&base) noexcept=default
 Move constructor.
 
Baseoperator= (const Base &base)=default
 Copy assignment operator.
 
Baseoperator= (Base &&base) noexcept=default
 Move assignment operator.
 
virtual ~Base () noexcept=default
 Destructor.
 
bool operator== (const Base &other) const noexcept
 Equality operator.
 
bool operator!= (const Base &other) const noexcept
 Inequality operator.
 
constexpr const std::optional< std::string > & Name () const noexcept
 Gets the name of the item.
 
constexpr void Name (const std::string &name) noexcept
 Sets the item name.
 
bool IsNameValid () const noexcept
 Checks if the current name is valid.
 
constexpr std::string TypeToString () const noexcept
 Gets the item type as a string.
 
 operator std::string () const
 Converts the item to a string.
 
template<typename T >
const T & Value () const
 Gets the item value (const).
 
template<typename T >
T & Value ()
 Gets the item value (mutable).
 

Additional Inherited Members

- Protected Attributes inherited from StormByte::Config::Item::Value< std::string >
m_value
 The value of the item.
 
- Protected Attributes inherited from StormByte::Config::Item::Base
std::optional< std::string > m_name
 Item name.
 

Detailed Description

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

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

Template Parameters
TComment syntax (CommentType).

Constructor & Destructor Documentation

◆ Comment() [1/4]

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

Constructs a Comment with the given string.

Parameters
commentThe comment string.

◆ Comment() [2/4]

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

Move constructor from comment string.

Parameters
commentComment string.

◆ Comment() [3/4]

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

Copy constructor.

Parameters
baseComment to copy.

◆ Comment() [4/4]

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

Move constructor.

Parameters
baseComment to move.

Member Function Documentation

◆ Clone()

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

Clones the comment.

Returns
Cloned comment.

Reimplemented from StormByte::Config::Item::Value< std::string >.

◆ 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 StormByte::Config::Item::Comment< T >::CommentTypeToString ( ) const
inlineconstexprnoexcept

Converts comment syntax to string.

Returns
Comment syntax string.

◆ Equals()

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

Polymorphic equality comparison.

Parameters
otherThe other item to compare against.
Returns
true if both are comments of the same type and content.

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

◆ GetCommentType()

template<CommentType T>
std::optional< CommentType > StormByte::Config::Item::Comment< T >::GetCommentType ( ) const
inlineoverridevirtualnoexcept

Returns the concrete comment type of this Comment specialization.

Returns
The CommentType corresponding to the template parameter T.

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

◆ Move()

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

Moves the comment.

Returns
Moved comment.

Reimplemented from StormByte::Config::Item::Value< std::string >.

◆ operator=() [1/2]

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

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()

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

Serializes the comment item.

Parameters
indent_levelIndentation level.
Returns
Serialized string.

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

◆ Type()

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

Gets the item type.

Returns
Item type.

Reimplemented from StormByte::Config::Item::Value< std::string >.


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