#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <string>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/regex.hpp>
#include <boost/program_options.hpp>
#include <opentrep/ui/cmdline/SReadline.hpp>
#include <opentrep/OPENTREP_Service.hpp>
#include <opentrep/Location.hpp>
#include <opentrep/CityDetails.hpp>
#include <opentrep/basic/BasConst_OPENTREP_Service.hpp>
#include <opentrep/basic/Utilities.hpp>
#include <opentrep/config/opentrep-paths.hpp>
#include <opentrep/service/Logger.hpp>
Go to the source code of this file.
Classes | |
struct | Command_T |
Typedefs | |
typedef std::vector< std::string > | WordList_T |
typedef std::vector< std::string > | TokenList_T |
Functions | |
const std::string | K_OPENTREP_DEFAULT_LOG_FILENAME ("opentrep-dbmgr.log") |
template<class T> | |
std::ostream & | operator<< (std::ostream &os, const std::vector< T > &v) |
int | readConfiguration (int argc, char *argv[], std::string &ioPORFilepath, std::string &ioXapianDBFilepath, std::string &ioSQLDBTypeString, std::string &ioSQLDBConnectionString, unsigned short &ioDeploymentNumber, bool &ioIncludeNonIATAPOR, bool &ioIndexPORInXapian, bool &ioAddPORInDB, std::string &ioLogFilename) |
void | initReadline (swift::SReadline &ioInputReader) |
Command_T::Type_T | extractCommand (TokenList_T &ioTokenList) |
void | parseConnectionString (const TokenList_T &iTokenList, std::string &ioConnectionString) |
void | parsePlaceKey (const TokenList_T &iTokenList, std::string &ioPlaceKey) |
std::string | toString (const TokenList_T &iTokenList) |
TokenList_T | extractTokenList (const TokenList_T &iTokenList, const std::string &iRegularExpression) |
TokenList_T | extractTokenListForIataCode (const TokenList_T &iTokenList) |
TokenList_T | extractTokenListForIcaoCode (const TokenList_T &iTokenList) |
TokenList_T | extractTokenListForFaaCode (const TokenList_T &iTokenList) |
TokenList_T | extractTokenListForUNLOCode (const TokenList_T &iTokenList) |
TokenList_T | extractTokenListForUICCode (const TokenList_T &iTokenList) |
TokenList_T | extractTokenListForGeonameID (const TokenList_T &iTokenList) |
int | main (int argc, char *argv[]) |
Variables | |
const int | K_OPENTREP_EARLY_RETURN_STATUS = 99 |
typedef std::vector<std::string> WordList_T |
Definition at line 26 of file opentrep-dbmgr.cpp.
typedef std::vector<std::string> TokenList_T |
List of strings, representing the tokens as entered by the user on a command-line.
Definition at line 44 of file opentrep-dbmgr.cpp.
const std::string K_OPENTREP_DEFAULT_LOG_FILENAME | ( | "opentrep-dbmgr.log" | ) |
Default name and location for the log file.
std::ostream & operator<< | ( | std::ostream & | os, |
const std::vector< T > & | v ) |
Definition at line 80 of file opentrep-dbmgr.cpp.
int readConfiguration | ( | int | argc, |
char * | argv[], | ||
std::string & | ioPORFilepath, | ||
std::string & | ioXapianDBFilepath, | ||
std::string & | ioSQLDBTypeString, | ||
std::string & | ioSQLDBConnectionString, | ||
unsigned short & | ioDeploymentNumber, | ||
bool & | ioIncludeNonIATAPOR, | ||
bool & | ioIndexPORInXapian, | ||
bool & | ioAddPORInDB, | ||
std::string & | ioLogFilename ) |
Read and parse the command line options.
Definition at line 89 of file opentrep-dbmgr.cpp.
References OPENTREP::DEFAULT_OPENTREP_ADD_IN_DB, OPENTREP::DEFAULT_OPENTREP_DEPLOYMENT_NUMBER, OPENTREP::DEFAULT_OPENTREP_INCLUDE_NONIATA_POR, OPENTREP::DEFAULT_OPENTREP_INDEX_IN_XAPIAN, OPENTREP::DEFAULT_OPENTREP_MYSQL_CONN_STRING, OPENTREP::DEFAULT_OPENTREP_POR_FILEPATH, OPENTREP::DEFAULT_OPENTREP_SQL_DB_TYPE, OPENTREP::DEFAULT_OPENTREP_SQLITE_DB_FILEPATH, OPENTREP::DEFAULT_OPENTREP_XAPIAN_DB_FILEPATH, K_OPENTREP_DEFAULT_LOG_FILENAME(), K_OPENTREP_EARLY_RETURN_STATUS, OPENTREP::DBType::MYSQL, OPENTREP::DBType::NODB, OPENTREP::parseAndDisplayConnectionString(), and OPENTREP::DBType::SQLITE3.
Referenced by main().
void initReadline | ( | swift::SReadline & | ioInputReader | ) |
Definition at line 270 of file opentrep-dbmgr.cpp.
References swift::SReadline::RegisterCompletions().
Referenced by main().
Command_T::Type_T extractCommand | ( | TokenList_T & | ioTokenList | ) |
Definition at line 307 of file opentrep-dbmgr.cpp.
References Command_T::CREATE_INDEXES, Command_T::CREATE_TABLES, Command_T::CREATE_USER, Command_T::FILL_FROM_POR_FILE, Command_T::HELP, Command_T::INFO, Command_T::LAST_VALUE, Command_T::LIST_ALL, Command_T::LIST_BY_FAA, Command_T::LIST_BY_GEONAMEID, Command_T::LIST_BY_IATA, Command_T::LIST_BY_ICAO, Command_T::LIST_BY_UICCODE, Command_T::LIST_BY_UNLOCODE, Command_T::LIST_CONT, Command_T::LIST_NB, Command_T::NOP, Command_T::QUIT, Command_T::RESET_CONNECTION_STRING, Command_T::TOGGLE_DEPLOYMENT_NUMBER, Command_T::TOGGLE_NONIATA_INDEXING_FLAG, Command_T::TOGGLE_SQLDB_INSERTING_FLAG, Command_T::TOGGLE_XAPIAN_IDEXING_FLAG, and Command_T::TUTORIAL.
Referenced by main().
void parseConnectionString | ( | const TokenList_T & | iTokenList, |
std::string & | ioConnectionString ) |
Definition at line 394 of file opentrep-dbmgr.cpp.
void parsePlaceKey | ( | const TokenList_T & | iTokenList, |
std::string & | ioPlaceKey ) |
Definition at line 408 of file opentrep-dbmgr.cpp.
Referenced by main().
std::string toString | ( | const TokenList_T & | iTokenList | ) |
Definition at line 421 of file opentrep-dbmgr.cpp.
Referenced by extractTokenList(), OPENTREP::Result::fullTextMatch(), main(), OPENTREP::Place::toStream(), OPENTREP::Result::toStream(), OPENTREP::ResultCombination::toStream(), and OPENTREP::ResultHolder::toStream().
TokenList_T extractTokenList | ( | const TokenList_T & | iTokenList, |
const std::string & | iRegularExpression ) |
Definition at line 438 of file opentrep-dbmgr.cpp.
References toString().
Referenced by extractTokenListForFaaCode(), extractTokenListForGeonameID(), extractTokenListForIataCode(), extractTokenListForIcaoCode(), extractTokenListForUICCode(), and extractTokenListForUNLOCode().
TokenList_T extractTokenListForIataCode | ( | const TokenList_T & | iTokenList | ) |
Definition at line 474 of file opentrep-dbmgr.cpp.
References extractTokenList().
Referenced by main().
TokenList_T extractTokenListForIcaoCode | ( | const TokenList_T & | iTokenList | ) |
Definition at line 488 of file opentrep-dbmgr.cpp.
References extractTokenList().
Referenced by main().
TokenList_T extractTokenListForFaaCode | ( | const TokenList_T & | iTokenList | ) |
Definition at line 502 of file opentrep-dbmgr.cpp.
References extractTokenList().
Referenced by main().
TokenList_T extractTokenListForUNLOCode | ( | const TokenList_T & | iTokenList | ) |
Definition at line 516 of file opentrep-dbmgr.cpp.
References extractTokenList().
Referenced by main().
TokenList_T extractTokenListForUICCode | ( | const TokenList_T & | iTokenList | ) |
Definition at line 530 of file opentrep-dbmgr.cpp.
References extractTokenList().
Referenced by main().
TokenList_T extractTokenListForGeonameID | ( | const TokenList_T & | iTokenList | ) |
Definition at line 544 of file opentrep-dbmgr.cpp.
References extractTokenList().
Referenced by main().
int main | ( | int | argc, |
char * | argv[] ) |
Definition at line 559 of file opentrep-dbmgr.cpp.
References Command_T::CREATE_INDEXES, Command_T::CREATE_TABLES, Command_T::CREATE_USER, OPENTREP::OPENTREP_Service::createSQLDBIndexes(), OPENTREP::OPENTREP_Service::createSQLDBTables(), OPENTREP::OPENTREP_Service::createSQLDBUser(), OPENTREP::DEFAULT_OPENTREP_DEPLOYMENT_NUMBER_SIZE, OPENTREP::DBType::describe(), extractCommand(), extractTokenListForFaaCode(), extractTokenListForGeonameID(), extractTokenListForIataCode(), extractTokenListForIcaoCode(), extractTokenListForUICCode(), extractTokenListForUNLOCode(), Command_T::FILL_FROM_POR_FILE, OPENTREP::OPENTREP_Service::getFilePaths(), OPENTREP::OPENTREP_Service::getIndexSize(), swift::SReadline::GetLine(), OPENTREP::OPENTREP_Service::getNbOfPORFromDB(), Command_T::HELP, Command_T::INFO, initReadline(), OPENTREP::OPENTREP_Service::insertIntoDBAndXapian(), K_OPENTREP_EARLY_RETURN_STATUS, Command_T::LAST_VALUE, Command_T::LIST_ALL, Command_T::LIST_BY_FAA, Command_T::LIST_BY_GEONAMEID, Command_T::LIST_BY_IATA, Command_T::LIST_BY_ICAO, Command_T::LIST_BY_UICCODE, Command_T::LIST_BY_UNLOCODE, Command_T::LIST_NB, OPENTREP::OPENTREP_Service::listByFaaCode(), OPENTREP::OPENTREP_Service::listByGeonameID(), OPENTREP::OPENTREP_Service::listByIataCode(), OPENTREP::OPENTREP_Service::listByIcaoCode(), OPENTREP::OPENTREP_Service::listByUICCode(), OPENTREP::OPENTREP_Service::listByUNLOCode(), OPENTREP::DBType::NODB, Command_T::NOP, OPENTREP_LOG_DEBUG, parsePlaceKey(), Command_T::QUIT, readConfiguration(), Command_T::RESET_CONNECTION_STRING, swift::SReadline::SaveHistory(), OPENTREP::OPENTREP_Service::setSQLDBConnectString(), Command_T::TOGGLE_DEPLOYMENT_NUMBER, Command_T::TOGGLE_NONIATA_INDEXING_FLAG, Command_T::TOGGLE_SQLDB_INSERTING_FLAG, Command_T::TOGGLE_XAPIAN_IDEXING_FLAG, OPENTREP::OPENTREP_Service::toggleDeploymentNumber(), OPENTREP::OPENTREP_Service::toggleShouldAddPORInSQLDBFlag(), OPENTREP::OPENTREP_Service::toggleShouldIncludeAllPORFlag(), OPENTREP::OPENTREP_Service::toggleShouldIndexPORInXapianFlag(), OPENTREP::Location::toString(), toString(), and Command_T::TUTORIAL.
const int K_OPENTREP_EARLY_RETURN_STATUS = 99 |
Early return status (so that it can be differentiated from an error).
Definition at line 38 of file opentrep-dbmgr.cpp.