Skip to content

Commit

Permalink
add operator * and operator -> to most types; bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Taylor C. Richberger committed Nov 23, 2021
1 parent f4f0c96 commit a48e1f8
Show file tree
Hide file tree
Showing 6 changed files with 345 additions and 85 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ endif()
project(args CXX)
set(PROJECT_DESCRIPTION "A simple, small, flexible, single-header C++11 argument parsing library. that is designed to appear somewhat similar to Python's argparse.")
set(PROJECT_HOMEPAGE_URL "https://github.com/Taywee/args")
set(PROJECT_VERSION 6.2.7)
set(PROJECT_VERSION 6.3.0)

option(ARGS_BUILD_EXAMPLE "Build example" ON)
option(ARGS_BUILD_UNITTESTS "Build unittests" ON)
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "args"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 6.2.7
PROJECT_NUMBER = 6.3.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
268 changes: 264 additions & 4 deletions args.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* https://github.com/Taywee/args
*
* Copyright (c) 2016-2020 Taylor C. Richberger <[email protected]> and Pavel
* Copyright (c) 2016-2021 Taylor C. Richberger <[email protected]> and Pavel
* Belikov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -33,10 +33,10 @@
#ifndef ARGS_HXX
#define ARGS_HXX

#define ARGS_VERSION "6.2.7"
#define ARGS_VERSION "6.3.0"
#define ARGS_VERSION_MAJOR 6
#define ARGS_VERSION_MINOR 2
#define ARGS_VERSION_PATCH 7
#define ARGS_VERSION_MINOR 3
#define ARGS_VERSION_PATCH 0

#include <algorithm>
#include <iterator>
Expand Down Expand Up @@ -3242,6 +3242,14 @@ namespace args
return count;
}

int &operator *() noexcept {
return count;
}

const int &operator *() const noexcept {
return count;
}

virtual void Reset() noexcept override
{
FlagBase::Reset();
Expand Down Expand Up @@ -3394,6 +3402,34 @@ namespace args
return value;
}

/** Get the value
*/
T &operator *() noexcept
{
return value;
}

/** Get the value
*/
const T &operator *() const noexcept
{
return value;
}

/** Get the value
*/
T *operator ->() noexcept
{
return &value;
}

/** Get the value
*/
const T *operator ->() const noexcept
{
return &value;
}

/** Get the default value
*/
const T &GetDefault() noexcept
Expand Down Expand Up @@ -3523,6 +3559,34 @@ namespace args
return values;
}

/** Get the value
*/
List<T> &operator *() noexcept
{
return values;
}

/** Get the values
*/
const List<T> &operator *() const noexcept
{
return values;
}

/** Get the values
*/
List<T> *operator ->() noexcept
{
return &values;
}

/** Get the values
*/
const List<T> *operator ->() const noexcept
{
return &values;
}

iterator begin() noexcept
{
return values.begin();
Expand Down Expand Up @@ -3635,6 +3699,34 @@ namespace args
return values;
}

/** Get the value
*/
Container &operator *() noexcept
{
return values;
}

/** Get the values
*/
const Container &operator *() const noexcept
{
return values;
}

/** Get the values
*/
Container *operator ->() noexcept
{
return &values;
}

/** Get the values
*/
const Container *operator ->() const noexcept
{
return &values;
}

virtual std::string Name() const override
{
return name + std::string("...");
Expand Down Expand Up @@ -3768,6 +3860,34 @@ namespace args
return value;
}

/** Get the value
*/
T &operator *() noexcept
{
return value;
}

/** Get the value
*/
const T &operator *() const noexcept
{
return value;
}

/** Get the value
*/
T *operator ->() noexcept
{
return &value;
}

/** Get the value
*/
const T *operator ->() const noexcept
{
return &value;
}

virtual void Reset() noexcept override
{
ValueFlagBase::Reset();
Expand Down Expand Up @@ -3862,6 +3982,34 @@ namespace args
return values;
}

/** Get the value
*/
Container &operator *() noexcept
{
return values;
}

/** Get the values
*/
const Container &operator *() const noexcept
{
return values;
}

/** Get the values
*/
Container *operator ->() noexcept
{
return &values;
}

/** Get the values
*/
const Container *operator ->() const noexcept
{
return &values;
}

virtual std::string Name() const override
{
return name + std::string("...");
Expand Down Expand Up @@ -3962,6 +4110,34 @@ namespace args
return value;
}

/** Get the value
*/
T &operator *() noexcept
{
return value;
}

/** Get the value
*/
const T &operator *() const noexcept
{
return value;
}

/** Get the value
*/
T *operator ->() noexcept
{
return &value;
}

/** Get the value
*/
const T *operator ->() const noexcept
{
return &value;
}

virtual void Reset() noexcept override
{
PositionalBase::Reset();
Expand Down Expand Up @@ -4039,6 +4215,34 @@ namespace args
return values;
}

/** Get the value
*/
Container &operator *() noexcept
{
return values;
}

/** Get the values
*/
const Container &operator *() const noexcept
{
return values;
}

/** Get the values
*/
Container *operator ->() noexcept
{
return &values;
}

/** Get the values
*/
const Container *operator ->() const noexcept
{
return &values;
}

virtual void Reset() noexcept override
{
PositionalBase::Reset();
Expand Down Expand Up @@ -4160,6 +4364,34 @@ namespace args
return value;
}

/** Get the value
*/
T &operator *() noexcept
{
return value;
}

/** Get the value
*/
const T &operator *() const noexcept
{
return value;
}

/** Get the value
*/
T *operator ->() noexcept
{
return &value;
}

/** Get the value
*/
const T *operator ->() const noexcept
{
return &value;
}

virtual void Reset() noexcept override
{
PositionalBase::Reset();
Expand Down Expand Up @@ -4255,6 +4487,34 @@ namespace args
return values;
}

/** Get the value
*/
Container &operator *() noexcept
{
return values;
}

/** Get the values
*/
const Container &operator *() const noexcept
{
return values;
}

/** Get the values
*/
Container *operator ->() noexcept
{
return &values;
}

/** Get the values
*/
const Container *operator ->() const noexcept
{
return &values;
}

virtual std::string Name() const override
{
return name + std::string("...");
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class ArgsConan(ConanFile):
name = "args"
version = "6.2.7"
version = "6.3.0"
url = "https://github.com/Taywee/args"
description = "A simple header-only C++ argument parser library."
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('args.hxx', ['cpp'],
version: '6.2.7',
version: '6.3.0',
default_options: 'cpp_std=c++11',
license: 'MIT'
)
Expand Down
Loading

0 comments on commit a48e1f8

Please sign in to comment.