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/classDate.html | 371 +++++++++++++++++++++ 1 file changed, 371 insertions(+) create mode 100644 Year 1/Object-oriented Programming/Project 1/docs/html/classDate.html (limited to 'Year 1/Object-oriented Programming/Project 1/docs/html/classDate.html') diff --git a/Year 1/Object-oriented Programming/Project 1/docs/html/classDate.html b/Year 1/Object-oriented Programming/Project 1/docs/html/classDate.html new file mode 100644 index 0000000..b37fe98 --- /dev/null +++ b/Year 1/Object-oriented Programming/Project 1/docs/html/classDate.html @@ -0,0 +1,371 @@ + + + + + + + +FMI Ticket System: Date Class Reference + + + + + + + + + +
+
+ + + + + + +
+
FMI Ticket System +
+
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+ +
Date Class Reference
+
+
+ +

Stores a day, month and year. + More...

+ +

#include <Date.h>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

+ Date ()
 Sets date as 01 May 2022.
 
 Date (const char *str)
 Parses string. More...
 
 Date (unsigned short day, unsigned short month, unsigned short year)
 Sets day, month and year. More...
 
+unsigned short get_day () const
 Returns the day.
 
bool set_day (unsigned short day)
 Sets the day. More...
 
+unsigned short get_month () const
 Returns the month.
 
bool set_month (unsigned short month)
 Sets the month. More...
 
+unsigned short get_year () const
 Returns the year.
 
bool set_year (unsigned short year)
 Sets the year. More...
 
String createString () const
 Returns the date as a String object. More...
 
void read (std::istream &istr)
 Reads date from stream. More...
 
void write (std::ostream &ostr)
 Writes date to stream. More...
 
int compare (const Date &other) const
 Compares two dates. More...
 
+

Detailed Description

+

Stores a day, month and year.

+

Constructor & Destructor Documentation

+ +

◆ Date() [1/2]

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

Parses string.

+
Parameters
+ + +
strC-style string
+
+
+

Values are initialized with zeroes. Then it parses the string:

+

Skips spaces, saves day with atoi, skips two characters, skips spaces, saves month with atoi, skips two characters, skips spaces, saves year with atoi.

+

Values are validated with setters. You should always have spaces between day, month and year and no non-numeric characters between them.

+
Remarks
If there are non-numeric characters, as per atoi() spec, the appropriate property is zero.
+ +
+
+ +

◆ Date() [2/2]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Date::Date (unsigned short day,
unsigned short month,
unsigned short year 
)
+
+ +

Sets day, month and year.

+

Initializes values with zeroes and then uses setters to save the function arguments.

+ +
+
+

Member Function Documentation

+ +

◆ compare()

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

Compares two dates.

+
Returns
-1 if this < other, 1 if this > other, 0 if this == other
+ +
+
+ +

◆ createString()

+ +
+
+ + + + + + + +
String Date::createString () const
+
+ +

Returns the date as a String object.

+
Returns
String object in the format "day.month.year"
+
Note
Currently there isn't any way to change the formatting
+ +
+
+ +

◆ read()

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

Reads date from stream.

+
Parameters
+ + +
istrAn input stream
+
+
+

Directly reads bytes from stream (calls read() function).

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

◆ set_day()

+ +
+
+ + + + + + + + +
bool Date::set_day (unsigned short newDay)
+
+ +

Sets the day.

+
Returns
Whether newDay was saved or not
+

If newDay is equal to 0, or is more than the appropriate days in the month, the day isn't set.

+ +
+
+ +

◆ set_month()

+ +
+
+ + + + + + + + +
bool Date::set_month (unsigned short newMonth)
+
+ +

Sets the month.

+
Returns
Whether newMonth was saved or not
+

If newMonth is equal to 0 or is more than 12, the month isn't set.

+ +
+
+ +

◆ set_year()

+ +
+
+ + + + + + + + +
bool Date::set_year (unsigned short newYear)
+
+ +

Sets the year.

+
Returns
Whether year was saved or not
+

Year isn't set when newYear is zero

+ +
+
+ +

◆ write()

+ +
+
+ + + + + + + + +
void Date::write (std::ostream & ostr)
+
+ +

Writes date to stream.

+
Parameters
+ + +
ostrAn output stream
+
+
+

Directly writes bytes to stream (calls write() function).

+
Remarks
Doesn't alter the stream in any other way.
+
Note
Best used with binary ofstream
+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + -- cgit v1.3.1-23-gd82d