From 21467ec1143b4ce4fb0c6196f524b67db0993223 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sun, 11 Aug 2013 14:39:15 +0200 Subject: [PATCH] Main updated. --- main.cpp | 37 +++++++++++++++++++++++++++++++++++-- main.hpp | 3 +++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index bd2c351..1e8a03f 100644 --- a/main.cpp +++ b/main.cpp @@ -1,9 +1,42 @@ #include "main.hpp" +#include "WordReference.hpp" #include +#include +#include +#include +#include + +#ifndef NDEBUG +#define UNDEF_NDEBUG +#define NDEBUG +#endif +#include +#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; } diff --git a/main.hpp b/main.hpp index 5e05b18..9a4f2e4 100644 --- a/main.hpp +++ b/main.hpp @@ -2,5 +2,8 @@ #define id80FAB3D5977B4A1797F2910935B34AEA #include +#include +#include +#include #endif