From cdc82d5686a57d16a736a2565ec27129a4b0f568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20B=C3=B6rchers?= Date: Sat, 29 Dec 2018 14:55:53 +0100 Subject: [PATCH] comments... and a lot of comments... --- src/Motorradvermietung.cpp | 40 +++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/Motorradvermietung.cpp b/src/Motorradvermietung.cpp index f6bbef8..76717e4 100644 --- a/src/Motorradvermietung.cpp +++ b/src/Motorradvermietung.cpp @@ -383,9 +383,25 @@ list reservations; * \brief Creates a new customer, let the user check the input and push it on the list. */ void create_customer(); + +/** + * \brief Creates a new reservation + */ void create_reservation(); + +/** + * \brief Rent a motorcycle + */ void rent_a_motorcycle(); + +/** + * \brief Export reservations to file. + */ void export_reservations(); + +/** + * \brief Shows the main menu and lets the user choice an option. + */ 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() { @@ -542,8 +558,8 @@ date get_validated_date(const string&& question) } /** - * \brief - * \return + * \brief Selects motorcycle from array. + * \return The index of the array. */ 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) { const auto start_sum = reservation->get_start_date().get_day_num(); @@ -583,6 +605,10 @@ bool validate_reservation(reservation* const reservation) 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() { const auto name = ask_question("Name des Kunden"); @@ -599,6 +625,9 @@ customer* get_customer() return customers.front(); } +/** + * \brief Creates a new reservation + */ void create_reservation() { system("cls"); @@ -633,6 +662,11 @@ void create_reservation() } +/** + * \brief + * \param current_customer + * \return + */ reservation* get_reservation_for_customer(customer* const current_customer) { auto index = 0;