Fixes #340: namespace indentation unification (#350)

* Namespace no longer induce indentation
* Namespace opening brace now on same line as namespace name
* Namespace closing brace now has an empty line before it unless the namespace contents were short and with no empty lines
* Namespace closing brace now always followed by a comment with the closed namespace' name
This commit is contained in:
Eyal Rozenberg 2022-07-11 00:00:50 +03:00 committed by GitHub
parent 8d18c3ed0b
commit 513afbc6dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,8 +79,7 @@ THE SOFTWARE.
#define CXXOPTS_NULL_DEREF_IGNORE
#endif
namespace cxxopts
{
namespace cxxopts {
static constexpr struct {
uint8_t major, minor, patch;
} version = {
@ -99,8 +98,7 @@ namespace cxxopts
#ifdef CXXOPTS_USE_UNICODE
#include <unicode/unistr.h>
namespace cxxopts
{
namespace cxxopts {
using String = icu::UnicodeString;
inline
@ -223,10 +221,10 @@ namespace cxxopts
{
return s.isEmpty();
}
}
namespace std
{
} // namespace cxxopts
namespace std {
inline
cxxopts::UnicodeStringIterator
begin(const icu::UnicodeString& s)
@ -240,13 +238,13 @@ namespace std
{
return cxxopts::UnicodeStringIterator(&s, s.length());
}
}
} // namespace std
//ifdef CXXOPTS_USE_UNICODE
#else
namespace cxxopts
{
namespace cxxopts {
using String = std::string;
template <typename T>
@ -297,15 +295,14 @@ namespace cxxopts
{
return s.empty();
}
} // namespace cxxopts
//ifdef CXXOPTS_USE_UNICODE
#endif
namespace cxxopts
{
namespace
{
namespace cxxopts {
namespace {
#ifdef _WIN32
const std::string LQUOTE("\'");
const std::string RQUOTE("\'");
@ -547,10 +544,8 @@ namespace cxxopts
#endif
}
namespace values
{
namespace parser_tool
{
namespace values {
namespace parser_tool {
struct IntegerDesc
{
std::string negative = "";
@ -705,8 +700,7 @@ namespace cxxopts
#else // CXXOPTS_NO_REGEX
namespace
{
namespace {
std::basic_regex<char> integer_pattern
("(-)?(0x)?([0-9a-zA-Z]+)|((0x)?0)");
@ -745,6 +739,7 @@ namespace cxxopts
}
return desc;
}
inline bool IsTrueText(const std::string &text)
@ -799,10 +794,9 @@ namespace cxxopts
#endif // CXXOPTS_NO_REGEX
#undef CXXOPTS_NO_REGEX
}
} // namespace parser_tool
namespace detail
{
namespace detail {
template <typename T, bool B>
struct SignedCheck;
@ -844,6 +838,7 @@ namespace cxxopts
{
SignedCheck<T, std::numeric_limits<T>::is_signed>()(negative, value, text);
}
} // namespace detail
template <typename R, typename T>
@ -1900,8 +1895,7 @@ namespace cxxopts
std::string m_group;
};
namespace
{
namespace {
constexpr size_t OPTION_LONGEST = 30;
constexpr size_t OPTION_DESC_GAP = 2;