1.00.12
C++ Simulated Airline Inventory Management System Library
Loading...
Searching...
No Matches
RequestHandler.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <string>
7
#include <fstream>
8
#include <sstream>
9
// Boost
10
#include <boost/lexical_cast.hpp>
11
// StdAir
12
// AirInv
13
#include <
airinv/server/Reply.hpp
>
14
#include <
airinv/server/Request.hpp
>
15
#include <
airinv/server/RequestHandler.hpp
>
16
17
namespace
AIRINV
{
18
19
// //////////////////////////////////////////////////////////////////////
20
RequestHandler::RequestHandler
(
const
stdair::AirlineCode_T& iAirlineCode)
21
: _airlineCode (iAirlineCode) {
22
}
23
24
// //////////////////////////////////////////////////////////////////////
25
bool
RequestHandler::
26
handleRequest
(
Request
& ioRequest,
Reply
& ioReply)
const
{
27
bool
hasBeenSuccessfull =
false
;
28
29
// Decode request string to a flight-date details (airline code,
30
// flight number and departure date)
31
hasBeenSuccessfull = ioRequest.
parseFlightDate
();
32
33
if
(hasBeenSuccessfull ==
false
) {
34
ioReply.
_status
=
FlightRequestStatus::INTERNAL_ERROR
;
35
return
hasBeenSuccessfull;
36
}
37
44
45
// Fill out the reply to be sent to the client.
46
ioReply.
_status
=
FlightRequestStatus::OK
;
47
ioReply.
content
=
"Your are looking for: '"
+ ioRequest.
_flightDetails
+
"'. Ok, I have found your flight-date. Be patient until I give you more information about it"
;
48
49
return
hasBeenSuccessfull;
50
}
51
52
}
Reply.hpp
RequestHandler.hpp
Request.hpp
AIRINV::RequestHandler::RequestHandler
RequestHandler(const stdair::AirlineCode_T &)
Definition
RequestHandler.cpp:20
AIRINV::RequestHandler::handleRequest
bool handleRequest(Request &, Reply &) const
Definition
RequestHandler.cpp:26
AIRINV
Definition
AIRINV_Master_Service.hpp:38
AIRINV::FlightRequestStatus::INTERNAL_ERROR
@ INTERNAL_ERROR
Definition
FlightRequestStatus.hpp:20
AIRINV::FlightRequestStatus::OK
@ OK
Definition
FlightRequestStatus.hpp:18
AIRINV::Reply
Definition
Reply.hpp:18
AIRINV::Reply::content
std::string content
Definition
Reply.hpp:23
AIRINV::Reply::_status
FlightRequestStatus::EN_FlightRequestStatus _status
Definition
Reply.hpp:20
AIRINV::Request
Definition
Request.hpp:18
AIRINV::Request::_flightDetails
std::string _flightDetails
Definition
Request.hpp:29
AIRINV::Request::parseFlightDate
bool parseFlightDate()
Definition
Request.cpp:12
Generated on Mon May 5 2025 00:00:00 for AirInv by
1.13.2