Encapsulates a string that is restricted to 255 bytes or less. More...
#include <DwmCredenceShortString.hh>
Public Member Functions | |
| ShortString ()=default | |
| Default constructor. | |
| ShortString (const ShortString &)=default | |
| Copy constructor. | |
| ShortString & | operator= (const ShortString &)=default |
| Assignment operator. | |
| ShortString (const std::string &s) | |
Construct from the given string s. | |
| ShortString & | operator= (const std::string &s) |
Assign from the given string s. | |
| ~ShortString () | |
| Destructor. | |
| const std::string & | Value () const |
| Returns the contained string value. | |
| operator std::string () const | |
| Returns a copy of the contained string value. | |
| std::istream & | Read (std::istream &is) |
Reads the short string from the given istream is. | |
| std::ostream & | Write (std::ostream &os) const |
Writes the shirt string to the given ostream os. | |
| bool | operator== (const ShortString &s) const |
| operator == | |
| void | Clear () |
| Clears the contents of the ShortString. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const ShortString &shortString) |
| ostream operator << | |
| std::istream & | operator>> (std::istream &is, ShortString &shortString) |
| istream operator >> | |
Encapsulates a string that is restricted to 255 bytes or less.
We use this to prevent a couple of memory resource DoS attacks on a server during session initialization.
| Dwm::Credence::ShortString::ShortString | ( | const std::string & | s | ) |
Construct from the given string s.
Throws an exception if s.size() is greater than 255.
| ShortString & Dwm::Credence::ShortString::operator= | ( | const std::string & | s | ) |
Assign from the given string s.
Throws an exception if s.size() is greater than 255 bytes.
| std::istream & Dwm::Credence::ShortString::Read | ( | std::istream & | is | ) |
Reads the short string from the given istream is.
Returns is.
| std::ostream & Dwm::Credence::ShortString::Write | ( | std::ostream & | os | ) | const |
Writes the shirt string to the given ostream os.
Returns os.
|
friend |
istream operator >>
Throws an exception if the string is longer than 255 characters. Note that the string can not include whitespace.