From 7ee180ebdd7ec93a4ba3c34c38fd467109365ad6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 3 Apr 2017 14:48:24 -0700 Subject: [PATCH] paragraph_parse_result -> ParagraphParseResult --- ..._parse_result.h => ParagraphParseResult.h} | 12 ++--- toolsrc/src/ParagraphParseResult.cpp | 45 +++++++++++++++++++ toolsrc/src/Paragraphs.cpp | 4 +- toolsrc/src/paragraph_parse_result.cpp | 45 ------------------- toolsrc/vcpkglib/vcpkglib.vcxproj | 4 +- toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 12 ++--- 6 files changed, 61 insertions(+), 61 deletions(-) rename toolsrc/include/{paragraph_parse_result.h => ParagraphParseResult.h} (52%) create mode 100644 toolsrc/src/ParagraphParseResult.cpp delete mode 100644 toolsrc/src/paragraph_parse_result.cpp diff --git a/toolsrc/include/paragraph_parse_result.h b/toolsrc/include/ParagraphParseResult.h similarity index 52% rename from toolsrc/include/paragraph_parse_result.h rename to toolsrc/include/ParagraphParseResult.h index 47f20c08ea..0d1f13f613 100644 --- a/toolsrc/include/paragraph_parse_result.h +++ b/toolsrc/include/ParagraphParseResult.h @@ -3,13 +3,13 @@ namespace vcpkg { - enum class paragraph_parse_result + enum class ParagraphParseResult { SUCCESS = 0, EXPECTED_ONE_PARAGRAPH }; - struct paragraph_parse_result_category_impl final : std::error_category + struct ParagraphParseResultCategoryImpl final : std::error_category { virtual const char* name() const noexcept override; @@ -18,18 +18,18 @@ namespace vcpkg const std::error_category& paragraph_parse_result_category(); - std::error_code make_error_code(paragraph_parse_result e); + std::error_code make_error_code(ParagraphParseResult e); - paragraph_parse_result to_paragraph_parse_result(int i); + ParagraphParseResult to_paragraph_parse_result(int i); - paragraph_parse_result to_paragraph_parse_result(std::error_code ec); + ParagraphParseResult to_paragraph_parse_result(std::error_code ec); } // Enable implicit conversion to std::error_code namespace std { template <> - struct is_error_code_enum : ::std::true_type + struct is_error_code_enum : ::std::true_type { }; } diff --git a/toolsrc/src/ParagraphParseResult.cpp b/toolsrc/src/ParagraphParseResult.cpp new file mode 100644 index 0000000000..c2da78d300 --- /dev/null +++ b/toolsrc/src/ParagraphParseResult.cpp @@ -0,0 +1,45 @@ +#include "pch.h" +#include "vcpkg_Checks.h" +#include "ParagraphParseResult.h" + +namespace vcpkg +{ + const char* ParagraphParseResultCategoryImpl::name() const noexcept + { + return "ParagraphParseResult"; + } + + std::string ParagraphParseResultCategoryImpl::message(int ev) const noexcept + { + switch (static_cast(ev)) + { + case ParagraphParseResult::SUCCESS: + return "OK"; + case ParagraphParseResult::EXPECTED_ONE_PARAGRAPH: + return "There should be exactly one paragraph"; + default: + Checks::unreachable(VCPKG_LINE_INFO); + } + } + + const std::error_category& paragraph_parse_result_category() + { + static ParagraphParseResultCategoryImpl instance; + return instance; + } + + std::error_code make_error_code(ParagraphParseResult e) + { + return std::error_code(static_cast(e), paragraph_parse_result_category()); + } + + ParagraphParseResult to_paragraph_parse_result(int i) + { + return static_cast(i); + } + + ParagraphParseResult to_paragraph_parse_result(std::error_code ec) + { + return to_paragraph_parse_result(ec.value()); + } +} diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp index d6784bc63f..0d91e95a91 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/Paragraphs.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include "Paragraphs.h" #include "vcpkg_Files.h" -#include "paragraph_parse_result.h" +#include "ParagraphParseResult.h" namespace vcpkg::Paragraphs { @@ -203,7 +203,7 @@ namespace vcpkg::Paragraphs return p.at(0); } - return std::error_code(paragraph_parse_result::EXPECTED_ONE_PARAGRAPH); + return std::error_code(ParagraphParseResult::EXPECTED_ONE_PARAGRAPH); } expected>> parse_paragraphs(const std::string& str) diff --git a/toolsrc/src/paragraph_parse_result.cpp b/toolsrc/src/paragraph_parse_result.cpp deleted file mode 100644 index 4715f7a16f..0000000000 --- a/toolsrc/src/paragraph_parse_result.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "pch.h" -#include "vcpkg_Checks.h" -#include "paragraph_parse_result.h" - -namespace vcpkg -{ - const char* paragraph_parse_result_category_impl::name() const noexcept - { - return "paragraph_parse_result"; - } - - std::string paragraph_parse_result_category_impl::message(int ev) const noexcept - { - switch (static_cast(ev)) - { - case paragraph_parse_result::SUCCESS: - return "OK"; - case paragraph_parse_result::EXPECTED_ONE_PARAGRAPH: - return "There should be exactly one paragraph"; - default: - Checks::unreachable(VCPKG_LINE_INFO); - } - } - - const std::error_category& paragraph_parse_result_category() - { - static paragraph_parse_result_category_impl instance; - return instance; - } - - std::error_code make_error_code(paragraph_parse_result e) - { - return std::error_code(static_cast(e), paragraph_parse_result_category()); - } - - paragraph_parse_result to_paragraph_parse_result(int i) - { - return static_cast(i); - } - - paragraph_parse_result to_paragraph_parse_result(std::error_code ec) - { - return to_paragraph_parse_result(ec.value()); - } -} diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index e596254ccd..724e73cd7d 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -140,7 +140,7 @@ - + @@ -187,7 +187,7 @@ - + diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 17cafd4a74..f295305bc7 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -162,9 +162,6 @@ Source Files - - Source Files - Source Files @@ -180,6 +177,9 @@ Source Files + + Source Files + @@ -287,9 +287,6 @@ Header Files - - Header Files - Header Files @@ -314,5 +311,8 @@ Header Files + + Header Files + \ No newline at end of file