updated samples
- pikotools is in src subdirectory now - map_fields() -> fields() - prepare_table() -> table() - instead of pt::MainSpaceParser we have pt::MainOptionsParser now
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019, Tomasz Sowa
|
||||
* Copyright (c) 2019-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -32,7 +32,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mainspaceparser/mainspaceparser.h"
|
||||
#include "mainoptions/mainoptionsparser.h"
|
||||
#include "sample01.h"
|
||||
|
||||
|
||||
@@ -61,23 +61,21 @@ void print_syntax()
|
||||
|
||||
int main(int argc, const char ** argv)
|
||||
{
|
||||
pt::Space args;
|
||||
pt::Space & args_options = args.FindAddSpace(L"options");
|
||||
args_options.Add(L"c", 1); // one argument - config file
|
||||
args_options.Add(L"config", 1);
|
||||
pt::Space args, options;
|
||||
|
||||
pt::MainSpaceParser main_parser;
|
||||
main_parser.UTF8(true);
|
||||
main_parser.SetSpace(args);
|
||||
pt::MainSpaceParser::Status args_status = main_parser.Parse(argc, argv);
|
||||
options.add(L"c", 1); // one argument - config file
|
||||
options.add(L"config", 1);
|
||||
|
||||
if( args_status != pt::MainSpaceParser::status_ok )
|
||||
pt::MainOptionsParser main_parser;
|
||||
pt::MainOptionsParser::Status args_status = main_parser.parse(argc, argv, args, options);
|
||||
|
||||
if( args_status != pt::MainOptionsParser::status_ok )
|
||||
{
|
||||
std::cout << "Syntax error in arguments" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( args.GetFirstValue(L"h") || args.GetFirstValue(L"help") )
|
||||
if( args.has_key(L"h") || args.has_key(L"help") )
|
||||
{
|
||||
morm::samples::print_syntax();
|
||||
return 0;
|
||||
@@ -106,8 +104,8 @@ args_options.Add(L"config", 1);
|
||||
pt::WTextStream log_buffer;
|
||||
|
||||
file_log.init(L"log.txt", true, 4, true);
|
||||
log.SetLogBuffer(&log_buffer);
|
||||
log.SetFileLog(&file_log);
|
||||
log.set_log_buffer(&log_buffer);
|
||||
log.set_file_log(&file_log);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user