AirInv Logo  1.00.0
C++ Simulated Airline Inventory Management System library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>
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) {
35  return hasBeenSuccessfull;
36  }
37 
45  // Fill out the reply to be sent to the client.
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 }