aboutsummaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-15 11:36:47 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-15 11:36:47 +0000
commit7e125b4740d8bb50aa06b97d1dc070dfbce8bb3a (patch)
treea690976211d4e380d4ffbccfdf5ae53d7b0f1e38 /doc/api
parentae7109237069623709637fd16b0230dddcccda8d (diff)
downloadpaludis-7e125b4740d8bb50aa06b97d1dc070dfbce8bb3a.tar.gz
paludis-7e125b4740d8bb50aa06b97d1dc070dfbce8bb3a.tar.xz
Start removing the global concept of use flags: rename UseDepSpec to ConditionalDepSpec, move the descent logic into the spec.
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/cplusplus/examples/example_dep_label.cc9
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec_flattener.cc6
-rw-r--r--doc/api/cplusplus/examples/example_dep_tree.cc11
-rw-r--r--doc/api/cplusplus/examples/example_formatter.cc12
4 files changed, 18 insertions, 20 deletions
diff --git a/doc/api/cplusplus/examples/example_dep_label.cc b/doc/api/cplusplus/examples/example_dep_label.cc
index 7429e7747..3627bfcc6 100644
--- a/doc/api/cplusplus/examples/example_dep_label.cc
+++ b/doc/api/cplusplus/examples/example_dep_label.cc
@@ -86,7 +86,7 @@ namespace
/* This visitor class collects src_uri entries and stores the result in
* a provided map. Label statuses are handled by a stack. When we enter
- * a block (an AllDepSpec or a UseDepSpec), we duplicate the top item
+ * a block (an AllDepSpec or a ConditionalDepSpec), we duplicate the top item
* of the stack, since labels recurse into subblocks. When we encounter
* a label, we replace the top item of the stack. */
class DistfilesCollector :
@@ -115,13 +115,12 @@ namespace
_restricted.pop_back();
}
- void visit_sequence(const UseDepSpec &,
+ void visit_sequence(const ConditionalDepSpec &,
FetchableURISpecTree::ConstSequenceIterator cur,
FetchableURISpecTree::ConstSequenceIterator end)
{
- /* Always recurse over a UseDepSpec's children. In real world
- * code, we would more likely check whether the use flag is
- * accepted. */
+ /* Always recurse over a ConditionalDepSpec's children. In real world
+ * code, we would more likely check whether condition is met. */
_restricted.push_back(_restricted.back());
std::for_each(cur, end, accept_visitor(*this));
_restricted.pop_back();
diff --git a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
index 1974bce6d..2b4d3bb12 100644
--- a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
@@ -58,7 +58,7 @@ int main(int argc, char * argv[])
if ((*i)->provide_key())
{
/* Create our flattener... */
- DepSpecFlattener<ProvideSpecTree, PackageDepSpec> provides(env.get(), **i);
+ DepSpecFlattener<ProvideSpecTree, PackageDepSpec> provides(env.get());
/* Populate it by making it visit the key's value */
(*i)->provide_key()->value()->accept(provides);
@@ -74,7 +74,7 @@ int main(int argc, char * argv[])
/* Again for homepage */
if ((*i)->homepage_key())
{
- DepSpecFlattener<SimpleURISpecTree, SimpleURIDepSpec> homepages(env.get(), **i);
+ DepSpecFlattener<SimpleURISpecTree, SimpleURIDepSpec> homepages(env.get());
(*i)->homepage_key()->value()->accept(homepages);
cout << " " << left << setw(24) << "Homepages:" << " "
@@ -91,7 +91,7 @@ int main(int argc, char * argv[])
if ((*i)->end_metadata() != (*i)->find_metadata("RESTRICT") &&
visitor_cast<const MetadataSpecTreeKey<RestrictSpecTree> >(**(*i)->find_metadata("RESTRICT")))
{
- DepSpecFlattener<RestrictSpecTree, PlainTextDepSpec> restricts(env.get(), **i);
+ DepSpecFlattener<RestrictSpecTree, PlainTextDepSpec> restricts(env.get());
visitor_cast<const MetadataSpecTreeKey<RestrictSpecTree> >(
**(*i)->find_metadata("RESTRICT"))->value()->accept(restricts);
diff --git a/doc/api/cplusplus/examples/example_dep_tree.cc b/doc/api/cplusplus/examples/example_dep_tree.cc
index 12ea68e63..26717c078 100644
--- a/doc/api/cplusplus/examples/example_dep_tree.cc
+++ b/doc/api/cplusplus/examples/example_dep_tree.cc
@@ -71,13 +71,13 @@ namespace
using ConstVisitor<DependencySpecTree>::VisitConstSequence<DependenciesCollector, AllDepSpec>::visit_sequence;
using ConstVisitor<DependencySpecTree>::VisitConstSequence<DependenciesCollector, AnyDepSpec>::visit_sequence;
- void visit_sequence(const UseDepSpec & u,
+ void visit_sequence(const ConditionalDepSpec & u,
DependencySpecTree::ConstSequenceIterator cur,
DependencySpecTree::ConstSequenceIterator end)
{
/* Was this use flag enabled (or, if we're inverse, disabled)
* when we built this package? */
- if (_env->query_use(u.flag(), *_id) ^ u.inverse())
+ if (u.condition_met())
std::for_each(cur, end, accept_visitor(*this));
}
@@ -155,13 +155,12 @@ namespace
using ConstVisitor<FetchableURISpecTree>::VisitConstSequence<FileExtensionsCollector, AllDepSpec>::visit_sequence;
- void visit_sequence(const UseDepSpec & u,
+ void visit_sequence(const ConditionalDepSpec & u,
FetchableURISpecTree::ConstSequenceIterator cur,
FetchableURISpecTree::ConstSequenceIterator end)
{
- /* Was this use flag enabled (or, if we're inverse, disabled)
- * when we built this package? */
- if (_env->query_use(u.flag(), *_id) ^ u.inverse())
+ /* Was the condition met when we built this package? */
+ if (u.condition_met())
std::for_each(cur, end, accept_visitor(*this));
}
diff --git a/doc/api/cplusplus/examples/example_formatter.cc b/doc/api/cplusplus/examples/example_formatter.cc
index bc6aafbec..72f7e08c4 100644
--- a/doc/api/cplusplus/examples/example_formatter.cc
+++ b/doc/api/cplusplus/examples/example_formatter.cc
@@ -70,7 +70,7 @@ namespace
public CanSpace,
public CanFormat<PackageDepSpec>,
public CanFormat<DependencyLabelsDepSpec>,
- public CanFormat<UseDepSpec>,
+ public CanFormat<ConditionalDepSpec>,
public CanFormat<NamedSetDepSpec>,
public CanFormat<BlockDepSpec>
{
@@ -97,27 +97,27 @@ namespace
return span_colour(escape_html(stringify(s)), "#666666");
}
- std::string format(const UseDepSpec & s, const format::Plain &) const
+ std::string format(const ConditionalDepSpec & s, const format::Plain &) const
{
return span_colour(escape_html(stringify(s)), "#666666");
}
- std::string format(const UseDepSpec & s, const format::Enabled &) const
+ std::string format(const ConditionalDepSpec & s, const format::Enabled &) const
{
return span_colour(escape_html(stringify(s)), "#66ff66");
}
- std::string format(const UseDepSpec & s, const format::Disabled &) const
+ std::string format(const ConditionalDepSpec & s, const format::Disabled &) const
{
return span_colour(escape_html(stringify(s)), "#ff6666");
}
- std::string format(const UseDepSpec & s, const format::Forced &) const
+ std::string format(const ConditionalDepSpec & s, const format::Forced &) const
{
return span_colour(escape_html("(" + stringify(s) + ")"), "#66ff66");
}
- std::string format(const UseDepSpec & s, const format::Masked &) const
+ std::string format(const ConditionalDepSpec & s, const format::Masked &) const
{
return span_colour(escape_html("(" + stringify(s) + ")"), "#ff6666");
}