diff options
author | 2011-04-08 16:02:54 +0100 | |
---|---|---|
committer | 2011-04-08 16:02:54 +0100 | |
commit | 8718a44f82a3aaf6dd1b445545ce6568e24bd5df (patch) | |
tree | 642a733a7aaa70d3788be0cd0f7b47fb106b52c5 /paludis/dep_spec.cc | |
parent | eb258b636721206a11f6783612c78ac026fc3d2f (diff) | |
download | paludis-8718a44f82a3aaf6dd1b445545ce6568e24bd5df.tar.gz paludis-8718a44f82a3aaf6dd1b445545ce6568e24bd5df.tar.xz |
Refactor to make later changes easier
Diffstat (limited to 'paludis/dep_spec.cc')
-rw-r--r-- | paludis/dep_spec.cc | 81 |
1 files changed, 55 insertions, 26 deletions
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc index 7b221f3c2..1943e58ff 100644 --- a/paludis/dep_spec.cc +++ b/paludis/dep_spec.cc @@ -183,14 +183,7 @@ ConditionalDepSpec::_as_string() const return _imp->data->as_string(); } -std::string -StringDepSpec::text() const -{ - return _str; -} - NamedSetDepSpec::NamedSetDepSpec(const SetName & n) : - StringDepSpec(stringify(n)), _name(n) { } @@ -201,6 +194,12 @@ NamedSetDepSpec::name() const return _name; } +const std::string +NamedSetDepSpec::text() const +{ + return stringify(_name); +} + std::shared_ptr<DepSpec> NamedSetDepSpec::clone() const { @@ -210,18 +209,24 @@ NamedSetDepSpec::clone() const } BlockDepSpec::BlockDepSpec(const std::string & s, const PackageDepSpec & p) : - StringDepSpec(s), + _text(s), _spec(p) { } BlockDepSpec::BlockDepSpec(const BlockDepSpec & other) : - StringDepSpec(other.text()), + _text(other._text), _spec(other._spec) { set_annotations(other.maybe_annotations()); } +const std::string +BlockDepSpec::text() const +{ + return _text; +} + std::ostream & paludis::operator<< (std::ostream & s, const PlainTextDepSpec & a) { @@ -308,18 +313,8 @@ PackageDepSpecError::PackageDepSpecError(const std::string & msg) throw () : { } -StringDepSpec::StringDepSpec(const std::string & s) : - _str(s) -{ -} - -StringDepSpec::~StringDepSpec() -{ -} - - PlainTextDepSpec::PlainTextDepSpec(const std::string & s) : - StringDepSpec(s) + _text(s) { } @@ -331,8 +326,14 @@ PlainTextDepSpec::clone() const return result; } +const std::string +PlainTextDepSpec::text() const +{ + return _text; +} + PlainTextLabelDepSpec::PlainTextLabelDepSpec(const std::string & s) : - StringDepSpec(s) + _text(s) { } @@ -349,13 +350,19 @@ PlainTextLabelDepSpec::clone() const } const std::string +PlainTextLabelDepSpec::text() const +{ + return _text; +} + +const std::string PlainTextLabelDepSpec::label() const { return text().substr(0, text().length() - 1); } LicenseDepSpec::LicenseDepSpec(const std::string & s) : - StringDepSpec(s) + _text(s) { } @@ -367,8 +374,14 @@ LicenseDepSpec::clone() const return result; } +const std::string +LicenseDepSpec::text() const +{ + return _text; +} + SimpleURIDepSpec::SimpleURIDepSpec(const std::string & s) : - StringDepSpec(s) + _text(s) { } @@ -380,6 +393,12 @@ SimpleURIDepSpec::clone() const return result; } +const std::string +SimpleURIDepSpec::text() const +{ + return _text; +} + const PackageDepSpec BlockDepSpec::blocking() const { @@ -395,7 +414,7 @@ BlockDepSpec::clone() const } FetchableURIDepSpec::FetchableURIDepSpec(const std::string & s) : - StringDepSpec(s) + _text(s) { } @@ -442,6 +461,12 @@ FetchableURIDepSpec::clone() const return result; } +const std::string +FetchableURIDepSpec::text() const +{ + return _text; +} + namespace paludis { template <typename T_> @@ -522,7 +547,6 @@ namespace paludis PackageDepSpec::PackageDepSpec(const std::shared_ptr<const PackageDepSpecData> & d) : Cloneable<DepSpec>(), - StringDepSpec(d->as_string()), _imp(d) { } @@ -533,13 +557,18 @@ PackageDepSpec::~PackageDepSpec() PackageDepSpec::PackageDepSpec(const PackageDepSpec & d) : Cloneable<DepSpec>(d), - StringDepSpec(d._imp->data->as_string()), CloneUsingThis<DepSpec, PackageDepSpec>(d), _imp(d._imp->data) { set_annotations(d.maybe_annotations()); } +const std::string +PackageDepSpec::text() const +{ + return _imp->data->as_string(); +} + const std::shared_ptr<const NameRequirement> PackageDepSpec::package_name_requirement() const { |