mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 15:14:39 +00:00
Update header source format with clang-format
Most changes are to better fit within "ColumnLimit: 80". The change from "T &&... var" to "T &&...var" is caused by "PointerAlignment: Right". Member functions chained from add_argument() use ContinuationIndentWidth, which is set to 4. Setting ContinuationIndentWidth to 2 causes many other continuation lines to change. So, this commit uses the original value (i.e. 4) as the preferred size. Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This commit is contained in:
parent
486bfdaf8d
commit
cb2777db6e
@ -55,17 +55,15 @@ namespace argparse {
|
|||||||
|
|
||||||
namespace details { // namespace for helper methods
|
namespace details { // namespace for helper methods
|
||||||
|
|
||||||
template <typename T, typename = void>
|
template <typename T, typename = void> struct is_container : std::false_type {};
|
||||||
struct is_container : std::false_type {};
|
|
||||||
|
|
||||||
template <> struct is_container<std::string> : std::false_type {};
|
template <> struct is_container<std::string> : std::false_type {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_container<T, std::void_t<typename T::value_type,
|
struct is_container<
|
||||||
decltype(std::declval<T>().begin()),
|
T, std::void_t<typename T::value_type, decltype(std::declval<T>().begin()),
|
||||||
decltype(std::declval<T>().end()),
|
decltype(std::declval<T>().end()),
|
||||||
decltype(std::declval<T>().size())>>
|
decltype(std::declval<T>().size())>> : std::true_type {};
|
||||||
: std::true_type {};
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static constexpr bool is_container_v = is_container<T>::value;
|
static constexpr bool is_container_v = is_container<T>::value;
|
||||||
@ -74,8 +72,8 @@ template <typename T, typename = void>
|
|||||||
struct is_streamable : std::false_type {};
|
struct is_streamable : std::false_type {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_streamable<
|
struct is_streamable<T, std::void_t<decltype(std::declval<std::ostream &>()
|
||||||
T, std::void_t<decltype(std::declval<std::ostream&>() << std::declval<T>())>>
|
<< std::declval<T>())>>
|
||||||
: std::true_type {};
|
: std::true_type {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -100,7 +98,8 @@ template <typename T> std::string repr(T const &val) {
|
|||||||
out << repr(*val.begin());
|
out << repr(*val.begin());
|
||||||
std::for_each(
|
std::for_each(
|
||||||
std::next(val.begin()),
|
std::next(val.begin()),
|
||||||
std::next(val.begin(), std::min<std::size_t>(size, repr_max_container_size) - 1),
|
std::next(val.begin(),
|
||||||
|
std::min<std::size_t>(size, repr_max_container_size) - 1),
|
||||||
[&out](const auto &v) { out << " " << repr(v); });
|
[&out](const auto &v) { out << " " << repr(v); });
|
||||||
if (size <= repr_max_container_size) {
|
if (size <= repr_max_container_size) {
|
||||||
out << " ";
|
out << " ";
|
||||||
@ -891,12 +890,12 @@ public:
|
|||||||
mIsParsed(other.mIsParsed),
|
mIsParsed(other.mIsParsed),
|
||||||
mPositionalArguments(other.mPositionalArguments),
|
mPositionalArguments(other.mPositionalArguments),
|
||||||
mOptionalArguments(other.mOptionalArguments) {
|
mOptionalArguments(other.mOptionalArguments) {
|
||||||
for (auto it = std::begin(mPositionalArguments); it != std::end(mPositionalArguments);
|
for (auto it = std::begin(mPositionalArguments);
|
||||||
++it) {
|
it != std::end(mPositionalArguments); ++it) {
|
||||||
index_argument(it);
|
index_argument(it);
|
||||||
}
|
}
|
||||||
for (auto it = std::begin(mOptionalArguments); it != std::end(mOptionalArguments);
|
for (auto it = std::begin(mOptionalArguments);
|
||||||
++it) {
|
it != std::end(mOptionalArguments); ++it) {
|
||||||
index_argument(it);
|
index_argument(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user