optional<T> -> Optional<T>
MODIFY
include/vcpkg_Dependencies.h
include/vcpkg_Dependencies.h
@@ -25,15 +25,15 @@ namespace vcpkg::Dependencies
struct InstallPlanAction
{
InstallPlanAction();
- InstallPlanAction(const InstallPlanType& plan_type, optional<BinaryParagraph> binary_pgh, optional<SourceParagraph> source_pgh);
+ InstallPlanAction(const InstallPlanType& plan_type, Optional<BinaryParagraph> binary_pgh, Optional<SourceParagraph> source_pgh);
InstallPlanAction(const InstallPlanAction&) = delete;
InstallPlanAction(InstallPlanAction&&) = default;
InstallPlanAction& operator=(const InstallPlanAction&) = delete;
InstallPlanAction& operator=(InstallPlanAction&&) = default;
InstallPlanType plan_type;
- optional<BinaryParagraph> binary_pgh;
- optional<SourceParagraph> source_pgh;
+ Optional<BinaryParagraph> binary_pgh;
+ Optional<SourceParagraph> source_pgh;
};
struct PackageSpecWithInstallPlan

MODIFY
include/vcpkg_System.h
include/vcpkg_System.h
@@ -59,9 +59,9 @@ namespace vcpkg::System
return println(c, Strings::format(messageTemplate, messageArg1, messageArgs...));
}
- optional<std::wstring> get_environmental_variable(const CWStringView varname) noexcept;
+ Optional<std::wstring> get_environmental_variable(const CWStringView varname) noexcept;
- optional<std::wstring> get_registry_string(HKEY base, const CWStringView subkey, const CWStringView valuename);
+ Optional<std::wstring> get_registry_string(HKEY base, const CWStringView subkey, const CWStringView valuename);
const fs::path& get_ProgramFiles_32_bit();

MODIFY
include/vcpkg_optional.h
include/vcpkg_optional.h
namespace vcpkg
{
- struct nullopt_t
+ struct NullOpt
{
- explicit constexpr nullopt_t(int) {}
+ explicit constexpr NullOpt(int) {}
};
- const static constexpr nullopt_t nullopt{ 0 };
+ const static constexpr NullOpt nullopt{ 0 };
template <class T>
- class optional
+ class Optional
{
public:
// Constructors are intentionally implicit
- constexpr optional(nullopt_t) : m_is_present(false), m_t() { }
+ constexpr Optional(NullOpt) : m_is_present(false), m_t() { }
- optional(const T& t) : m_is_present(true), m_t(t) { }
+ Optional(const T& t) : m_is_present(true), m_t(t) { }
- optional(T&& t) : m_is_present(true), m_t(std::move(t)) { }
+ Optional(T&& t) : m_is_present(true), m_t(std::move(t)) { }
T&& value_or_exit(const LineInfo& line_info) &&
{

MODIFY
src/commands_edit.cpp
src/commands_edit.cpp
@@ -20,7 +20,7 @@ namespace vcpkg::Commands::Edit
if (env_EDITOR.empty())
{
- const optional<std::wstring> env_EDITOR_optional = System::get_environmental_variable(L"EDITOR");
+ const Optional<std::wstring> env_EDITOR_optional = System::get_environmental_variable(L"EDITOR");
if (auto e = env_EDITOR_optional.get())
{
env_EDITOR = *e;
@@ -46,7 +46,7 @@ namespace vcpkg::Commands::Edit
};
for (auto&& keypath : regkeys)
{
- const optional<std::wstring> code_installpath = System::get_registry_string(HKEY_LOCAL_MACHINE, keypath, L"InstallLocation");
+ const Optional<std::wstring> code_installpath = System::get_registry_string(HKEY_LOCAL_MACHINE, keypath, L"InstallLocation");
if (auto c = code_installpath.get())
{
auto p = fs::path(*c) / "Code.exe";

MODIFY
src/vcpkg.cpp
src/vcpkg.cpp
@@ -45,7 +45,7 @@ static void inner(const VcpkgCmdArguments& args)
}
else
{
- const optional<std::wstring> vcpkg_root_dir_env = System::get_environmental_variable(L"VCPKG_ROOT");
+ const Optional<std::wstring> vcpkg_root_dir_env = System::get_environmental_variable(L"VCPKG_ROOT");
if (auto v = vcpkg_root_dir_env.get())
{
vcpkg_root_dir = fs::absolute(*v);
@@ -76,7 +76,7 @@ static void inner(const VcpkgCmdArguments& args)
}
else
{
- const optional<std::wstring> vcpkg_default_triplet_env = System::get_environmental_variable(L"VCPKG_DEFAULT_TRIPLET");
+ const Optional<std::wstring> vcpkg_default_triplet_env = System::get_environmental_variable(L"VCPKG_DEFAULT_TRIPLET");
if (auto v = vcpkg_default_triplet_env.get())
{
default_target_triplet = Triplet::from_canonical_name(Strings::utf16_to_utf8(*v));

MODIFY
src/vcpkg_Dependencies.cpp
src/vcpkg_Dependencies.cpp
@@ -13,7 +13,7 @@ namespace vcpkg::Dependencies
{
}
- InstallPlanAction::InstallPlanAction(const InstallPlanType& plan_type, optional<BinaryParagraph> binary_pgh, optional<SourceParagraph> source_pgh)
+ InstallPlanAction::InstallPlanAction(const InstallPlanType& plan_type, Optional<BinaryParagraph> binary_pgh, Optional<SourceParagraph> source_pgh)
: plan_type(std::move(plan_type)), binary_pgh(std::move(binary_pgh)), source_pgh(std::move(source_pgh))
{
}

MODIFY
src/vcpkg_System.cpp
src/vcpkg_System.cpp
@@ -69,7 +69,7 @@ namespace vcpkg::System
for (auto&& env_wstring : env_wstrings)
{
- const optional<std::wstring> value = System::get_environmental_variable(env_wstring);
+ const Optional<std::wstring> value = System::get_environmental_variable(env_wstring);
auto v = value.get();
if (!v || v->empty())
continue;
@@ -161,7 +161,7 @@ namespace vcpkg::System
putchar('\n');
}
- optional<std::wstring> get_environmental_variable(const CWStringView varname) noexcept
+ Optional<std::wstring> get_environmental_variable(const CWStringView varname) noexcept
{
auto sz = GetEnvironmentVariableW(varname, nullptr, 0);
if (sz == 0)
@@ -181,7 +181,7 @@ namespace vcpkg::System
return hkey_type == REG_SZ || hkey_type == REG_MULTI_SZ || hkey_type == REG_EXPAND_SZ;
}
- optional<std::wstring> get_registry_string(HKEY base, const CWStringView subKey, const CWStringView valuename)
+ Optional<std::wstring> get_registry_string(HKEY base, const CWStringView subKey, const CWStringView valuename)
{
HKEY k = nullptr;
LSTATUS ec = RegOpenKeyExW(base, subKey, NULL, KEY_READ, &k);

MODIFY
src/vcpkg_paths.cpp
src/vcpkg_paths.cpp
@@ -38,7 +38,7 @@ namespace vcpkg
return false;
}
- static optional<fs::path> find_if_has_equal_or_greater_version(const std::vector<fs::path>& candidate_paths, const std::wstring& version_check_arguments, const std::array<int, 3>& expected_version)
+ static Optional<fs::path> find_if_has_equal_or_greater_version(const std::vector<fs::path>& candidate_paths, const std::wstring& version_check_arguments, const std::array<int, 3>& expected_version)
{
auto it = std::find_if(candidate_paths.cbegin(), candidate_paths.cend(), [&](const fs::path& p)
{
@@ -99,7 +99,7 @@ namespace vcpkg
candidate_paths.push_back(System::get_ProgramFiles_platform_bitness() / "CMake" / "bin" / "cmake.exe");
candidate_paths.push_back(System::get_ProgramFiles_32_bit() / "CMake" / "bin");
- const optional<fs::path> path = find_if_has_equal_or_greater_version(candidate_paths, version_check_arguments, expected_version);
+ const Optional<fs::path> path = find_if_has_equal_or_greater_version(candidate_paths, version_check_arguments, expected_version);
if (auto p = path.get())
{
return *p;
@@ -143,7 +143,7 @@ namespace vcpkg
candidate_paths.push_back(System::get_ProgramFiles_platform_bitness() / "git" / "cmd" / "git.exe");
candidate_paths.push_back(System::get_ProgramFiles_32_bit() / "git" / "cmd" / "git.exe");
- const optional<fs::path> path = find_if_has_equal_or_greater_version(candidate_paths, version_check_arguments, expected_version);
+ const Optional<fs::path> path = find_if_has_equal_or_greater_version(candidate_paths, version_check_arguments, expected_version);
if (auto p = path.get())
{
return *p;
@@ -250,9 +250,9 @@ namespace vcpkg
return Strings::split(ec_data.output, "\n");
}
- static optional<fs::path> get_VS2015_installation_instance()
+ static Optional<fs::path> get_VS2015_installation_instance()
{
- const optional<std::wstring> vs2015_cmntools_optional = System::get_environmental_variable(L"VS140COMNTOOLS");
+ const Optional<std::wstring> vs2015_cmntools_optional = System::get_environmental_variable(L"VS140COMNTOOLS");
if (auto v = vs2015_cmntools_optional.get())
{
const fs::path vs2015_cmntools = fs::path(*v).parent_path(); // The call to parent_path() is needed because the env variable has a trailing backslash
@@ -305,7 +305,7 @@ namespace vcpkg
}
// VS2015
- const optional<fs::path> vs_2015_installation_instance = get_VS2015_installation_instance();
+ const Optional<fs::path> vs_2015_installation_instance = get_VS2015_installation_instance();
if (auto v = vs_2015_installation_instance.get())
{
const fs::path vs2015_vcvarsall_bat = *v / "VC" / "vcvarsall.bat";

optional<T> -> Optional<T>