aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-08-22 15:14:15 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-08-22 15:14:15 -0700
commit92dd1b77ed043da376c86874aacc1233270fedae (patch)
tree70177d807fcbfd4614b82b66f11d30f8d4c4731d /toolsrc/include
parentbee29497f9e210c2b8d33edccba0d1d95188d852 (diff)
downloadvcpkg-92dd1b77ed043da376c86874aacc1233270fedae.tar.gz
vcpkg-92dd1b77ed043da376c86874aacc1233270fedae.zip
[vcpkg] Add Util::ResourceBase, use MoveOnlyBase
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg_Dependencies.h20
-rw-r--r--toolsrc/include/vcpkg_Util.h10
2 files changed, 14 insertions, 16 deletions
diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h
index bfb452596..93719efe9 100644
--- a/toolsrc/include/vcpkg_Dependencies.h
+++ b/toolsrc/include/vcpkg_Dependencies.h
@@ -70,16 +70,12 @@ namespace vcpkg::Dependencies
REMOVE
};
- struct RemovePlanAction
+ struct RemovePlanAction : Util::MoveOnlyBase
{
static bool compare_by_name(const RemovePlanAction* left, const RemovePlanAction* right);
RemovePlanAction();
RemovePlanAction(const PackageSpec& spec, const RemovePlanType& plan_type, const RequestType& request_type);
- RemovePlanAction(const RemovePlanAction&) = delete;
- RemovePlanAction(RemovePlanAction&&) = default;
- RemovePlanAction& operator=(const RemovePlanAction&) = delete;
- RemovePlanAction& operator=(RemovePlanAction&&) = default;
PackageSpec spec;
RemovePlanType plan_type;
@@ -102,16 +98,12 @@ namespace vcpkg::Dependencies
ALREADY_BUILT
};
- struct ExportPlanAction
+ struct ExportPlanAction : Util::MoveOnlyBase
{
static bool compare_by_name(const ExportPlanAction* left, const ExportPlanAction* right);
ExportPlanAction();
ExportPlanAction(const PackageSpec& spec, const AnyParagraph& any_paragraph, const RequestType& request_type);
- ExportPlanAction(const ExportPlanAction&) = delete;
- ExportPlanAction(ExportPlanAction&&) = default;
- ExportPlanAction& operator=(const ExportPlanAction&) = delete;
- ExportPlanAction& operator=(ExportPlanAction&&) = default;
PackageSpec spec;
AnyParagraph any_paragraph;
@@ -121,23 +113,19 @@ namespace vcpkg::Dependencies
__interface PortFileProvider { virtual const SourceControlFile& get_control_file(const std::string& spec) const; };
- struct MapPortFile : PortFileProvider
+ struct MapPortFile : Util::ResourceBase, PortFileProvider
{
const std::unordered_map<std::string, SourceControlFile>& ports;
explicit MapPortFile(const std::unordered_map<std::string, SourceControlFile>& map);
const SourceControlFile& get_control_file(const std::string& spec) const override;
};
- struct PathsPortFile : PortFileProvider
+ struct PathsPortFile : Util::ResourceBase, PortFileProvider
{
const VcpkgPaths& ports;
mutable std::unordered_map<std::string, SourceControlFile> cache;
explicit PathsPortFile(const VcpkgPaths& paths);
const SourceControlFile& get_control_file(const std::string& spec) const override;
-
- private:
- PathsPortFile(const PathsPortFile&) = delete;
- PathsPortFile& operator=(const PathsPortFile&) = delete;
};
std::vector<InstallPlanAction> create_install_plan(const PortFileProvider& port_file_provider,
diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg_Util.h
index da2f8eb69..4f45cd2c7 100644
--- a/toolsrc/include/vcpkg_Util.h
+++ b/toolsrc/include/vcpkg_Util.h
@@ -72,4 +72,14 @@ namespace vcpkg::Util
MoveOnlyBase& operator=(const MoveOnlyBase&) = delete;
MoveOnlyBase& operator=(MoveOnlyBase&&) = default;
};
+
+ struct ResourceBase
+ {
+ ResourceBase() = default;
+ ResourceBase(const ResourceBase&) = delete;
+ ResourceBase(ResourceBase&&) = delete;
+
+ ResourceBase& operator=(const ResourceBase&) = delete;
+ ResourceBase& operator=(ResourceBase&&) = delete;
+ };
} \ No newline at end of file