GlitchyByte Lib  0.3.1
GlitchyByte general library to bootstrap development.
Public Member Functions | List of all members
gb::StringInterpolationVars Class Reference

Public Member Functions

 StringInterpolationVars () noexcept=default
 
 StringInterpolationVars (StringInterpolationVars const &other) noexcept
 
 StringInterpolationVars (StringInterpolationVars &&other) noexcept
 
StringInterpolationVarsoperator= (StringInterpolationVars const &other) noexcept
 
StringInterpolationVarsoperator= (StringInterpolationVars &&other) noexcept
 
StringInterpolationVarsset (std::string_view const name, std::string_view const value) noexcept
 
std::string interpolate (std::string_view const str) const noexcept
 
std::string string () const noexcept
 

Detailed Description

Class to hold variable names and their values for string interpolation.

Variables in strings are of the form "${myVar}".

Set that variable on this object by calling set("myVar", "5").

Constructor & Destructor Documentation

◆ StringInterpolationVars() [1/3]

gb::StringInterpolationVars::StringInterpolationVars ( )
defaultnoexcept

Creates a template string var container.

◆ StringInterpolationVars() [2/3]

gb::StringInterpolationVars::StringInterpolationVars ( StringInterpolationVars const &  other)
inlinenoexcept

Copy constructor.

Parameters
otherOther object to copy from.

◆ StringInterpolationVars() [3/3]

gb::StringInterpolationVars::StringInterpolationVars ( StringInterpolationVars &&  other)
inlinenoexcept

Move constructor.

Parameters
otherOther object to move the contents from.

Member Function Documentation

◆ operator=() [1/2]

StringInterpolationVars& gb::StringInterpolationVars::operator= ( StringInterpolationVars const &  other)
inlinenoexcept

Copy assignment.

Parameters
otherOther object to copy from.
Returns
This object with new contents.

◆ operator=() [2/2]

StringInterpolationVars& gb::StringInterpolationVars::operator= ( StringInterpolationVars &&  other)
inlinenoexcept

Move assignment.

Parameters
otherOther object to move the contents from.
Returns
This object with new contents.

◆ set()

StringInterpolationVars& gb::StringInterpolationVars::set ( std::string_view const  name,
std::string_view const  value 
)
inlinenoexcept

Sets a template variable and its value.

Parameters
nameVariable name.
valueValue.
Returns
This object.

◆ interpolate()

std::string gb::StringInterpolationVars::interpolate ( std::string_view const  str) const
inlinenoexcept

Substitutes variables in a string template.

Parameters
strString template.
Returns
The interpolated string.

◆ string()

std::string gb::StringInterpolationVars::string ( ) const
inlinenoexcept

String representation.

Returns
The string representation.

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