the_Foundation 1.0
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
commandline.h File Reference
#include "stringlist.h"
#include "stringhash.h"

Data Structures

struct  iCommandLineClass
 
struct  iCommandLine
 
struct  iCommandLineReverseConstIterator
 
struct  iCommandLineArg
 
struct  iCommandLineArgClass
 

Enumerations

enum  { unlimitedValues_CommandLine = -1 }
 
enum  iCommandLineArgType { value_CommandLineArgType , shortArgument_CommandLineArgType , longArgument_CommandLineArgType }
 

Functions

iCommandLine * new_CommandLine (int argc, char **argv)
 
void init_CommandLine (iCommandLine *d, int argc, char **argv)
 
void deinit_CommandLine (iCommandLine *d)
 
void defineValues_CommandLine (iCommandLine *, const char *arg, int valueCount)
 
void defineValuesN_CommandLine (iCommandLine *, const char *arg, int minCount, int maxCount)
 
iBool isDefined_CommandLine (const iCommandLine *, const iString *arg)
 
iBool contains_CommandLine (const iCommandLine *, const char *arg)
 
iCommandLineArg * checkArgument_CommandLine (const iCommandLine *, const char *arg)
 
iCommandLineArg * checkArgumentValuesN_CommandLine (const iCommandLine *, const char *arg, int minCount, int maxCount)
 
void init_CommandLineConstIterator (iCommandLineConstIterator *, const iCommandLine *)
 
void next_CommandLineConstIterator (iCommandLineConstIterator *)
 
void init_CommandLineReverseConstIterator (iCommandLineReverseConstIterator *, const iCommandLine *)
 
void next_CommandLineReverseConstIterator (iCommandLineReverseConstIterator *)
 
iCommandLineArg * argument_CommandLineConstIterator (iCommandLineConstIterator *)
 
const iString * value_CommandLineConstIterator (iCommandLineConstIterator *)
 
iBool equal_CommandLineConstIterator (const iCommandLineConstIterator *, const char *arg)
 
iCommandLineArg * new_CommandLineArg (void)
 
void init_CommandLineArg (iCommandLineArg *d)
 
void deinit_CommandLineArg (iCommandLineArg *d)
 

Variables

iCommandLineClass Class_CommandLine
 
iCommandLineArgClass Class_CommandLineArg
 

Detailed Description

Command line options parsing.

Authors
Copyright (c) 2017 Jaakko Keränen jaakk.nosp@m.o.ke.nosp@m.ranen.nosp@m.@iki.nosp@m..fi
License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ checkArgument_CommandLine()

iCommandLineArg * checkArgument_CommandLine ( const iCommandLine * ,
const char * arg )

Finds an argument and its defined values from the command line. If no values have been defined for the argument, it is assumed that is has none.

Parameters
argArgument(s) to find. This can be a single argument or a list of semicolon-separated arguments. The first match is returned. Matching is done in the specified order.
Returns
New CommandLineArg object with the found argument and values, or NULL.

◆ checkArgumentValuesN_CommandLine()

iCommandLineArg * checkArgumentValuesN_CommandLine ( const iCommandLine * ,
const char * arg,
int minCount,
int maxCount )

Finds an argument and its values from the command line. Any previously defined values for the argument(s) are ignored.

Parameters
argArgument(s) to find. This can be a single argument or a list of semicolon-separated arguments. The first match is returned. Matching is done in the specified order.
minCountMinimum number of values.
maxCountMaximum number of values, or unlimitedValues_CommandLine.
Returns
New CommandLineArg object with the found argument and values, or NULL.

◆ contains_CommandLine()

iBool contains_CommandLine ( const iCommandLine * ,
const char * arg )

Checks if the command line contains a specific argument.

Parameters
argArgument(s) (without any dashes). This can be a single argument or a list of semicolon-separated arguments.