StdAir Logo  1.00.13
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
C++ Utility Class Browsing and Dumping the StdAir BOM Tree
/
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
// STL
#include <cassert>
#include <ostream>
// StdAir
namespace stdair {
FlagSaver (std::ostream& oStream)
: _oStream (oStream), _streamFlags (oStream.flags()) {
}
~FlagSaver() {
// Reset formatting flags of the given output stream
_oStream.flags (_streamFlags);
}
private:
std::ostream& _oStream;
std::ios::fmtflags _streamFlags;
};
// ////////////////////////////////////////////////////////////////////
void BomDisplay::list (std::ostream& oStream, const BomRoot& iBomRoot,
const AirlineCode_T& iAirlineCode,
const FlightNumber_T& iFlightNumber) {
// Save the formatting flags for the given STL output stream
FlagSaver flagSaver (oStream);
// Check whether there are Inventory objects
if (BomManager::hasList<Inventory> (iBomRoot) == false) {
return;
}
// Browse the inventories
unsigned short invIdx = 1;
const InventoryList_T& lInventoryList =
BomManager::getList<Inventory> (iBomRoot);
for (InventoryList_T::const_iterator itInv = lInventoryList.begin();
itInv != lInventoryList.end(); ++itInv, ++invIdx) {
const Inventory* lInv_ptr = *itInv;
assert (lInv_ptr != NULL);
// Retrieve the inventory key (airline code)
const AirlineCode_T& lAirlineCode = lInv_ptr->getAirlineCode();
// Display only the requested inventories
if (iAirlineCode == "all" || iAirlineCode == lAirlineCode) {
// Get the list of flight-dates for that inventory
list (oStream, *lInv_ptr, invIdx, iFlightNumber);
}
}
}
// ////////////////////////////////////////////////////////////////////
void BomDisplay::list (std::ostream& oStream, const Inventory& iInventory,
const unsigned short iInventoryIndex,
const FlightNumber_T& iFlightNumber) {
// Save the formatting flags for the given STL output stream
FlagSaver flagSaver (oStream);
// Check whether there are FlightDate objects
if (BomManager::hasMap<FlightDate> (iInventory) == false) {
return;
}
Handle on the StdAir library context.
std::list< Inventory * > InventoryList_T
std::string AirlineCode_T