mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-29 04:59:07 +08:00
33 lines
808 B
C++
33 lines
808 B
C++
#pragma once
|
|
|
|
#include "vcpkg_expected.h"
|
|
|
|
namespace vcpkg
|
|
{
|
|
enum class PackageSpecParseResult
|
|
{
|
|
SUCCESS = 0,
|
|
TOO_MANY_COLONS,
|
|
INVALID_CHARACTERS
|
|
};
|
|
|
|
CStringView to_string(PackageSpecParseResult ev) noexcept;
|
|
|
|
template<>
|
|
struct ErrorHolder<PackageSpecParseResult>
|
|
{
|
|
ErrorHolder() : m_err(PackageSpecParseResult::SUCCESS) {}
|
|
ErrorHolder(PackageSpecParseResult err) : m_err(err) {}
|
|
|
|
constexpr bool has_error() const { return m_err != PackageSpecParseResult::SUCCESS; }
|
|
|
|
const PackageSpecParseResult& error() const { return m_err; }
|
|
PackageSpecParseResult& error() { return m_err; }
|
|
|
|
CStringView to_string() const { return vcpkg::to_string(m_err); }
|
|
|
|
private:
|
|
PackageSpecParseResult m_err;
|
|
};
|
|
}
|