Empirical
Public Types | Public Member Functions | List of all members
emp::DynamicString Class Reference

#include <DynamicString.h>

Public Types

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

Public Member Functions

 DynamicString ()
 
 DynamicString (const DynamicString &)=default
 
size_t GetSize () const
 How many string components (funcations or continuous substrings) are in this DynamicString? More...
 
std::string operator[] (size_t id) const
 
const value_tGetFunction (size_t id) const
 
DynamicStringClear ()
 Remove all contents on this DynamicString. More...
 
std::string str ()
 Convert to an std::string. More...
 
DynamicStringSet (size_t id, const value_t &in_fun)
 Set the value of a specified component to the provided function. More...
 
DynamicStringSet (size_t id, const std::string &in_text)
 Set the value of a specified component to the provided std::string text. More...
 
DynamicStringAppend (const value_t &in_fun)
 Add a new function to the end of the DynamicString. More...
 
DynamicStringAppend (const std::string &in_text)
 Add new std::string text to the end of the DynamicString. More...
 
template<typename IN_TYPE >
DynamicStringoperator<< (IN_TYPE &&_in)
 Allow operator<< to append to the back of a DynamicString. More...
 

Detailed Description

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

Member Typedef Documentation

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

Constructor & Destructor Documentation

emp::DynamicString::DynamicString ( )
inline
emp::DynamicString::DynamicString ( const DynamicString )
default

Member Function Documentation

DynamicString& emp::DynamicString::Append ( const value_t in_fun)
inline

Add a new function to the end of the DynamicString.

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

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

DynamicString& emp::DynamicString::Clear ( )
inline

Remove all contents on this DynamicString.

const value_t& emp::DynamicString::GetFunction ( size_t  id) const
inline

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

size_t emp::DynamicString::GetSize ( ) const
inline

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

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

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

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

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

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

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

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

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

std::string emp::DynamicString::str ( )
inline

Convert to an std::string.


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