Skip to content

Commit

Permalink
Please our MSVC overlords
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Sep 13, 2023
1 parent b64739f commit 5db324c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 20 deletions.
10 changes: 4 additions & 6 deletions libmamba/include/mamba/specs/conda_url.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ namespace mamba::specs

public:

using Base::StripScheme;
using Base::HideConfidential;
using Base::Encode;
using Base::Decode;
using StripScheme = util::detail::StripScheme;
using HideConfidential = util::detail::HideConfidential;
using Encode = util::detail::Encode;
using Decode = util::detail::Decode;

using Base::https;
using Base::localhost;
inline static constexpr std::string_view token_prefix = "/t/";

[[nodiscard]] static auto parse(std::string_view url) -> CondaURL;
Expand Down
55 changes: 41 additions & 14 deletions libmamba/include/mamba/util/url.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,43 @@

namespace mamba::util
{
namespace detail
{
// Working around MSVC limitation on private inheritance + using directive

enum class StripScheme : bool
{
no,
yes
};

enum class HideConfidential : bool
{
no,
yes
};

struct Encode
{
inline static constexpr struct yes_type
{
} yes = {};
inline static constexpr struct no_type
{
} no = {};
};

struct Decode
{
inline static constexpr struct yes_type
{
} yes = {};
inline static constexpr struct no_type
{
} no = {};
};
}

/**
* Class representing a URL.
*
Expand All @@ -21,20 +58,10 @@ namespace mamba::util
{
public:

// clang-format off
enum class StripScheme : bool { no, yes };
enum class HideConfidential : bool { no, yes };
struct Encode
{
inline static constexpr struct yes_type {} yes = {};
inline static constexpr struct no_type {} no = {};
};
struct Decode
{
inline static constexpr struct yes_type {} yes = {};
inline static constexpr struct no_type {} no = {};
};
// clang-format on
using StripScheme = detail::StripScheme;
using HideConfidential = detail::HideConfidential;
using Encode = detail::Encode;
using Decode = detail::Decode;

inline static constexpr std::string_view https = "https";
inline static constexpr std::string_view localhost = "localhost";
Expand Down

0 comments on commit 5db324c

Please sign in to comment.