MiKTeX 23.10-next
A scalable TeX distribution
|
An instance of this class collects package records. More...
#include <PackageDataStore.h>
Classes | |
class | iterator |
Public Member Functions | |
void | Clear () |
Clears the contents of the data store. More... | |
void | DeclareObsolete (const std::string &packageId) |
unsigned long | DecrementFileRefCount (const MiKTeX::Util::PathName &path) |
void | DefinePackage (const MiKTeX::Packages::PackageInfo &packageinfo) |
std::size_t | GetNumberOfInstalledPackages (bool userScope) |
unsigned long | GetFileRefCount (const MiKTeX::Util::PathName &path) |
MiKTeX::Packages::PackageInfo | GetPackage (const std::string &packageId) |
void | IncrementFileRefCounts (const std::string &packageId) |
void | LoadAllPackageManifests (const MiKTeX::Util::PathName &path, bool mustBeSigned) |
Loads package records into the data store. More... | |
PackageDataStore & | Load () |
bool | LoadedAllPackageManifests () const |
void | NeedPackageManifestsIni () |
void | SaveVarData () |
Saves mutable package data. More... | |
void | SetPackage (const MiKTeX::Packages::PackageInfo &packageInfo) |
void | SetReleaseState (const std::string &packageId, MiKTeX::Packages::RepositoryReleaseState releaseState) |
void | SetTimeInstalled (const std::string &packageId, std::time_t timeInstalled) |
Sets the package installation timestamp. More... | |
std::tuple< bool, MiKTeX::Packages::PackageInfo > | TryGetPackage (const std::string &packageId) |
iterator | begin () |
Gets an iterator to the first record. More... | |
iterator | end () |
Gets an iterator referring to the past-the-end record. More... | |
An instance of this class collects package records.
The record data is retrieved from two sources:
miktex/config/package-manifests.ini
: immutable package manifestsmiktex/config/packages.ini
: mutable package data such as installation timestamps PackageDataStore::iterator PackageDataStore::begin | ( | ) |
Gets an iterator to the first record.
void PackageDataStore::Clear | ( | ) |
Clears the contents of the data store.
void PackageDataStore::DeclareObsolete | ( | const std::string & | packageId | ) |
Declares a package as obsolete.
packageId | The package ID. |
unsigned long PackageDataStore::DecrementFileRefCount | ( | const MiKTeX::Util::PathName & | path | ) |
Decrements the reference count of an installed file.
path | The path to the file. |
void PackageDataStore::DefinePackage | ( | const MiKTeX::Packages::PackageInfo & | packageinfo | ) |
Adds a record to the data store.
packageInfo | The record to be added. |
PackageDataStore::iterator PackageDataStore::end | ( | ) |
Gets an iterator referring to the past-the-end record.
unsigned long PackageDataStore::GetFileRefCount | ( | const MiKTeX::Util::PathName & | path | ) |
Gets the reference count of a file.
path | The path to the file. |
size_t PackageDataStore::GetNumberOfInstalledPackages | ( | bool | userScope | ) |
Gets the number of installed packages.
common | Indicates whether to retrieve the number of packages for the current user. |
|
inline |
Retrieves a record from the data store.
std::exception | Record not found. |
packageId | The package ID. |
void MiKTeX::Packages::internal::PackageDataStore::IncrementFileRefCounts | ( | const std::string & | packageId | ) |
Increments the reference counts of all files in a package.
path | The package ID. |
void PackageDataStore::LoadAllPackageManifests | ( | const MiKTeX::Util::PathName & | path, |
bool | mustBeSigned | ||
) |
Loads package records into the data store.
This method loads
miktex/config/packages.ini
In addition, package dependencies and file reference counts are calculated.
path | Path to the INI file. |
void PackageDataStore::NeedPackageManifestsIni | ( | ) |
Migrates TPM files into a single INI file.
If the INI file miktex/config/package-manifests.ini
does not yet exists, it will be created by parsing all TPM files. This method can be used to migrate an old (pre 2019) package database into the new format.
void PackageDataStore::SaveVarData | ( | ) |
Saves mutable package data.
|
inline |
Updates a record in the data store.
packageInfo | The record to update. |
void PackageDataStore::SetReleaseState | ( | const std::string & | packageId, |
MiKTeX::Packages::RepositoryReleaseState | releaseState | ||
) |
Sets the release state of an installed package.
packageId | The package ID. |
releaseState | The release state. |
void PackageDataStore::SetTimeInstalled | ( | const std::string & | packageId, |
std::time_t | timeInstalled | ||
) |
Sets the package installation timestamp.
If the timestamp is zero (InvalidTimeT
), the mutable package data will cleared (the package is not installed).
packageId | The package ID. |
timeInstalled | The installation timestamp. |
tuple< bool, PackageInfo > PackageDataStore::TryGetPackage | ( | const std::string & | packageId | ) |
Tries to retrieve a record from the data store.
packageId | The package ID. |