From 24bdf39e6c21ab846f6c86803761d78a094e05c0 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 26 May 2022 20:31:26 +0300 Subject: Added files from project 1 (mirror) --- .../Project 1/docs/html/classString.html | 388 +++++++++++++++++++++ 1 file changed, 388 insertions(+) create mode 100644 Year 1/Object-oriented Programming/Project 1/docs/html/classString.html (limited to 'Year 1/Object-oriented Programming/Project 1/docs/html/classString.html') diff --git a/Year 1/Object-oriented Programming/Project 1/docs/html/classString.html b/Year 1/Object-oriented Programming/Project 1/docs/html/classString.html new file mode 100644 index 0000000..7f0e1be --- /dev/null +++ b/Year 1/Object-oriented Programming/Project 1/docs/html/classString.html @@ -0,0 +1,388 @@ + + + + + + + +FMI Ticket System: String Class Reference + + + + + + + + + +
+
+ + + + + + +
+
FMI Ticket System +
+
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+ +
String Class Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+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...
 
+

Constructor & Destructor Documentation

+ +

◆ String() [1/2]

+ +
+
+ + + + + + + + +
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() [2/2]

+ +
+
+ + + + + + + + +
String::String (const char * str)
+
+ +

Copies str.

+

\params str C-style string

+ +
+
+

Member Function Documentation

+ +

◆ compare()

+ +
+
+ + + + + + + + +
int String::compare (const String & other) const
+
+ +

Compares two strings.

+

\params other C-style string

Returns
strcmp between underlying C-style string and "other"
+ +
+
+ +

◆ operator+=() [1/2]

+ +
+
+ + + + + + + + +
String & String::operator+= (const char * str)
+
+ +

Appends a C-style string.

+

\params str C-style string

+ +
+
+ +

◆ operator+=() [2/2]

+ +
+
+ + + + + + + + +
String & String::operator+= (unsigned number)
+
+ +

Appends a number.

+

Converts the number to a C-style string and then uses += to append it.

+ +
+
+ +

◆ read()

+ +
+
+ + + + + + + + +
void String::read (std::istream & istr)
+
+ +

Reads String from stream.

+
Parameters
+ + +
istrAn input stream
+
+
+

Directly reads bytes from stream (calls read() function). First reads the string length, then the underlying C-style string (including terminating zero).

+
Remarks
Doesn't alter the stream in any other way.
+
Note
Best used with binary ifstream
+ +
+
+ +

◆ write()

+ +
+
+ + + + + + + + +
void String::write (std::ostream & ostr) const
+
+ +

Writes String to stream.

+
Parameters
+ + +
ostrAn output stream
+
+
+

Directly writes bytes to stream (calls write() function). First writes the string length, then the underlying C-style string (including terminating zero).

+
Remarks
Doesn't alter the stream in any other way.
+
Note
Best used with binary ofstream
+ +
+
+

Friends And Related Function Documentation

+ +

◆ operator<<

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
std::ostream & operator<< (std::ostream & ostr,
const String & event 
)
+
+friend
+
+ +

Writes String to stream with << operator.

+

Uses the stream's << operator to write the underlying C-style string

+
Note
Best used with std::cout or text std::ofstream
+ +
+
+ +

◆ operator>>

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
std::istream & operator>> (std::istream & istr,
String & event 
)
+
+friend
+
+ +

Reads String from stream with >> operator.

+

Uses the stream's getline function to read the data.

+
Warning
It takes at most 1024 characters from the stream!
+
Note
Best used with std::cin or text std::ifstream
+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + -- cgit v1.3.1-23-gd82d