LibreOffice Module shell (master) 1
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CommandLine Class Reference

Simple command line abstraction. More...

#include <cmdline.hxx>

Public Member Functions

 CommandLine (size_t argc, char *argv[])
 Simple command line abstraction. More...
 
std::string get_arg (const std::string &ArgumentName) const
 Returns an argument by name. More...
 

Private Member Functions

 CommandLine (const CommandLine &)=delete
 
CommandLineoperator= (const CommandLine &)=delete
 

Static Private Member Functions

static bool is_arg_name (const std::string &Argument)
 Returns whether a given argument is an argument name. More...
 

Private Attributes

size_t m_argc
 
char ** m_argv
 

Detailed Description

Simple command line abstraction.

Definition at line 30 of file cmdline.hxx.

Constructor & Destructor Documentation

◆ CommandLine() [1/2]

CommandLine::CommandLine ( size_t  argc,
char *  argv[] 
)

Simple command line abstraction.

Definition at line 28 of file cmdline.cxx.

◆ CommandLine() [2/2]

CommandLine::CommandLine ( const CommandLine )
privatedelete

Member Function Documentation

◆ get_arg()

std::string CommandLine::get_arg ( const std::string &  ArgumentName) const

Returns an argument by name.

If there are duplicate argument names in the command line, the first one wins. Argument name and the argument value must be separated by spaces. If the argument value starts with an argument prefix use quotes else the return value is an empty string because the value will be interpreted as the next argument name. If an argument value contains spaces use quotes.

@precond GetArgumentNames() -> has element ArgumentName

Exceptions
std::invalid_argumentexception if the specified argument could not be found

Definition at line 52 of file cmdline.cxx.

References i, is_arg_name(), m_argc, and m_argv.

Referenced by SAL_IMPLEMENT_MAIN_WITH_ARGS().

◆ is_arg_name()

bool CommandLine::is_arg_name ( const std::string &  Argument)
staticprivate

Returns whether a given argument is an argument name.

Definition at line 77 of file cmdline.cxx.

Referenced by get_arg().

◆ operator=()

CommandLine & CommandLine::operator= ( const CommandLine )
privatedelete

Member Data Documentation

◆ m_argc

size_t CommandLine::m_argc
private

Definition at line 63 of file cmdline.hxx.

Referenced by get_arg().

◆ m_argv

char** CommandLine::m_argv
private

Definition at line 64 of file cmdline.hxx.

Referenced by get_arg().


The documentation for this class was generated from the following files: