summaryrefslogtreecommitdiff
path: root/apt-pkg/edsp/edsplistparser.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-06-05 13:05:30 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-06-05 13:15:55 +0200
commitd59671c9eef322c10abba22b0257fef37979dfd4 (patch)
tree5bfa714f18136ca6bd7a488e2dcecae14a1f26c1 /apt-pkg/edsp/edsplistparser.cc
parent382704d532b9a02237fe5706592858bbffec3862 (diff)
refactor EDSP classes for better internal reuse
The classes are all marked as hidden, so changing them is no problem ABI wise and will help with introducing protocols similar to EDSP. The change has no observeable behavior difference, its just code juggling. Git-Dch: Ignore
Diffstat (limited to 'apt-pkg/edsp/edsplistparser.cc')
-rw-r--r--apt-pkg/edsp/edsplistparser.cc66
1 files changed, 27 insertions, 39 deletions
diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc
index f35000e0e..39a6e8a6e 100644
--- a/apt-pkg/edsp/edsplistparser.cc
+++ b/apt-pkg/edsp/edsplistparser.cc
@@ -23,30 +23,22 @@
/*}}}*/
-class edspListParserPrivate /*{{{*/
-{
-public:
- FileFd extendedstates;
- FileFd preferences;
-
- edspListParserPrivate()
- {
- std::string const states = _config->FindFile("Dir::State::extended_states");
- RemoveFile("edspListParserPrivate", states);
- extendedstates.Open(states, FileFd::WriteOnly | FileFd::Create | FileFd::Exclusive, 0600);
- std::string const prefs = _config->FindFile("Dir::Etc::preferences");
- RemoveFile("edspListParserPrivate", prefs);
- preferences.Open(prefs, FileFd::WriteOnly | FileFd::Create | FileFd::Exclusive, 0600);
- }
-};
- /*}}}*/
// ListParser::edspListParser - Constructor /*{{{*/
-edspListParser::edspListParser(FileFd *File) : debListParser(File), d(new edspListParserPrivate())
+edspLikeListParser::edspLikeListParser(FileFd * const File) : debListParser(File)
+{
+}
+edspListParser::edspListParser(FileFd * const File) : edspLikeListParser(File)
{
+ std::string const states = _config->FindFile("Dir::State::extended_states");
+ RemoveFile("edspListParserPrivate", states);
+ extendedstates.Open(states, FileFd::WriteOnly | FileFd::Create | FileFd::Exclusive, 0600);
+ std::string const prefs = _config->FindFile("Dir::Etc::preferences");
+ RemoveFile("edspListParserPrivate", prefs);
+ preferences.Open(prefs, FileFd::WriteOnly | FileFd::Create | FileFd::Exclusive, 0600);
}
/*}}}*/
// ListParser::NewVersion - Fill in the version structure /*{{{*/
-bool edspListParser::NewVersion(pkgCache::VerIterator &Ver)
+bool edspLikeListParser::NewVersion(pkgCache::VerIterator &Ver)
{
_system->SetVersionMapping(Ver->ID, Section.FindI("APT-ID", Ver->ID));
return debListParser::NewVersion(Ver);
@@ -55,19 +47,17 @@ bool edspListParser::NewVersion(pkgCache::VerIterator &Ver)
// ListParser::Description - Return the description string /*{{{*/
// ---------------------------------------------------------------------
/* Sorry, no description for the resolvers… */
-std::vector<std::string> edspListParser::AvailableDescriptionLanguages()
+std::vector<std::string> edspLikeListParser::AvailableDescriptionLanguages()
{
return {};
}
-MD5SumValue edspListParser::Description_md5()
+MD5SumValue edspLikeListParser::Description_md5()
{
return MD5SumValue("");
}
/*}}}*/
// ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-unsigned short edspListParser::VersionHash()
+unsigned short edspLikeListParser::VersionHash()
{
if (Section.Exists("APT-Hash") == true)
return Section.FindI("APT-Hash");
@@ -76,6 +66,13 @@ unsigned short edspListParser::VersionHash()
return 0;
}
/*}}}*/
+// ListParser::LoadReleaseInfo - Load the release information /*{{{*/
+APT_CONST bool edspLikeListParser::LoadReleaseInfo(pkgCache::RlsFileIterator & /*FileI*/,
+ FileFd & /*File*/, std::string const &/*component*/)
+{
+ return true;
+}
+ /*}}}*/
// ListParser::ParseStatus - Parse the status field /*{{{*/
// ---------------------------------------------------------------------
/* The Status: line here is not a normal dpkg one but just one which tells
@@ -102,7 +99,7 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
{
std::string out;
strprintf(out, "Package: %s\nArchitecture: %s\nAuto-Installed: 1\n\n", Pkg.Name(), Pkg.Arch());
- if (d->extendedstates.Write(out.c_str(), out.length()) == false)
+ if (extendedstates.Write(out.c_str(), out.length()) == false)
return false;
}
@@ -111,7 +108,7 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
{
std::string out;
strprintf(out, "Package: %s\nPin: version %s\nPin-Priority: 9999\n\n", Pkg.FullName().c_str(), Ver.VerStr());
- if (d->preferences.Write(out.c_str(), out.length()) == false)
+ if (preferences.Write(out.c_str(), out.length()) == false)
return false;
}
@@ -120,22 +117,13 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
{
std::string out;
strprintf(out, "Package: %s\nPin: version %s\nPin-Priority: %d\n\n", Pkg.FullName().c_str(), Ver.VerStr(), pinvalue);
- if (d->preferences.Write(out.c_str(), out.length()) == false)
+ if (preferences.Write(out.c_str(), out.length()) == false)
return false;
}
return true;
}
/*}}}*/
-// ListParser::LoadReleaseInfo - Load the release information /*{{{*/
-APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::RlsFileIterator & /*FileI*/,
- FileFd & /*File*/, std::string const &/*component*/)
-{
- return true;
-}
- /*}}}*/
-edspListParser::~edspListParser() /*{{{*/
-{
- delete d;
-}
- /*}}}*/
+
+edspLikeListParser::~edspLikeListParser() {}
+edspListParser::~edspListParser() {}