dep_spec.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
00005  *
00006  * This file is part of the Paludis package manager. Paludis is free software;
00007  * you can redistribute it and/or modify it under the terms of the GNU General
00008  * Public License version 2, as published by the Free Software Foundation.
00009  *
00010  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef PALUDIS_GUARD_PALUDIS_DEP_SPEC_HH
00021 #define PALUDIS_GUARD_PALUDIS_DEP_SPEC_HH 1
00022 
00023 #include <paludis/util/attributes.hh>
00024 #include <paludis/util/clone.hh>
00025 #include <paludis/util/instantiation_policy.hh>
00026 #include <paludis/util/private_implementation_pattern.hh>
00027 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
00028 #include <paludis/util/fs_entry.hh>
00029 #include <paludis/util/named_value.hh>
00030 
00031 #include <paludis/dep_label.hh>
00032 #include <paludis/dep_spec-fwd.hh>
00033 #include <paludis/dep_tag-fwd.hh>
00034 #include <paludis/name.hh>
00035 #include <paludis/metadata_key_holder.hh>
00036 #include <paludis/version_operator-fwd.hh>
00037 #include <paludis/version_requirements-fwd.hh>
00038 #include <paludis/version_spec-fwd.hh>
00039 #include <paludis/slot_requirement-fwd.hh>
00040 #include <paludis/package_id-fwd.hh>
00041 #include <paludis/environment-fwd.hh>
00042 
00043 #include <tr1/memory>
00044 #include <tr1/functional>
00045 
00046 /** \file
00047  * Declarations for dependency spec classes.
00048  *
00049  * \ingroup g_dep_spec
00050  *
00051  * \section Examples
00052  *
00053  * - \ref example_dep_spec.cc "example_dep_spec.cc" (for specifications)
00054  * - \ref example_dep_label.cc "example_dep_label.cc" (for labels)
00055  * - \ref example_dep_tree.cc "example_dep_tree.cc" (for specification trees)
00056  * - \ref example_dep_tag.cc "example_dep_tag.cc" (for tags)
00057  */
00058 
00059 namespace paludis
00060 {
00061     /**
00062      * Base class for a dependency spec.
00063      *
00064      * \ingroup g_dep_spec
00065      * \nosubgrouping
00066      */
00067     class PALUDIS_VISIBLE DepSpec :
00068         private InstantiationPolicy<DepSpec, instantiation_method::NonCopyableTag>,
00069         private PrivateImplementationPattern<DepSpec>,
00070         public MetadataKeyHolder,
00071         public virtual Cloneable<DepSpec>
00072     {
00073         private:
00074             PrivateImplementationPattern<DepSpec>::ImpPtr & _imp;
00075 
00076         protected:
00077             DepSpec();
00078 
00079         public:
00080             ///\name Basic operations
00081             ///\{
00082 
00083             virtual ~DepSpec();
00084 
00085             ///\}
00086 
00087             ///\name Upcasts
00088             ///\{
00089 
00090             /**
00091              * Return us as a ConditionalDepSpec, or 0 if we are not a
00092              * ConditionalDepSpec.
00093              */
00094             virtual const ConditionalDepSpec * as_conditional_dep_spec() const
00095                 PALUDIS_ATTRIBUTE((warn_unused_result));
00096 
00097             /**
00098              * Return us as a PackageDepSpec, or 0 if we are not a
00099              * ConditionalDepSpec.
00100              */
00101             virtual const PackageDepSpec * as_package_dep_spec() const
00102                 PALUDIS_ATTRIBUTE((warn_unused_result));
00103 
00104             /**
00105              * The annotations_key, if non-zero, contains any annotations.
00106              */
00107             const std::tr1::shared_ptr<const MetadataSectionKey> annotations_key() const
00108                 PALUDIS_ATTRIBUTE((warn_unused_result));
00109 
00110             /**
00111              * Change the annotations key.
00112              */
00113             void set_annotations_key(const std::tr1::shared_ptr<const MetadataSectionKey> &);
00114 
00115             ///\}
00116     };
00117 
00118     /**
00119      * Represents a "|| ( )" dependency block.
00120      *
00121      * \ingroup g_dep_spec
00122      * \nosubgrouping
00123      */
00124     class PALUDIS_VISIBLE AnyDepSpec :
00125         public DepSpec
00126     {
00127         protected:
00128             virtual void need_keys_added() const;
00129 
00130         public:
00131             ///\name Basic operations
00132             ///\{
00133 
00134             AnyDepSpec();
00135 
00136             ///\}
00137 
00138             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00139     };
00140 
00141     /**
00142      * Represents a ( first second third ) or top level group of dependency
00143      * specs.
00144      *
00145      * \ingroup g_dep_spec
00146      * \nosubgrouping
00147      */
00148     class PALUDIS_VISIBLE AllDepSpec :
00149         public DepSpec
00150     {
00151         protected:
00152             virtual void need_keys_added() const;
00153 
00154         public:
00155             ///\name Basic operations
00156             ///\{
00157 
00158             AllDepSpec();
00159 
00160             ///\}
00161 
00162             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00163     };
00164 
00165     /**
00166      * Represents a dependency spec whose children should only be considered
00167      * upon a certain condition (for example, a use dependency block).
00168      *
00169      * \ingroup g_dep_spec
00170      * \since 0.26
00171      * \nosubgrouping
00172      */
00173     class PALUDIS_VISIBLE ConditionalDepSpec :
00174         public DepSpec,
00175         private PrivateImplementationPattern<ConditionalDepSpec>,
00176         public CloneUsingThis<DepSpec, ConditionalDepSpec>
00177     {
00178         friend std::ostream & operator<< (std::ostream &, const ConditionalDepSpec &);
00179 
00180         private:
00181             PrivateImplementationPattern<ConditionalDepSpec>::ImpPtr & _imp;
00182 
00183             std::string _as_string() const;
00184 
00185         protected:
00186             virtual void need_keys_added() const;
00187             virtual void clear_metadata_keys() const;
00188 
00189         public:
00190             ///\name Basic operations
00191             ///\{
00192 
00193             ConditionalDepSpec(const std::tr1::shared_ptr<const ConditionalDepSpecData> &);
00194             ConditionalDepSpec(const ConditionalDepSpec &);
00195             ~ConditionalDepSpec();
00196 
00197             ///\}
00198 
00199             virtual const ConditionalDepSpec * as_conditional_dep_spec() const;
00200 
00201             /**
00202              * Is our condition met?
00203              *
00204              * This takes into account inverses etc.
00205              */
00206             bool condition_met() const PALUDIS_ATTRIBUTE((warn_unused_result));
00207 
00208             /**
00209              * Is our condition meetable?
00210              *
00211              * This takes into account inverses, masks, forces etc.
00212              */
00213             bool condition_meetable() const PALUDIS_ATTRIBUTE((warn_unused_result));
00214 
00215             /**
00216              * Fetch our data.
00217              *
00218              * This shouldn't generally be used by clients, but some repositories use it
00219              * to gain access to additional data stored in the ConditionalDepSpecData.
00220              */
00221             const std::tr1::shared_ptr<const ConditionalDepSpecData> data() const PALUDIS_ATTRIBUTE((warn_unused_result));
00222     };
00223 
00224     /**
00225      * Data for a ConditionalDepSpec.
00226      *
00227      * \since 0.26
00228      * \ingroup g_dep_spec
00229      */
00230     class PALUDIS_VISIBLE ConditionalDepSpecData :
00231         public MetadataKeyHolder
00232     {
00233         public:
00234             ///\name Basic operations
00235             ///\{
00236 
00237             virtual ~ConditionalDepSpecData();
00238 
00239             ///\}
00240 
00241             /**
00242              * Fetch ourself as a string.
00243              */
00244             virtual std::string as_string() const = 0;
00245 
00246             /**
00247              * Fetch the result for condition_met.
00248              */
00249             virtual bool condition_met() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00250 
00251             /**
00252              * Fetch the result for condition_meetable.
00253              */
00254             virtual bool condition_meetable() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00255     };
00256 
00257     /**
00258      * A StringDepSpec represents a dep spec with an associated piece of text.
00259      *
00260      * \ingroup g_dep_spec
00261      * \nosubgrouping
00262      */
00263     class PALUDIS_VISIBLE StringDepSpec :
00264         public DepSpec
00265     {
00266         private:
00267             std::string _str;
00268 
00269         protected:
00270             ///\name Basic operations
00271             ///\{
00272 
00273             StringDepSpec(const std::string &);
00274 
00275             ~StringDepSpec();
00276 
00277             ///\}
00278 
00279             /**
00280              * Change our text.
00281              */
00282             void set_text(const std::string &);
00283 
00284         public:
00285             /**
00286              * Fetch our text.
00287              */
00288             std::string text() const;
00289     };
00290 
00291     /**
00292      * An additional requirement for a PackageDepSpec.
00293      *
00294      * \since 0.26
00295      * \ingroup g_dep_spec
00296      */
00297     class PALUDIS_VISIBLE AdditionalPackageDepSpecRequirement :
00298         private InstantiationPolicy<AdditionalPackageDepSpecRequirement, instantiation_method::NonCopyableTag>
00299     {
00300         public:
00301             virtual ~AdditionalPackageDepSpecRequirement();
00302 
00303             /**
00304              * Is our requirement met for a given PackageID?
00305              */
00306             virtual bool requirement_met(const Environment * const, const PackageID &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00307 
00308             /**
00309              * Return a human readable string representation of ourself.
00310              */
00311             virtual const std::string as_human_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00312 
00313             /**
00314              * Return a raw string representation of ourself.
00315              */
00316             virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00317     };
00318 
00319     namespace n
00320     {
00321         struct include_masked;
00322         struct path;
00323         struct repository;
00324     }
00325 
00326     /**
00327      * Data for PackageDepSpec.installable_to_repository_ptr() etc.
00328      *
00329      * \ingroup g_dep_spec
00330      * \since 0.32
00331      */
00332     struct InstallableToRepository
00333     {
00334         NamedValue<n::include_masked, bool> include_masked;
00335         NamedValue<n::repository, RepositoryName> repository;
00336     };
00337 
00338     /**
00339      * Data for PackageDepSpec.installable_to_path_ptr() etc.
00340      *
00341      * \ingroup g_dep_spec
00342      * \since 0.32
00343      */
00344     struct InstallableToPath
00345     {
00346         NamedValue<n::include_masked, bool> include_masked;
00347         NamedValue<n::path, FSEntry> path;
00348     };
00349 
00350     /**
00351      * A PartiallyMadePackageDepSpec is returned by make_package_dep_spec()
00352      * and is used to incrementally build a PackageDepSpec.
00353      *
00354      * \ingroup g_dep_spec
00355      * \since 0.26
00356      */
00357     class PALUDIS_VISIBLE PartiallyMadePackageDepSpec :
00358         private PrivateImplementationPattern<PartiallyMadePackageDepSpec>
00359     {
00360         public:
00361             ///\name Basic operations
00362             ///\{
00363 
00364             PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpecOptions &);
00365             ~PartiallyMadePackageDepSpec();
00366             PartiallyMadePackageDepSpec(const PackageDepSpec &);
00367             PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec &);
00368 
00369             ///\}
00370 
00371             /**
00372              * Set our package requirements, return ourself.
00373              */
00374             PartiallyMadePackageDepSpec & package(const QualifiedPackageName &);
00375 
00376             /**
00377              * Set our slot requirements, return ourself.
00378              */
00379             PartiallyMadePackageDepSpec & slot_requirement(const std::tr1::shared_ptr<const SlotRequirement> &);
00380 
00381             /**
00382              * Set our in-repository requirement, return ourself.
00383              */
00384             PartiallyMadePackageDepSpec & in_repository(const RepositoryName &);
00385 
00386             /**
00387              * Set our from-repository requirement, return ourself.
00388              */
00389             PartiallyMadePackageDepSpec & from_repository(const RepositoryName &);
00390 
00391             /**
00392              * Set our installable-to-repository requirement, return ourself.
00393              *
00394              * \since 0.32
00395              */
00396             PartiallyMadePackageDepSpec & installable_to_repository(const InstallableToRepository &);
00397 
00398             /**
00399              * Set our installed-at-path requirement, return ourself.
00400              *
00401              * \since 0.32
00402              */
00403             PartiallyMadePackageDepSpec & installed_at_path(const FSEntry &);
00404 
00405             /**
00406              * Set our installable-to-path requirement, return ourself.
00407              *
00408              * \since 0.32
00409              */
00410             PartiallyMadePackageDepSpec & installable_to_path(const InstallableToPath &);
00411 
00412             /**
00413              * Set our package name part requirements, return ourself.
00414              */
00415             PartiallyMadePackageDepSpec & package_name_part(const PackageNamePart &);
00416 
00417             /**
00418              * Set our category name part requirements, return ourself.
00419              */
00420             PartiallyMadePackageDepSpec & category_name_part(const CategoryNamePart &);
00421 
00422             /**
00423              * Add a version requirement, return ourself.
00424              */
00425             PartiallyMadePackageDepSpec & version_requirement(const VersionRequirement &);
00426 
00427             /**
00428              * Set our version requirements mode, return ourself.
00429              */
00430             PartiallyMadePackageDepSpec & version_requirements_mode(const VersionRequirementsMode &);
00431 
00432             /**
00433              * Add an additional requirement, return ourself.
00434              */
00435             PartiallyMadePackageDepSpec & additional_requirement(
00436                     const std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> &);
00437 
00438             /**
00439              * Add annotations
00440              */
00441             PartiallyMadePackageDepSpec & annotations(
00442                     const std::tr1::shared_ptr<const MetadataSectionKey> &);
00443 
00444             /**
00445              * Turn ourselves into a PackageDepSpec.
00446              */
00447             operator const PackageDepSpec() const;
00448 
00449             /**
00450              * Explicitly turn ourselves into a PackageDepSpec.
00451              */
00452             const PackageDepSpec to_package_dep_spec() const;
00453     };
00454 
00455     /**
00456      * A PackageDepSpec represents a package name (for example,
00457      * 'app-editors/vim'), possibly with associated version and SLOT
00458      * restrictions.
00459      *
00460      * A PackageDepSpec is implemented in terms of PackageDepSpecData. Individual
00461      * repositories provide their own way of creating PackageDepSpec::Data that
00462      * handle the native syntax for those repositories (e.g. CRAN uses
00463      * "Blah (>= 1.23)" whilst E uses ">=cat/blah-1.23").
00464      *
00465      * To create a PackageDepSpec from user input, use
00466      * parse_user_package_dep_spec(), and for programmer input, use
00467      * make_package_dep_spec().
00468      *
00469      * \ingroup g_dep_spec
00470      * \nosubgrouping
00471      */
00472     class PALUDIS_VISIBLE PackageDepSpec :
00473         public StringDepSpec,
00474         private PrivateImplementationPattern<PackageDepSpec>,
00475         public CloneUsingThis<DepSpec, PackageDepSpec>
00476     {
00477         friend std::ostream & operator<< (std::ostream &, const PackageDepSpec &);
00478 
00479         private:
00480             const PackageDepSpec & operator= (const PackageDepSpec &);
00481             std::string _as_string() const;
00482 
00483             PrivateImplementationPattern<PackageDepSpec>::ImpPtr & _imp;
00484 
00485         protected:
00486             virtual void need_keys_added() const;
00487 
00488         public:
00489             ///\name Basic operations
00490             ///\{
00491 
00492             /**
00493              * Constructor.
00494              *
00495              * Clients will usually use either parse_user_package_dep_spec() or
00496              * make_package_dep_spec() rather than calling this method
00497              * directly. Repositories will define their own way of creating
00498              * a PackageDepSpec.
00499              *
00500              * \since 0.26
00501              */
00502             PackageDepSpec(const std::tr1::shared_ptr<const PackageDepSpecData> &);
00503 
00504             PackageDepSpec(const PackageDepSpec &);
00505 
00506             ~PackageDepSpec();
00507 
00508             ///\}
00509 
00510             /**
00511              * Fetch the package name (may be a zero pointer).
00512              */
00513             std::tr1::shared_ptr<const QualifiedPackageName> package_ptr() const;
00514 
00515             /**
00516              * Fetch the package name part, if wildcarded, or a zero pointer otherwise.
00517              */
00518             std::tr1::shared_ptr<const PackageNamePart> package_name_part_ptr() const;
00519 
00520             /**
00521              * Fetch the category name part, if wildcarded, or a zero pointer otherwise.
00522              */
00523             std::tr1::shared_ptr<const CategoryNamePart> category_name_part_ptr() const;
00524 
00525             /**
00526              * Fetch the version requirements (may be a zero pointer).
00527              */
00528             std::tr1::shared_ptr<const VersionRequirements> version_requirements_ptr() const;
00529 
00530             /**
00531              * Fetch the version requirements mode.
00532              */
00533             VersionRequirementsMode version_requirements_mode() const;
00534 
00535             /**
00536              * Fetch the slot requirement (may be a zero pointer).
00537              */
00538             std::tr1::shared_ptr<const SlotRequirement> slot_requirement_ptr() const;
00539 
00540             /**
00541              * Fetch the in-repository requirement (may be a zero pointer).
00542              */
00543             std::tr1::shared_ptr<const RepositoryName> in_repository_ptr() const;
00544 
00545             /**
00546              * Fetch the installable-to-repository requirement (may be a zero pointer).
00547              *
00548              * \since 0.32
00549              */
00550             std::tr1::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const;
00551 
00552             /**
00553              * Fetch the from-repository requirement (may be a zero pointer).
00554              */
00555             std::tr1::shared_ptr<const RepositoryName> from_repository_ptr() const;
00556 
00557             /**
00558              * Fetch the installed-at-path requirement (may be a zero pointer).
00559              *
00560              * \since 0.32
00561              */
00562             std::tr1::shared_ptr<const FSEntry> installed_at_path_ptr() const;
00563 
00564             /**
00565              * Fetch the installable-to-path requirement (may be a zero pointer).
00566              *
00567              * \since 0.32
00568              */
00569             std::tr1::shared_ptr<const InstallableToPath> installable_to_path_ptr() const;
00570 
00571             /**
00572              * Fetch any additional requirements (may be a zero pointer).
00573              */
00574             std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const;
00575 
00576             /**
00577              * Fetch our tag.
00578              */
00579             std::tr1::shared_ptr<const DepTag> tag() const;
00580 
00581             /**
00582              * Set our tag.
00583              */
00584             void set_tag(const std::tr1::shared_ptr<const DepTag> & s);
00585 
00586             /**
00587              * Fetch a copy of ourself without additional requirements.
00588              */
00589             std::tr1::shared_ptr<PackageDepSpec> without_additional_requirements() const;
00590 
00591             /**
00592              * Access to our data.
00593              */
00594             std::tr1::shared_ptr<const PackageDepSpecData> data() const;
00595 
00596             virtual const PackageDepSpec * as_package_dep_spec() const;
00597     };
00598 
00599     /**
00600      * Data for a PackageDepSpec.
00601      *
00602      * \since 0.26
00603      * \ingroup g_dep_spec
00604      */
00605     class PALUDIS_VISIBLE PackageDepSpecData
00606     {
00607         public:
00608             ///\name Basic operations
00609             ///\{
00610 
00611             virtual ~PackageDepSpecData();
00612 
00613             ///\}
00614 
00615             /**
00616              * Fetch ourself as a string.
00617              */
00618             virtual std::string as_string() const = 0;
00619 
00620             /**
00621              * Fetch the package name (may be a zero pointer).
00622              */
00623             virtual std::tr1::shared_ptr<const QualifiedPackageName> package_ptr() const = 0;
00624 
00625             /**
00626              * Fetch the package name part, if wildcarded, or a zero pointer otherwise.
00627              */
00628             virtual std::tr1::shared_ptr<const PackageNamePart> package_name_part_ptr() const = 0;
00629 
00630             /**
00631              * Fetch the category name part, if wildcarded, or a zero pointer otherwise.
00632              */
00633             virtual std::tr1::shared_ptr<const CategoryNamePart> category_name_part_ptr() const = 0;
00634 
00635             /**
00636              * Fetch the version requirements (may be a zero pointer).
00637              */
00638             virtual std::tr1::shared_ptr<const VersionRequirements> version_requirements_ptr() const = 0;
00639 
00640             /**
00641              * Fetch the version requirements mode.
00642              */
00643             virtual VersionRequirementsMode version_requirements_mode() const = 0;
00644 
00645             /**
00646              * Fetch the slot name (may be a zero pointer).
00647              */
00648             virtual std::tr1::shared_ptr<const SlotRequirement> slot_requirement_ptr() const = 0;
00649 
00650             /**
00651              * Fetch the from-repository requirement (may be a zero pointer).
00652              */
00653             virtual std::tr1::shared_ptr<const RepositoryName> in_repository_ptr() const = 0;
00654 
00655             /**
00656              * Fetch the installable-to-repository requirement (may be a zero pointer).
00657              *
00658              * \since 0.32
00659              */
00660             virtual std::tr1::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const = 0;
00661 
00662             /**
00663              * Fetch the from-repository requirement (may be a zero pointer).
00664              */
00665             virtual std::tr1::shared_ptr<const RepositoryName> from_repository_ptr() const = 0;
00666 
00667             /**
00668              * Fetch the installed-at-path requirement (may be a zero pointer).
00669              *
00670              * \since 0.32
00671              */
00672             virtual std::tr1::shared_ptr<const FSEntry> installed_at_path_ptr() const = 0;
00673 
00674             /**
00675              * Fetch the installable-to-path requirement (may be a zero pointer).
00676              *
00677              * \since 0.32
00678              */
00679             virtual std::tr1::shared_ptr<const InstallableToPath> installable_to_path_ptr() const = 0;
00680 
00681             /**
00682              * Fetch the additional requirements (may be a zero pointer).
00683              */
00684             virtual std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const = 0;
00685 
00686             /**
00687              * Fetch the annotations (may be a zero pointer).
00688              */
00689             virtual std::tr1::shared_ptr<const MetadataSectionKey> annotations_key() const = 0;
00690 
00691             /**
00692              * Fetch options if we're being used to construct a new PartiallyMadePackageDepSpec.
00693              *
00694              * \since 0.38
00695              */
00696             virtual const PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec() const = 0;
00697     };
00698 
00699     /**
00700      * A PlainTextDepSpec represents a plain text entry.
00701      *
00702      * \ingroup g_dep_spec
00703      * \nosubgrouping
00704      */
00705     class PALUDIS_VISIBLE PlainTextDepSpec :
00706         public StringDepSpec
00707     {
00708         protected:
00709             virtual void need_keys_added() const;
00710 
00711         public:
00712             ///\name Basic operations
00713             ///\{
00714 
00715             PlainTextDepSpec(const std::string &);
00716 
00717             ///\}
00718 
00719             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00720     };
00721 
00722     /**
00723      * A NamedSetDepSpec represents a named package set.
00724      *
00725      * \ingroup g_dep_spec
00726      * \nosubgrouping
00727      */
00728     class PALUDIS_VISIBLE NamedSetDepSpec :
00729         public StringDepSpec
00730     {
00731         private:
00732             const SetName _name;
00733 
00734         protected:
00735             virtual void need_keys_added() const;
00736 
00737         public:
00738             ///\name Basic operations
00739             ///\{
00740 
00741             NamedSetDepSpec(const SetName &);
00742 
00743             ///\}
00744 
00745             /// Fetch the name of our set.
00746             const SetName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
00747 
00748             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00749     };
00750 
00751     /**
00752      * A LicenseDepSpec represents a license entry.
00753      *
00754      * \ingroup g_dep_spec
00755      * \since 0.26
00756      * \nosubgrouping
00757      */
00758     class PALUDIS_VISIBLE LicenseDepSpec :
00759         public StringDepSpec
00760     {
00761         protected:
00762             virtual void need_keys_added() const;
00763 
00764         public:
00765             ///\name Basic operations
00766             ///\{
00767 
00768             LicenseDepSpec(const std::string &);
00769 
00770             ///\}
00771 
00772             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00773     };
00774 
00775     /**
00776      * A FetchableURIDepSpec represents a fetchable URI part.
00777      *
00778      * It differs from a SimpleURIDepSpec in that it supports arrow notation. Arrows
00779      * are used by exheres to allow downloading to a filename other than that used by
00780      * the original URL.
00781      *
00782      * \ingroup g_dep_spec
00783      * \since 0.26
00784      * \nosubgrouping
00785      */
00786     class PALUDIS_VISIBLE FetchableURIDepSpec :
00787         public StringDepSpec
00788     {
00789         protected:
00790             virtual void need_keys_added() const;
00791 
00792         public:
00793             ///\name Basic operations
00794             ///\{
00795 
00796             FetchableURIDepSpec(const std::string &);
00797 
00798             ///\}
00799 
00800             /**
00801              * The original URL (that is, the text to the left of the arrow, if present,
00802              * or the entire text otherwise).
00803              */
00804             std::string original_url() const;
00805 
00806             /**
00807              * The renamed URL filename (that is, the text to the right of the arrow,
00808              * if present, or an empty string otherwise).
00809              */
00810             std::string renamed_url_suffix() const;
00811 
00812             /**
00813              * The filename (that is, the renamed URL suffix, if present, or the text
00814              * after the final / in the original URL otherwise).
00815              */
00816             std::string filename() const;
00817 
00818             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00819     };
00820 
00821     /**
00822      * A SimpleURIDepSpec represents a simple URI part.
00823      *
00824      * Unlike FetchableURIDepSpec, arrow notation is not supported.
00825      *
00826      * \ingroup g_dep_spec
00827      * \since 0.26
00828      * \nosubgrouping
00829      */
00830     class PALUDIS_VISIBLE SimpleURIDepSpec :
00831         public StringDepSpec
00832     {
00833         protected:
00834             virtual void need_keys_added() const;
00835 
00836         public:
00837             ///\name Basic operations
00838             ///\{
00839 
00840             SimpleURIDepSpec(const std::string &);
00841 
00842             ///\}
00843 
00844             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00845     };
00846 
00847     /**
00848      * Thrown if an invalid package dep spec specification is encountered.
00849      *
00850      * \ingroup g_exceptions
00851      * \ingroup g_dep_spec
00852      * \nosubgrouping
00853      */
00854     class PALUDIS_VISIBLE PackageDepSpecError :
00855         public Exception
00856     {
00857         public:
00858             ///\name Basic operations
00859             ///\{
00860 
00861             PackageDepSpecError(const std::string & msg) throw ();
00862 
00863             ///\}
00864     };
00865 
00866     /**
00867      * A BlockDepSpec represents a block on a package name (for example,
00868      * 'app-editors/vim'), possibly with associated version and SLOT
00869      * restrictions.
00870      *
00871      * \ingroup g_dep_spec
00872      * \nosubgrouping
00873      */
00874     class PALUDIS_VISIBLE BlockDepSpec :
00875         public StringDepSpec
00876     {
00877         private:
00878             std::tr1::shared_ptr<const PackageDepSpec> _spec;
00879 
00880         protected:
00881             virtual void need_keys_added() const;
00882 
00883         public:
00884             ///\name Basic operations
00885             ///\{
00886 
00887             BlockDepSpec(const std::tr1::shared_ptr<const PackageDepSpec> & spec);
00888             BlockDepSpec(const std::tr1::shared_ptr<const PackageDepSpec> & spec, const std::string & text);
00889             BlockDepSpec(const BlockDepSpec &);
00890 
00891             ///\}
00892 
00893             /**
00894              * Fetch the spec we're blocking.
00895              */
00896             std::tr1::shared_ptr<const PackageDepSpec> blocked_spec() const;
00897 
00898             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00899     };
00900 
00901     /**
00902      * A LabelsDepSpec represents a labels entry using a particular visitor
00903      * types class.
00904      *
00905      * \see DependencyLabelsDepSpec
00906      * \see URILabelsDepSpec
00907      * \since 0.26
00908      * \ingroup g_dep_spec
00909      * \nosubgrouping
00910      */
00911     template <typename Labels_>
00912     class PALUDIS_VISIBLE LabelsDepSpec :
00913         public DepSpec,
00914         private PrivateImplementationPattern<LabelsDepSpec<Labels_> >
00915     {
00916         private:
00917             typename PrivateImplementationPattern<LabelsDepSpec>::ImpPtr & _imp;
00918 
00919         protected:
00920             virtual void need_keys_added() const;
00921 
00922         public:
00923             ///\name Basic operations
00924             ///\{
00925 
00926             LabelsDepSpec();
00927             ~LabelsDepSpec();
00928 
00929             ///\}
00930 
00931             ///\name Contained labels
00932             ///\{
00933 
00934             void add_label(const std::tr1::shared_ptr<const Labels_> &);
00935 
00936             struct ConstIteratorTag;
00937             typedef WrappedForwardIterator<ConstIteratorTag,
00938                     const std::tr1::shared_ptr<const Labels_> > ConstIterator;
00939 
00940             ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
00941             ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
00942 
00943             ///\}
00944 
00945             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00946     };
00947 
00948     class PALUDIS_VISIBLE PlainTextLabelDepSpec :
00949         public StringDepSpec
00950     {
00951         protected:
00952             virtual void need_keys_added() const;
00953 
00954         public:
00955             ///\name Basic operations
00956             ///\{
00957 
00958             PlainTextLabelDepSpec(const std::string &);
00959             ~PlainTextLabelDepSpec();
00960 
00961             ///\}
00962 
00963             virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
00964 
00965             const std::string label() const PALUDIS_ATTRIBUTE((warn_unused_result));
00966     };
00967 
00968 #ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
00969     extern template class Cloneable<DepSpec>;
00970     extern template class PrivateImplementationPattern<ConditionalDepSpec>;
00971     extern template class CloneUsingThis<DepSpec, ConditionalDepSpec>;
00972     extern template class PrivateImplementationPattern<PartiallyMadePackageDepSpec>;
00973     extern template class PrivateImplementationPattern<PackageDepSpec>;
00974     extern template class CloneUsingThis<DepSpec, PackageDepSpec>;
00975     extern template class PrivateImplementationPattern<DependencyLabelsDepSpec>;
00976     extern template class PrivateImplementationPattern<URILabelsDepSpec>;
00977     extern template class PrivateImplementationPattern<PlainTextLabelDepSpec>;
00978 #endif
00979 }
00980 
00981 #endif

Generated on Mon Sep 21 10:36:08 2009 for paludis by  doxygen 1.5.4