aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package-configuration.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'bpkg/package-configuration.hxx')
-rw-r--r--bpkg/package-configuration.hxx50
1 files changed, 31 insertions, 19 deletions
diff --git a/bpkg/package-configuration.hxx b/bpkg/package-configuration.hxx
index 84f5256..80ededb 100644
--- a/bpkg/package-configuration.hxx
+++ b/bpkg/package-configuration.hxx
@@ -48,6 +48,23 @@ namespace bpkg
optional<package_key> dependent;
};
+ // A subset of config_variable_value for variable values set by the
+ // dependents (origin is buildfile). Used to track change history.
+ //
+ struct dependent_config_variable_value
+ {
+ string name;
+ optional<build2::names> value;
+ package_key dependent;
+ };
+
+ inline bool
+ operator== (const dependent_config_variable_value& x,
+ const dependent_config_variable_value& y)
+ {
+ return x.name == y.name && x.value == y.value && x.dependent == y.dependent;
+ }
+
class package_configuration: public vector<config_variable_value>
{
public:
@@ -79,6 +96,9 @@ namespace bpkg
}
};
+ using dependent_config_variable_values =
+ small_vector<dependent_config_variable_value, 1>;
+
class package_configurations: public small_vector<package_configuration, 1>
{
public:
@@ -96,28 +116,20 @@ namespace bpkg
push_back (package_configuration (p));
return back ();
}
- };
+ void
+ clear ()
+ {
+ small_vector<package_configuration, 1>::clear ();
+ change_history_.clear ();
+ }
- // A subset of config_variable_value for variable values set by the
- // dependents (origin is buildfile). Used to track change history.
- //
- struct dependent_config_variable_value
- {
- string name;
- optional<build2::names> value;
- package_key dependent;
- };
-
- class dependent_config_variable_values:
- public small_vector<dependent_config_variable_value, 1>
- {
+ // Implementation details.
+ //
public:
- /*
- @@
- void
- sort ();
- */
+ // Note: dependent_config_variable_values must be sorted by name.
+ //
+ small_vector<dependent_config_variable_values, 2> change_history_;
};
// Up-negotiate the configuration for the specified dependencies of the