LibCppCmd v1.0 Beta 15
C++ Command Line Parsing Library
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
CmdLine::NameValuePair Class Reference

A pair of a name and a value. More...

#include <NameValuePair.h>

Classes

class  InvalidPair
 An exception thrown for invalid NameValuePairs. More...
 

Public Member Functions

 NameValuePair (std::string pair)
 Constructs a new NameValuePair.
 
std::string Name () const
 Gets the name from the NameValuePair.
 
std::string Value () const
 Gets the value from the NameValuePair.
 

Detailed Description

A pair of a name and a value.

A name-value pair specified in a CommandLine argument takes the form "name=value". This class separates the name and the value and stores them as a single pair with the name and value individually retrievable. A valid name without a value (i.e. "name" vs. "name=value") can also represent a name-value pair. In this case the resulting NameValuePair will have an empty value.

Constructor & Destructor Documentation

◆ NameValuePair()

CmdLine::NameValuePair::NameValuePair ( std::string pair)

Constructs a new NameValuePair.

Parameters
pairThe string used to construct the pair.
Invariant
Name characters must be alpha numerics and - and _.
Names must not start with the option prefix.
Names must not be longer than 20 characters.
The name must not be empty.
The value will consist of everything after the = sign.

Member Function Documentation

◆ Name()

std::string CmdLine::NameValuePair::Name ( ) const
inline

Gets the name from the NameValuePair.

Returns
The name from the NameValuePair.

◆ Value()

std::string CmdLine::NameValuePair::Value ( ) const
inline

Gets the value from the NameValuePair.

Returns
The value from the NameValuePair.

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