OpenCores
URL https://opencores.org/ocsvn/sqmusic/sqmusic/trunk

Subversion Repositories sqmusic

[/] [sqmusic/] [trunk/] [cpp/] [args_test.cc] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 gryzor
/*
2
  (c) Jose Tejada Gomez, 9th May 2013
3
  You can use this file following the GNU GENERAL PUBLIC LICENSE version 3
4
  Read the details of the license in:
5
  http://www.gnu.org/licenses/gpl.txt
6
 
7
  Send comments to: jose.tejada at ieee.org
8
 
9
*/
10
 
11
#include "args.h"
12
 
13
using namespace std;
14
 
15
int main(int argc, char *argv[] ) {
16
  arg_vector_t arg_list;
17
  argument_t number( arg_list, "number", argument_t::integer, "My number", false );
18
  argument_t mystr( arg_list, "string", argument_t::text, "My string", true );
19
  argument_t def( arg_list, "", argument_t::text, "default argument", true );
20
  try{
21
    cout << "argc = " << argc << "\n";
22
    Args arg_info( argc, argv, arg_list );
23
    if( arg_info.help_request() ) return 0;
24
    if( number.is_set() ) {
25
      cout << "Number = " << number.integer_value << "\n"; }
26
    if( mystr.is_set() ) {
27
      cout << "String = " << mystr.string_value << "\n"; }
28
    return 0;
29
  }
30
  catch( char const* ex ) {
31
    cout << "Exception: " << ex << "\n";
32
    return 1;
33
  }
34
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.