Libmacro  0.2
Libmacro is an extensible macro and hotkey library.
mcr::String Class Reference

#include <string.h>

Public Member Functions

 String (const char *val=nullptr, size_t length=(size_t)~0)
 
 String (const std::string &val)
 
 String (const String &copytron)
 
Stringoperator= (const String &copytron)
 
Stringoperator= (const char *val)
 
 operator bool () const
 
bool operator! () const
 
const char * operator* () const
 
char & operator[] (size_t index)
 
const char & operator[] (size_t index) const
 
char * string ()
 
const char * string () const
 
void setString (const char *val=nullptr, size_t length=(size_t)~0)
 
void terminate ()
 
bool empty () const
 
size_t length () const
 
size_t size () const
 
void clear ()
 
void resize (size_t val)
 
void setLength (size_t val)
 

Detailed Description

Self-destructing, temporary copy of C-String.

Definition at line 35 of file string.h.

Member Function Documentation

§ operator bool()

mcr::String::operator bool ( ) const
inline

True if not empty

Definition at line 69 of file string.h.

§ operator!()

bool mcr::String::operator! ( ) const
inline

True if empty

Definition at line 74 of file string.h.

§ operator*()

const char* mcr::String::operator* ( ) const
inline

This object as C-String. Will always be valid, or at least an empty C-String.

Definition at line 81 of file string.h.

§ resize()

void mcr::String::resize ( size_t  val)

Reset char buffer to new string size.

Warning: This will reinitialize to an empty string[0] = '\0'
This is useful to use String as a buffer, but must be manually null-terminated, e.g. setLength.

§ setLength()

void mcr::String::setLength ( size_t  val)

Null-terminate and set the string length, without modifying the char buffer.

Precondition
Must have buffer length large enough for new string length.

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