comments... and a lot of comments...

This commit is contained in:
Holger Börchers 2018-12-29 14:55:53 +01:00
parent f3a349f7cf
commit cdc82d5686

View File

@ -383,9 +383,25 @@ list<reservation*> reservations;
* \brief Creates a new customer, let the user check the input and push it on the list. * \brief Creates a new customer, let the user check the input and push it on the list.
*/ */
void create_customer(); void create_customer();
/**
* \brief Creates a new reservation
*/
void create_reservation(); void create_reservation();
/**
* \brief Rent a motorcycle
*/
void rent_a_motorcycle(); void rent_a_motorcycle();
/**
* \brief Export reservations to file.
*/
void export_reservations(); void export_reservations();
/**
* \brief Shows the main menu and lets the user choice an option.
*/
void main_menu(); void main_menu();
/** /**
@ -399,7 +415,7 @@ int main()
} }
/** /**
* \brief Let the user choice an option. * \brief Shows the main menu and lets the user choice an option.
*/ */
void main_menu() void main_menu()
{ {
@ -542,8 +558,8 @@ date get_validated_date(const string&& question)
} }
/** /**
* \brief * \brief Selects motorcycle from array.
* \return * \return The index of the array.
*/ */
int select_motorcycle() int select_motorcycle()
{ {
@ -565,6 +581,12 @@ int select_motorcycle()
} }
/**
* \brief Validates the reservation based on the start and end dates.
* The method checks that the time period does not overlap with others.
* \param reservation current reservation to check
* \return True, if reservation is ok. False otherwise.
*/
bool validate_reservation(reservation* const reservation) bool validate_reservation(reservation* const reservation)
{ {
const auto start_sum = reservation->get_start_date().get_day_num(); const auto start_sum = reservation->get_start_date().get_day_num();
@ -583,6 +605,10 @@ bool validate_reservation(reservation* const reservation)
return true; return true;
} }
/**
* \brief Gets customer with the right name. It asks for the first name, only if necessary.
* \return Pointer to the customer. Returns nullptr, if customer not found.
*/
customer* get_customer() customer* get_customer()
{ {
const auto name = ask_question<string>("Name des Kunden"); const auto name = ask_question<string>("Name des Kunden");
@ -599,6 +625,9 @@ customer* get_customer()
return customers.front(); return customers.front();
} }
/**
* \brief Creates a new reservation
*/
void create_reservation() void create_reservation()
{ {
system("cls"); system("cls");
@ -633,6 +662,11 @@ void create_reservation()
} }
/**
* \brief
* \param current_customer
* \return
*/
reservation* get_reservation_for_customer(customer* const current_customer) reservation* get_reservation_for_customer(customer* const current_customer)
{ {
auto index = 0; auto index = 0;