38 bool hasCommandBeenSuccessfullyRetrieved =
true;
49 const std::string lRegEx(
"^[{][[:space:]]*\""
50 "([[:alpha:]|_]*)\"[[:space:]]*:"
53 "([[:alnum:]|[:punct:]|[:space:]]*)"
57 boost::regex lExpression (lRegEx);
59 const std::string& lBomJSONStr = iBomJSONStr.
getString();
60 std::string::const_iterator itStart = lBomJSONStr.begin();
61 std::string::const_iterator itEnd = lBomJSONStr.end();
63 boost::match_results<std::string::const_iterator> lWhat;
64 boost::match_flag_type lFlags = boost::match_default;
66 regex_search (itStart, itEnd, lWhat, lExpression, lFlags);
70 std::vector<std::string> oTokenList;
71 for (boost::match_results<std::string::const_iterator>::const_iterator itMatch
72 = lWhat.begin(); itMatch != lWhat.end(); ++itMatch) {
74 const std::string lMatchedString (std::string (itMatch->first,
76 oTokenList.push_back (lMatchedString);
81 if (oTokenList.size() <= 1) {
82 hasCommandBeenSuccessfullyRetrieved =
false;
83 return hasCommandBeenSuccessfullyRetrieved;
86 assert (oTokenList.size() >= 2);
88 const std::string lCommandStr = oTokenList.at(1);
93 hasCommandBeenSuccessfullyRetrieved =
false;
96 return hasCommandBeenSuccessfullyRetrieved;
103 bool hasKeyBeenSuccessfullyRetrieved =
true;
105#if BOOST_VERSION_MACRO >= 104100
114 std::istringstream iStr (iBomJSONStr.
getString());
115 read_json (iStr, pt);
118 bpt::ptree::const_iterator itBegin = pt.begin();
119 const std::string lCommandName = itBegin->first;
120 std::ostringstream lPath;
121 lPath << lCommandName <<
".airline_code";
127 }
catch (bpt::ptree_error& bptException) {
128 hasKeyBeenSuccessfullyRetrieved =
false;
132 return hasKeyBeenSuccessfullyRetrieved;
137 Date_T& ioDepartureDate) {
138 bool hasKeyBeenSuccessfullyRetrieved =
true;
140#if BOOST_VERSION_MACRO >= 104100
149 std::istringstream iStr (iBomJSONStr.
getString());
150 read_json (iStr, pt);
153 const std::string& lDepartureDateStr =
154 pt.get<std::string> (
"flight_date.departure_date");
159 boost::gregorian::from_simple_string (lDepartureDateStr);
161 }
catch (bpt::ptree_error& bptException) {
162 hasKeyBeenSuccessfullyRetrieved =
false;
166 return hasKeyBeenSuccessfullyRetrieved;
173 bool hasKeyBeenSuccessfullyRetrieved =
true;
175#if BOOST_VERSION_MACRO >= 104100
184 std::istringstream iStr (iBomJSONStr.
getString());
185 read_json (iStr, pt);
188 bpt::ptree::const_iterator itBegin = pt.begin();
189 const std::string lCommandName = itBegin->first;
190 std::ostringstream lPath;
191 lPath << lCommandName <<
".flight_number";
197 }
catch (bpt::ptree_error& bptException) {
198 hasKeyBeenSuccessfullyRetrieved =
false;
202 return hasKeyBeenSuccessfullyRetrieved;
209 bool hasKeyBeenSuccessfullyRetrieved =
true;
211#if BOOST_VERSION_MACRO >= 104100
220 std::istringstream iStr (iBomJSONStr.
getString());
221 read_json (iStr, pt);
224 bpt::ptree::const_iterator itBegin = pt.begin();
227 for (bpt::ptree::const_iterator itBP = ptListOfBP.begin();
228 itBP != ptListOfBP.end(); ++itBP) {
232 bpt::ptree::const_iterator itDate = ptBP.begin();
235 std::string lDateString = ptDate.data();
236 if (lDateString.empty() ==
false) {
239 boost::gregorian::from_simple_string (lDateString);
242 oBreakPointList.push_back (lBreakPoint);
245 }
catch (bpt::ptree_error& bptException) {
246 hasKeyBeenSuccessfullyRetrieved =
false;
247 }
catch (boost::bad_lexical_cast& eCast) {
248 hasKeyBeenSuccessfullyRetrieved =
false;
252 return hasKeyBeenSuccessfullyRetrieved;
259 bool hasKeyBeenSuccessfullyRetrieved =
true;
261#if BOOST_VERSION_MACRO >= 104100
270 std::istringstream iStr (iBomJSONStr.
getString());
271 read_json (iStr, pt);
274 bpt::ptree::const_iterator itBegin = pt.begin();
275 const std::string lEventTypeName = itBegin->first;
276 std::ostringstream lPath;
277 lPath << lEventTypeName <<
".event_type";
281 const std::string lEventTypeStr = pt.get<std::string> (lPath.str());
285 const EventType lEventType (lEventTypeStr);
286 ioEventType = lEventType.getType();
288 }
catch (bpt::ptree_error& bptException) {
289 hasKeyBeenSuccessfullyRetrieved =
false;
291 hasKeyBeenSuccessfullyRetrieved =
false;
295 return hasKeyBeenSuccessfullyRetrieved;