StormByte-Config 2.0.0
C++26 configuration-document module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Config::Item Namespace Reference

Configuration items (values, comments, groups, lists). More...

Classes

class  Base
 Base class for all configuration items. More...
 
struct  Binary
 Tag for As<Binary>() → StormByte::BinaryData. More...
 
struct  Bool
 Tag for As<Bool>() → bool. More...
 
class  Comment
 Comment item (#, // or /* *\/). More...
 
class  Container
 Holds child items. More...
 
struct  Double
 Tag for As<Double>() → double (Integer promotes). More...
 
class  Group
 Named container ({ ... }). More...
 
struct  Integer
 Tag for As<Integer>() → int. More...
 
class  List
 Unnamed container ([ ... ]). More...
 
struct  Text
 Tag for As<Text>() → StormByte::String::String. More...
 
class  Value
 Scalar configuration item. More...
 

Enumerations

enum class  Type : char {
  Bool , Comment , Container , Double ,
  Integer , String , Binary , Value
}
 Node kind in the document tree. More...
 
enum class  CommentType : char { SingleLineBash = 2 , SingleLineC = 5 , MultiLineC = 8 }
 Comment syntax used in the text document. More...
 
enum class  ContainerType : char { Group , List }
 Group ({}) or list ([]). More...
 

Functions

static constexpr std::string_view TypeToString (const Type &t) noexcept
 Converts a Type to its string representation.
 
constexpr std::string_view TypeToString (const CommentType &t) noexcept
 Converts a CommentType to a human-readable string.
 
constexpr std::string_view TypeToString (const ContainerType &t) noexcept
 Converts a ContainerType to a string.
 
constexpr ContainerType TypeFromStartCharacter (const char &start)
 Resolves a container type from its opening character.
 

Detailed Description

Configuration items (values, comments, groups, lists).

Enumeration Type Documentation

◆ CommentType

enum class StormByte::Config::Item::CommentType : char
strong

Comment syntax used in the text document.

Enumerator
SingleLineBash 

# until end of line

SingleLineC 

// until end of line

MultiLineC 

/* … *&zwj;/

◆ ContainerType

enum class StormByte::Config::Item::ContainerType : char
strong

Group ({}) or list ([]).

Enumerator
Group 

Group of named items.

List 

List of unnamed items.

◆ Type

enum class StormByte::Config::Item::Type : char
strong

Node kind in the document tree.

Enumerator
Bool 

Boolean leaf.

Comment 

Comment node.

Container 

Group or list.

Double 

Double leaf.

Integer 

Integer leaf.

String 

Text leaf (StormByte::String::String).

Binary 

Binary leaf (StormByte::BinaryData).

Value 

Any leaf (Value node). Not used on the wire.

Function Documentation

◆ TypeFromStartCharacter()

constexpr ContainerType StormByte::Config::Item::TypeFromStartCharacter ( const char &  start)
constexpr

Resolves a container type from its opening character.

Parameters
start{ or [.
Returns
Container type.
Exceptions
Exceptionif the character is not a container opener.

◆ TypeToString() [1/3]

constexpr std::string_view StormByte::Config::Item::TypeToString ( const CommentType &  t)
constexprnoexcept

Converts a CommentType to a human-readable string.

Parameters
tComment type to convert.
Returns
Literal description. Lives for the program.

◆ TypeToString() [2/3]

constexpr std::string_view StormByte::Config::Item::TypeToString ( const ContainerType &  t)
constexprnoexcept

Converts a ContainerType to a string.

Parameters
tContainer type to convert.
Returns
Literal name. Lives for the program.

◆ TypeToString() [3/3]

static constexpr std::string_view StormByte::Config::Item::TypeToString ( const Type &  t)
staticconstexprnoexcept

Converts a Type to its string representation.

Parameters
tThe Type to convert.
Returns
Literal name. Lives for the program.