|
Offline Transaction Signing (OTS) 0.1.0
|
String class that wipes its memory on destruction. More...
#include <ots.hpp>
Public Member Functions | |
| WipeableString () noexcept=default | |
| Default constructor. | |
| WipeableString (const std::string &s) | |
| Construct from std::string. | |
| WipeableString (const char *s) | |
| Construct from C-string. | |
| WipeableString (const char *s, size_t n) | |
| Construct from string and length. | |
| WipeableString (const WipeableString &other) | |
| Copy constructor. | |
| WipeableString (WipeableString &&other) noexcept | |
| Move constructor. | |
| WipeableString & | operator= (const WipeableString &other) |
| Copy assignment operator. | |
| WipeableString & | operator= (WipeableString &&other) noexcept |
| Move assignment operator. | |
| WipeableString & | operator= (const char *s) |
| Assignment operator for C-string. | |
| ~WipeableString () | |
| Destructor that wipes memory. | |
| std::string | insecure () const noexcept |
| Create an insecure std::string copy. | |
| const char * | c_str () const noexcept |
| Get C-string representation. | |
| const char * | data () const noexcept |
| Get string data. | |
| size_t | size () const noexcept |
| Get string length. | |
| bool | empty () const noexcept |
| Check if string is empty. | |
| void | clear () noexcept |
| Clear string content. | |
| size_t | capacity () const noexcept |
| Get string capacity. | |
| void | reserve (size_t n) |
| Reserve memory for string. | |
| WipeableString | substr (size_t pos=0, size_t len=std::string::npos) const |
| Get substring. | |
| size_t | find (const WipeableString &str, size_t pos=0) const noexcept |
| Find substring. | |
| size_t | find (const char *s, size_t pos=0) const noexcept |
| Find C-string. | |
| WipeableString & | append (const WipeableString &str) |
| Append string. | |
| WipeableString & | append (const char *s) |
| Append C-string. | |
| WipeableString & | operator+= (const WipeableString &str) |
| Append operator. | |
| WipeableString & | operator+= (const char *s) |
| Append C-string operator. | |
| bool | operator== (const WipeableString &other) const noexcept |
| Compare with another WipeableString. | |
| bool | operator!= (const WipeableString &other) const noexcept |
| Compare inequality with another WipeableString. | |
| operator std::string () const | |
| Conversion to std::string is explicitly prevented. | |
| int | compare (const WipeableString &other) const noexcept |
| Compare strings. | |
Static Public Attributes | |
| static constexpr size_t | npos = std::string::npos |
| Static npos value. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const WipeableString &str) |
| Stream output operator. | |
String class that wipes its memory on destruction.
|
defaultnoexcept |
Default constructor.
|
inlineexplicit |
Construct from std::string.
|
explicit |
Construct from C-string.
| ots::WipeableString::WipeableString | ( | const char * | s, |
| size_t | n | ||
| ) |
Construct from string and length.
| ots::WipeableString::WipeableString | ( | const WipeableString & | other | ) |
Copy constructor.
|
noexcept |
Move constructor.
| ots::WipeableString::~WipeableString | ( | ) |
Destructor that wipes memory.
| WipeableString & ots::WipeableString::append | ( | const char * | s | ) |
Append C-string.
| WipeableString & ots::WipeableString::append | ( | const WipeableString & | str | ) |
Append string.
|
noexcept |
Get C-string representation.
|
noexcept |
Get string capacity.
|
noexcept |
Clear string content.
|
noexcept |
Compare strings.
|
noexcept |
Get string data.
|
noexcept |
Check if string is empty.
|
noexcept |
Find C-string.
|
noexcept |
Find substring.
|
noexcept |
Create an insecure std::string copy.
| ots::WipeableString::operator std::string | ( | ) | const |
Conversion to std::string is explicitly prevented.
|
noexcept |
Compare inequality with another WipeableString.
| WipeableString & ots::WipeableString::operator+= | ( | const char * | s | ) |
Append C-string operator.
| WipeableString & ots::WipeableString::operator+= | ( | const WipeableString & | str | ) |
Append operator.
| WipeableString & ots::WipeableString::operator= | ( | const char * | s | ) |
Assignment operator for C-string.
| WipeableString & ots::WipeableString::operator= | ( | const WipeableString & | other | ) |
Copy assignment operator.
|
noexcept |
Move assignment operator.
|
noexcept |
Compare with another WipeableString.
| void ots::WipeableString::reserve | ( | size_t | n | ) |
Reserve memory for string.
|
noexcept |
Get string length.
| WipeableString ots::WipeableString::substr | ( | size_t | pos = 0, |
| size_t | len = std::string::npos |
||
| ) | const |
Get substring.
|
friend |
Stream output operator.
|
staticconstexpr |
Static npos value.