DynamicString.hpp

A string handler where sections update dynamically based on functions.

Note

Status: BETA

class DynamicString
#include <DynamicString.hpp>

A string handler where some sections can be fixed strings, while others update dynamically based on functions.

Public Types

using value_t = std::function<std::string()>

Public Functions

inline DynamicString()
DynamicString(const DynamicString&) = default
inline size_t GetSize() const

How many string components (functions or continuous substrings) are in this DynamicString?

inline std::string operator[](size_t id) const

Index in to a specific component (not a specific character, since size is variable) and return it’s associated string.

inline const value_t &GetFunction(size_t id) const

Index in to a specific component (not a specific character, since size is variable) and return it’s associated function.

inline DynamicString &Clear()

Remove all contents on this DynamicString.

inline std::string str()

Convert to an std::string.

inline DynamicString &Set(size_t id, const value_t &in_fun)

Set the value of a specified component to the provided function.

inline DynamicString &Set(size_t id, const std::string &in_text)

Set the value of a specified component to the provided std::string text.

inline DynamicString &Append(const value_t &in_fun)

Add a new function to the end of the DynamicString.

inline DynamicString &Append(const std::string &in_text)

Add new std::string text to the end of the DynamicString.

template<typename IN_TYPE>
inline DynamicString &operator<<(IN_TYPE &&_in)

Allow operator<< to append to the back of a DynamicString.

Private Members

vector<value_t> fun_set