OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
opentrep-dbmgr.cpp File Reference
#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 Documentation

◆ WordList_T

typedef std::vector<std::string> WordList_T

Definition at line 26 of file opentrep-dbmgr.cpp.

◆ TokenList_T

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.

Function Documentation

◆ K_OPENTREP_DEFAULT_LOG_FILENAME()

const std::string K_OPENTREP_DEFAULT_LOG_FILENAME ( "opentrep-dbmgr.log" )

Default name and location for the log file.

◆ operator<<()

template<class T>
std::ostream & operator<< ( std::ostream & os,
const std::vector< T > & v )

Definition at line 80 of file opentrep-dbmgr.cpp.

◆ readConfiguration()

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 )

◆ initReadline()

void initReadline ( swift::SReadline & ioInputReader)

Definition at line 270 of file opentrep-dbmgr.cpp.

References swift::SReadline::RegisterCompletions().

Referenced by main().

◆ extractCommand()

◆ parseConnectionString()

void parseConnectionString ( const TokenList_T & iTokenList,
std::string & ioConnectionString )

Definition at line 394 of file opentrep-dbmgr.cpp.

◆ parsePlaceKey()

void parsePlaceKey ( const TokenList_T & iTokenList,
std::string & ioPlaceKey )

Definition at line 408 of file opentrep-dbmgr.cpp.

Referenced by main().

◆ toString()

◆ extractTokenList()

TokenList_T extractTokenList ( const TokenList_T & iTokenList,
const std::string & iRegularExpression )

◆ extractTokenListForIataCode()

TokenList_T extractTokenListForIataCode ( const TokenList_T & iTokenList)

Definition at line 474 of file opentrep-dbmgr.cpp.

References extractTokenList().

Referenced by main().

◆ extractTokenListForIcaoCode()

TokenList_T extractTokenListForIcaoCode ( const TokenList_T & iTokenList)

Definition at line 488 of file opentrep-dbmgr.cpp.

References extractTokenList().

Referenced by main().

◆ extractTokenListForFaaCode()

TokenList_T extractTokenListForFaaCode ( const TokenList_T & iTokenList)

Definition at line 502 of file opentrep-dbmgr.cpp.

References extractTokenList().

Referenced by main().

◆ extractTokenListForUNLOCode()

TokenList_T extractTokenListForUNLOCode ( const TokenList_T & iTokenList)

Definition at line 516 of file opentrep-dbmgr.cpp.

References extractTokenList().

Referenced by main().

◆ extractTokenListForUICCode()

TokenList_T extractTokenListForUICCode ( const TokenList_T & iTokenList)

Definition at line 530 of file opentrep-dbmgr.cpp.

References extractTokenList().

Referenced by main().

◆ extractTokenListForGeonameID()

TokenList_T extractTokenListForGeonameID ( const TokenList_T & iTokenList)

Definition at line 544 of file opentrep-dbmgr.cpp.

References extractTokenList().

Referenced by main().

◆ 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.

Variable Documentation

◆ K_OPENTREP_EARLY_RETURN_STATUS

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.