Change vcpkg::parse() to vcpkg::package_spec::from_string()

This commit is contained in:
Alexander Karatarakis 2016-09-23 16:39:07 -07:00
Родитель cfd692d7fb
Коммит 3d612ff8a3
5 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -8,14 +8,14 @@ namespace vcpkg
{
struct package_spec
{
static expected<package_spec> from_string(const std::string& spec, const triplet& default_target_triplet);
std::string name;
triplet target_triplet;
std::string dir() const;
};
expected<package_spec> parse(const std::string& spec, const triplet& default_target_triplet);
std::string to_string(const package_spec& spec);
std::string to_printf_arg(const package_spec& spec);

Просмотреть файл

@ -148,7 +148,7 @@ namespace vcpkg
exit(EXIT_FAILURE);
}
expected<package_spec> current_spec = vcpkg::parse(args.command_arguments[0], default_target_triplet);
expected<package_spec> current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet);
if (auto spec = current_spec.get())
{
Environment::ensure_utilities_on_path(paths);

Просмотреть файл

@ -2,7 +2,7 @@
namespace vcpkg
{
expected<package_spec> parse(const std::string& spec, const triplet& default_target_triplet)
expected<package_spec> package_spec::from_string(const std::string& spec, const triplet& default_target_triplet)
{
auto pos = spec.find(':');
if (pos == std::string::npos)

Просмотреть файл

@ -308,7 +308,7 @@ namespace UnitTest1
TEST_METHOD(package_spec_parse)
{
vcpkg::expected<vcpkg::package_spec> spec = vcpkg::parse("zlib", vcpkg::triplet::X86_WINDOWS);
vcpkg::expected<vcpkg::package_spec> spec = vcpkg::package_spec::from_string("zlib", vcpkg::triplet::X86_WINDOWS);
Assert::AreEqual(vcpkg::package_spec_parse_result::success, vcpkg::to_package_spec_parse_result(spec.error_code()));
Assert::AreEqual("zlib", spec.get()->name.c_str());
Assert::AreEqual(vcpkg::triplet::X86_WINDOWS.value, spec.get()->target_triplet.value);
@ -316,7 +316,7 @@ namespace UnitTest1
TEST_METHOD(package_spec_parse_with_arch)
{
vcpkg::expected<vcpkg::package_spec> spec = vcpkg::parse("zlib:x64-uwp", vcpkg::triplet::X86_WINDOWS);
vcpkg::expected<vcpkg::package_spec> spec = vcpkg::package_spec::from_string("zlib:x64-uwp", vcpkg::triplet::X86_WINDOWS);
Assert::AreEqual(vcpkg::package_spec_parse_result::success, vcpkg::to_package_spec_parse_result(spec.error_code()));
Assert::AreEqual("zlib", spec.get()->name.c_str());
Assert::AreEqual(vcpkg::triplet::X64_UWP.value, spec.get()->target_triplet.value);
@ -324,7 +324,7 @@ namespace UnitTest1
TEST_METHOD(package_spec_parse_with_multiple_colon)
{
auto ec = vcpkg::parse("zlib:x86-uwp:", vcpkg::triplet::X86_WINDOWS).error_code();
auto ec = vcpkg::package_spec::from_string("zlib:x86-uwp:", vcpkg::triplet::X86_WINDOWS).error_code();
Assert::AreEqual(vcpkg::package_spec_parse_result::too_many_colons, vcpkg::to_package_spec_parse_result(ec));
}

Просмотреть файл

@ -196,7 +196,7 @@ namespace vcpkg
for (const std::string& command_argument : command_arguments)
{
expected<package_spec> current_spec = vcpkg::parse(command_argument, default_target_triplet);
expected<package_spec> current_spec = package_spec::from_string(command_argument, default_target_triplet);
if (auto spec = current_spec.get())
{
specs.push_back(std::move(*spec));