Main updated.

This commit is contained in:
King_DuckZ 2013-08-11 14:39:15 +02:00
parent 3937847025
commit 21467ec114
2 changed files with 38 additions and 2 deletions

View file

@ -1,9 +1,42 @@
#include "main.hpp"
#include "WordReference.hpp"
#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[]) {
std::cout << "Hello world\n";
int main (int parArgc, const char* const parArgv[]) {
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;
}

View file

@ -2,5 +2,8 @@
#define id80FAB3D5977B4A1797F2910935B34AEA
#include <string>
#include <map>
#include <stdexcept>
#include <algorithm>
#endif