|
FMI Ticket System
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
|
Public Member Functions | |
| String (unsigned length) | |
| The underlying array is allocated with length (+ 1) size. More... | |
| String (const char *str) | |
| Copies str. More... | |
| const char * | get_cstr () const |
| Returns internal C-style string. | |
| unsigned | get_length () const |
| Returns number of characters in string. | |
| char & | operator[] (unsigned index) |
| Returns a character reference (from the underlying C-style string) at the given index. | |
| String & | operator+= (const char *str) |
| Appends a C-style string. More... | |
| String & | operator+= (unsigned number) |
| Appends a number. More... | |
| String (const String &other) | |
| String & | operator= (const String &other) |
| String (String &&other) | |
| String & | operator= (String &&other) |
| void | read (std::istream &istr) |
| Reads String from stream. More... | |
| void | write (std::ostream &ostr) const |
| Writes String to stream. More... | |
| int | compare (const String &other) const |
| Compares two strings. More... | |
Friends | |
| std::istream & | operator>> (std::istream &istr, String &event) |
| Reads String from stream with >> operator. More... | |
| std::ostream & | operator<< (std::ostream &ostr, const String &event) |
| Writes String to stream with << operator. More... | |
| String::String | ( | unsigned | length | ) |
The underlying array is allocated with length (+ 1) size.
Allocated with length + 1 size, so there is a terminating zero at the end.
| String::String | ( | const char * | str | ) |
Copies str.
\params str C-style string
| int String::compare | ( | const String & | other | ) | const |
Compares two strings.
\params other C-style string
| String & String::operator+= | ( | const char * | str | ) |
Appends a C-style string.
\params str C-style string
| String & String::operator+= | ( | unsigned | number | ) |
Appends a number.
Converts the number to a C-style string and then uses += to append it.
| void String::read | ( | std::istream & | istr | ) |
| void String::write | ( | std::ostream & | ostr | ) | const |
|
friend |
Writes String to stream with << operator.
Uses the stream's << operator to write the underlying C-style string
|
friend |
Reads String from stream with >> operator.
Uses the stream's getline function to read the data.