Main updated.
This commit is contained in:
parent
3937847025
commit
21467ec114
2 changed files with 38 additions and 2 deletions
37
main.cpp
37
main.cpp
|
@ -1,9 +1,42 @@
|
||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
#include "WordReference.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <boost/program_options/cmdline.hpp>
|
||||||
|
#include <boost/program_options/variables_map.hpp>
|
||||||
|
#include <boost/program_options/options_description.hpp>
|
||||||
|
#include <boost/program_options/parsers.hpp>
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
#define UNDEF_NDEBUG
|
||||||
|
#define NDEBUG
|
||||||
|
#endif
|
||||||
|
#include <libjson.h>
|
||||||
|
#ifdef UNDEF_NDEBUG
|
||||||
|
#undef UNDEF_NDEBUG
|
||||||
|
#undef NDEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
///-------------------------------------------------------------------------
|
||||||
|
///-------------------------------------------------------------------------
|
||||||
|
void GetCommandLine (boost::program_options::variables_map& parVarMap, int parArgc, const char* const parArgv[]) {
|
||||||
|
boost::program_options::options_description desc("Program parameters");
|
||||||
|
desc.add_options()
|
||||||
|
("help", "show this help screen")
|
||||||
|
;
|
||||||
|
|
||||||
|
boost::program_options::store(boost::program_options::parse_command_line(parArgc, parArgv, desc), parVarMap);
|
||||||
|
boost::program_options::notify(parVarMap);
|
||||||
|
}
|
||||||
|
} //unnamed namespace
|
||||||
|
|
||||||
///-----------------------------------------------------------------------------
|
///-----------------------------------------------------------------------------
|
||||||
///-----------------------------------------------------------------------------
|
///-----------------------------------------------------------------------------
|
||||||
int main (int parArgc, const char* const argv[]) {
|
int main (int parArgc, const char* const parArgv[]) {
|
||||||
std::cout << "Hello world\n";
|
WordReference wref("en", "it");
|
||||||
|
|
||||||
|
boost::program_options::variables_map vm;
|
||||||
|
GetCommandLine(vm, parArgc, parArgv);
|
||||||
|
std::cout << wref.GetHttpLink("north face") << "\n© WordReference.com" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
3
main.hpp
3
main.hpp
|
@ -2,5 +2,8 @@
|
||||||
#define id80FAB3D5977B4A1797F2910935B34AEA
|
#define id80FAB3D5977B4A1797F2910935B34AEA
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue