aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/ParagraphParseResult.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-04-03 14:48:24 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-04-04 16:44:41 -0700
commit7ee180ebdd7ec93a4ba3c34c38fd467109365ad6 (patch)
tree4a1cc5eec64304e59819fdd712fbbcc40d786ced /toolsrc/src/ParagraphParseResult.cpp
parent83cde513345f5544325520b89ec3f1f27bd8b2a6 (diff)
downloadvcpkg-7ee180ebdd7ec93a4ba3c34c38fd467109365ad6.tar.gz
vcpkg-7ee180ebdd7ec93a4ba3c34c38fd467109365ad6.zip
paragraph_parse_result -> ParagraphParseResult
Diffstat (limited to 'toolsrc/src/ParagraphParseResult.cpp')
-rw-r--r--toolsrc/src/ParagraphParseResult.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/toolsrc/src/ParagraphParseResult.cpp b/toolsrc/src/ParagraphParseResult.cpp
new file mode 100644
index 000000000..c2da78d30
--- /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<ParagraphParseResult>(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<int>(e), paragraph_parse_result_category());
+ }
+
+ ParagraphParseResult to_paragraph_parse_result(int i)
+ {
+ return static_cast<ParagraphParseResult>(i);
+ }
+
+ ParagraphParseResult to_paragraph_parse_result(std::error_code ec)
+ {
+ return to_paragraph_parse_result(ec.value());
+ }
+}