MiKTeX 23.10-next
A scalable TeX distribution
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
MiKTeX::Packages::internal::PackageDataStore Class Reference

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...
 
PackageDataStoreLoad ()
 
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::PackageInfoTryGetPackage (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...
 

Detailed Description

An instance of this class collects package records.

The record data is retrieved from two sources:

Member Function Documentation

◆ begin()

PackageDataStore::iterator PackageDataStore::begin ( )

Gets an iterator to the first record.

Returns
iterator

◆ Clear()

void PackageDataStore::Clear ( )

Clears the contents of the data store.

◆ DeclareObsolete()

void PackageDataStore::DeclareObsolete ( const std::string &  packageId)

Declares a package as obsolete.

Parameters
packageIdThe package ID.

◆ DecrementFileRefCount()

unsigned long PackageDataStore::DecrementFileRefCount ( const MiKTeX::Util::PathName path)

Decrements the reference count of an installed file.

Parameters
pathThe path to the file.
Returns
Returns the new (decremented) reference count.

◆ DefinePackage()

void PackageDataStore::DefinePackage ( const MiKTeX::Packages::PackageInfo packageinfo)

Adds a record to the data store.

Parameters
packageInfoThe record to be added.

◆ end()

PackageDataStore::iterator PackageDataStore::end ( )

Gets an iterator referring to the past-the-end record.

Returns
iterator

◆ GetFileRefCount()

unsigned long PackageDataStore::GetFileRefCount ( const MiKTeX::Util::PathName path)

Gets the reference count of a file.

Parameters
pathThe path to the file.
Returns
Returns reference count of the file.

◆ GetNumberOfInstalledPackages()

size_t PackageDataStore::GetNumberOfInstalledPackages ( bool  userScope)

Gets the number of installed packages.

Parameters
commonIndicates whether to retrieve the number of packages for the current user.
Returns
Returns the number of installed packages.

◆ GetPackage()

MiKTeX::Packages::PackageInfo MiKTeX::Packages::internal::PackageDataStore::GetPackage ( const std::string &  packageId)
inline

Retrieves a record from the data store.

Exceptions
std::exceptionRecord not found.
Parameters
packageIdThe package ID.
Returns
Returns the requested record.

◆ IncrementFileRefCounts()

void MiKTeX::Packages::internal::PackageDataStore::IncrementFileRefCounts ( const std::string &  packageId)

Increments the reference counts of all files in a package.

Parameters
pathThe package ID.

◆ LoadAllPackageManifests()

void PackageDataStore::LoadAllPackageManifests ( const MiKTeX::Util::PathName path,
bool  mustBeSigned 
)

Loads package records into the data store.

This method loads

  • mutable data from a given INI file
  • immutable package data from miktex/config/packages.ini

In addition, package dependencies and file reference counts are calculated.

Parameters
pathPath to the INI file.

◆ NeedPackageManifestsIni()

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.

◆ SaveVarData()

void PackageDataStore::SaveVarData ( )

Saves mutable package data.

◆ SetPackage()

void MiKTeX::Packages::internal::PackageDataStore::SetPackage ( const MiKTeX::Packages::PackageInfo packageInfo)
inline

Updates a record in the data store.

Parameters
packageInfoThe record to update.

◆ SetReleaseState()

void PackageDataStore::SetReleaseState ( const std::string &  packageId,
MiKTeX::Packages::RepositoryReleaseState  releaseState 
)

Sets the release state of an installed package.

Parameters
packageIdThe package ID.
releaseStateThe release state.

◆ SetTimeInstalled()

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).

Parameters
packageIdThe package ID.
timeInstalledThe installation timestamp.

◆ TryGetPackage()

tuple< bool, PackageInfo > PackageDataStore::TryGetPackage ( const std::string &  packageId)

Tries to retrieve a record from the data store.

Parameters
packageIdThe package ID.
Returns
The first return value indicates whether the record (second return value) could be retrieved.

The documentation for this class was generated from the following files: