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

The package manager interface. More...

#include <miktex/PackageManager/PackageManager.h>

Inheritance diagram for MiKTeX::Packages::PackageManager:
Inheritance graph
[legend]

Classes

struct  InitInfo
 Initialization options. More...
 

Public Member Functions

virtual std::unique_ptr< class PackageInstallerCreateInstaller (const PackageInstaller::InitInfo &initInfo)=0
 
virtual std::unique_ptr< class PackageInstallerCreateInstaller ()=0
 
virtual std::unique_ptr< class PackageIteratorCreateIterator ()=0
 Creates a new package iterator object. More...
 
virtual void CreateMpmFndb ()=0
 Recreates the file name database of the package manager. More...
 
virtual PackageInfo GetPackageInfo (const std::string &packageId)=0
 
virtual void LoadDatabase (const MiKTeX::Util::PathName &path, bool isArchive)=0
 
virtual void UnloadDatabase ()=0
 Unloads the package database. More...
 
virtual RepositoryReleaseState GetRepositoryReleaseState ()=0
 
virtual void SetRepositoryReleaseState (RepositoryReleaseState repositoryReleaseState)=0
 
virtual void DownloadRepositoryList ()=0
 Downloads the repositiry list from the server. More...
 
virtual std::vector< RepositoryInfoGetRepositories ()=0
 
virtual std::string PickRepositoryUrl ()=0
 
virtual bool TryGetPackageInfo (const std::string &packageId, PackageInfo &packageInfo)=0
 
virtual bool TryGetRepositoryInfo (const std::string &url, RepositoryInfo &repositoryInfo)=0
 
virtual RepositoryInfo CheckPackageRepository (const std::string &url)=0
 
virtual RepositoryInfo VerifyPackageRepository (const std::string &url)=0
 
virtual bool TryVerifyInstalledPackage (const std::string &packageId)=0
 Verifies an installed package. More...
 
virtual std::string GetContainerPath (const std::string &packageId, bool useDisplayNames)=0
 
virtual InstallationSummary GetInstallationSummary (bool userScope)=0
 

Static Public Member Functions

static std::shared_ptr< PackageManagerCreate (const InitInfo &initInfo)
 
static std::shared_ptr< PackageManagerCreate ()
 
static std::string GetRemotePackageRepository (RepositoryReleaseState &repositoryReleaseState)
 
static std::string GetRemotePackageRepository ()
 
static bool TryGetRemotePackageRepository (std::string &url, RepositoryReleaseState &repositoryReleaseState)
 
static bool TryGetRemotePackageRepository (std::string &url)
 
static MiKTeX::Util::PathName GetLocalPackageRepository ()
 
static bool TryGetLocalPackageRepository (MiKTeX::Util::PathName &path)
 
static MiKTeX::Util::PathName GetMiKTeXDirectRoot ()
 
static bool TryGetMiKTeXDirectRoot (MiKTeX::Util::PathName &path)
 
static RepositoryInfo GetDefaultPackageRepository ()
 
static bool TryGetDefaultPackageRepository (RepositoryType &repositoryType, RepositoryReleaseState &repositoryReleaseState, std::string &urlOrPath)
 
static bool TryGetDefaultPackageRepository (RepositoryType &repositoryType, std::string &urlOrPath)
 
static void SetDefaultPackageRepository (const RepositoryInfo &repository)
 
static void SetDefaultPackageRepository (RepositoryType repositoryType, RepositoryReleaseState repositoryReleaseState, const std::string &urlOrPath)
 
static void SetDefaultPackageRepository (RepositoryType repositoryType, const std::string &urlOrPath)
 
static bool IsLocalPackageRepository (const MiKTeX::Util::PathName &path)
 
static void SetRemotePackageRepository (const std::string &url, RepositoryReleaseState repositoryReleaseState)
 
static void SetRemotePackageRepository (const std::string &url)
 
static void SetLocalPackageRepository (const MiKTeX::Util::PathName &path)
 
static void SetMiKTeXDirectRoot (const MiKTeX::Util::PathName &path)
 
static PackageInfo ReadPackageManifestFile (const MiKTeX::Util::PathName &path, const std::string &texmfPrefix)
 
static void WritePackageManifestFile (const MiKTeX::Util::PathName &path, const PackageInfo &packageInfo, std::time_t timePackaged)
 
static void PutPackageManifest (MiKTeX::Core::Cfg &cfg, const PackageInfo &packageInfo, std::time_t timePackaged)
 
static PackageInfo GetPackageManifest (const MiKTeX::Core::Cfg &cfg, const std::string &packageId, const std::string &texmfPrefix)
 
static bool StripTeXMFPrefix (const std::string &str, std::string &result)
 
static bool TryGetProxy (const std::string &url, ProxySettings &proxySettings)
 
static bool TryGetProxy (ProxySettings &proxySettings)
 
static void SetProxy (const ProxySettings &proxySettings)
 

Detailed Description

The package manager interface.

Member Function Documentation

◆ CheckPackageRepository()

virtual RepositoryInfo MiKTeX::Packages::PackageManager::CheckPackageRepository ( const std::string &  url)
pure virtual

Checks a remote package repository.

Parameters
urlIdentifies the remote package repository.
[out]repositoryInfoInformation about the remote package repository.
Returns
Returns true, if the package repository is usable.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ Create() [1/2]

static std::shared_ptr< PackageManager > MiKTeX::Packages::PackageManager::Create ( )
inlinestatic

Creates a new package manager object.

Returns
Returns a smart pointer to the new package manager object.

◆ Create() [2/2]

shared_ptr< PackageManager > PackageManager::Create ( const InitInfo initInfo)
static

Creates a new package manager object.

Parameters
initInfoInitialization options.
Returns
Returns a smart pointer to the new package manager object.

◆ CreateInstaller() [1/2]

virtual std::unique_ptr< class PackageInstaller > MiKTeX::Packages::PackageManager::CreateInstaller ( )
pure virtual

Creates a new package installer object.

Returns
Returns a smart pointer to the new package installer object.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ CreateInstaller() [2/2]

virtual std::unique_ptr< class PackageInstaller > MiKTeX::Packages::PackageManager::CreateInstaller ( const PackageInstaller::InitInfo initInfo)
pure virtual

Creates a new package installer object.

Parameters
initInfoInitialization options.
Returns
Returns a smart pointer to the new package installer object.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ CreateIterator()

virtual std::unique_ptr< class PackageIterator > MiKTeX::Packages::PackageManager::CreateIterator ( )
pure virtual

Creates a new package iterator object.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ CreateMpmFndb()

virtual void MiKTeX::Packages::PackageManager::CreateMpmFndb ( )
pure virtual

Recreates the file name database of the package manager.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ DownloadRepositoryList()

virtual void MiKTeX::Packages::PackageManager::DownloadRepositoryList ( )
pure virtual

Downloads the repositiry list from the server.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ GetContainerPath()

virtual std::string MiKTeX::Packages::PackageManager::GetContainerPath ( const std::string &  packageId,
bool  useDisplayNames 
)
pure virtual

Builds the container path of a package.

Parameters
packageIdIdentifies the package.
useDisplayNamesIndicates whether to use user friendly names.
Returns
Returns the container path of the package.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ GetDefaultPackageRepository()

RepositoryInfo PackageManager::GetDefaultPackageRepository ( )
static

Gets the configured package repository.

Returns
Returns the configured package repository.
See also
SetDefaultPackageRepository

◆ GetInstallationSummary()

virtual InstallationSummary MiKTeX::Packages::PackageManager::GetInstallationSummary ( bool  userScope)
pure virtual

Gets the installation summary.

Parameters
commonIndicates whether to retrieve a summary for the current user.
Returns
Returns the installation summary.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ GetLocalPackageRepository()

PathName PackageManager::GetLocalPackageRepository ( )
static

Gets the configured local package repository.

Returns
Returns the path to the local package repository.
Exceptions
MiKTeXExceptionNo local package repository is configured.
See also
SetLocalPackageRepository

◆ GetMiKTeXDirectRoot()

PathName PackageManager::GetMiKTeXDirectRoot ( )
static

GetMiKTeXDirectRoot

Todo:
internal

◆ GetPackageInfo()

virtual PackageInfo MiKTeX::Packages::PackageManager::GetPackageInfo ( const std::string &  packageId)
pure virtual

Gets information about a specified package.

Parameters
packageIdPackage key.
Returns
Returns the package record.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ GetPackageManifest()

PackageInfo PackageManager::GetPackageManifest ( const MiKTeX::Core::Cfg cfg,
const std::string &  packageId,
const std::string &  texmfPrefix 
)
static

Loads a package manifest from a Cfg container.

Parameters
cfgThe Cfg instance.
packageIdIdentifies the package manifest.
texmfPrefixThe TEXMF prefix to be stripped from file names.
Returns
Returns the package manifest.

◆ GetRemotePackageRepository() [1/2]

static std::string MiKTeX::Packages::PackageManager::GetRemotePackageRepository ( )
inlinestatic

Gets the configured remote package repository.

Parameters
[out]repositoryReleaseStateThe release state of the package repository.
Returns
Returns the URL of the remote package repository.
Exceptions
MiKTeXExceptionNo remote package repository is configured.
See also
SetRemotePackageRepository

◆ GetRemotePackageRepository() [2/2]

string PackageManager::GetRemotePackageRepository ( RepositoryReleaseState repositoryReleaseState)
static

Gets the configured remote package repository.

Parameters
[out]repositoryReleaseStateThe release state of the package repository.
Returns
Returns the URL of the remote package repository.
Exceptions
MiKTeXExceptionNo remote package repository is configured.
See also
SetRemotePackageRepository

◆ GetRepositories()

virtual std::vector< RepositoryInfo > MiKTeX::Packages::PackageManager::GetRepositories ( )
pure virtual

Gets the downloaded repoistory list.

Returns
Returns the repository list.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ GetRepositoryReleaseState()

virtual RepositoryReleaseState MiKTeX::Packages::PackageManager::GetRepositoryReleaseState ( )
pure virtual

Gets the release state of the current package repository.

Returns
Returns the release state.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ IsLocalPackageRepository()

bool PackageManager::IsLocalPackageRepository ( const MiKTeX::Util::PathName path)
static

Tests a local package repository.

Parameters
pathPath to the local package repository.
Returns
Returns true, if this is a local package repository.

◆ LoadDatabase()

virtual void MiKTeX::Packages::PackageManager::LoadDatabase ( const MiKTeX::Util::PathName path,
bool  isArchive 
)
pure virtual

Loads the package database.

Parameters
Pathto the package database.
isArchiveIndicates whether this is an archive file or an INI file.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ PickRepositoryUrl()

virtual std::string MiKTeX::Packages::PackageManager::PickRepositoryUrl ( )
pure virtual

Picks a random package repository.

Returns
Returns the URL of a package repository.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ PutPackageManifest()

void PackageManager::PutPackageManifest ( MiKTeX::Core::Cfg cfg,
const PackageInfo packageInfo,
std::time_t  timePackaged 
)
static

Adds (updates) a package manifest to (in) a Cfg container.

Parameters
cfgThe Cfg instance to modify.
packageInfoThe package manifest.
timePackagedThe packaging timestamp.

◆ ReadPackageManifestFile()

PackageInfo PackageManager::ReadPackageManifestFile ( const MiKTeX::Util::PathName path,
const std::string &  texmfPrefix 
)
static

Loads a package manifest from an INI file.

Parameters
pathThe path to the INI file.
texmfPrefixThe TEXMF prefix to be stripped from file names.
Returns
Returns the parsed package manifest.

◆ SetDefaultPackageRepository() [1/3]

void PackageManager::SetDefaultPackageRepository ( const RepositoryInfo repository)
static

Configures the default package repository.

Parameters
repositoryThe new default package repository.
See also
GetDefaultPackageRepository

◆ SetDefaultPackageRepository() [2/3]

static void MiKTeX::Packages::PackageManager::SetDefaultPackageRepository ( RepositoryType  repositoryType,
const std::string &  urlOrPath 
)
inlinestatic

Configures the default package repository.

Parameters
repositoryThe repository type.
urlOrPathThe path to (URL of) the default package repository.
See also
GetDefaultPackageRepository

◆ SetDefaultPackageRepository() [3/3]

void PackageManager::SetDefaultPackageRepository ( RepositoryType  repositoryType,
RepositoryReleaseState  repositoryReleaseState,
const std::string &  urlOrPath 
)
static

Configures the default package repository.

Parameters
repositoryThe repository type.
repositoryReleaseStateThe repository release state.
urlOrPathThe path to (URL of) the default package repository.
See also
GetDefaultPackageRepository

◆ SetLocalPackageRepository()

void PackageManager::SetLocalPackageRepository ( const MiKTeX::Util::PathName path)
static

Configures the local package repository.

Parameters
pathPath to the local package repository.
See also
GetLocalPackageRepository

◆ SetMiKTeXDirectRoot()

void PackageManager::SetMiKTeXDirectRoot ( const MiKTeX::Util::PathName path)
static

SetMiKTeXDirectRoot

Todo:
internal

◆ SetProxy()

void PackageManager::SetProxy ( const ProxySettings proxySettings)
static

Configures a proxy server.

Parameters
proxySettingsThe proxy settings.

◆ SetRemotePackageRepository() [1/2]

static void MiKTeX::Packages::PackageManager::SetRemotePackageRepository ( const std::string &  url)
inlinestatic

Configures the remote package repository.

Parameters
urlIdentifies the remote package repository.
See also
GetRemotePackageRepository

◆ SetRemotePackageRepository() [2/2]

void PackageManager::SetRemotePackageRepository ( const std::string &  url,
RepositoryReleaseState  repositoryReleaseState 
)
static

Configures the remote package repository.

Parameters
urlIdentifies the remote package repository.
repositoryReleaseStateThe release state of the package repository.
See also
GetRemotePackageRepository

◆ SetRepositoryReleaseState()

virtual void MiKTeX::Packages::PackageManager::SetRepositoryReleaseState ( RepositoryReleaseState  repositoryReleaseState)
pure virtual

Sets the release state of the current package repository.

Parameters
repositoryReleaseStateThe release state to set.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ StripTeXMFPrefix()

bool PackageManager::StripTeXMFPrefix ( const std::string &  str,
std::string &  result 
)
static

Strips the TEXMF prefix from a string.

Parameters
strThe string to be stripped.
[out]resultThe result to be filled with the stripped string.
Returns
Returns true, if the prefix was stripped.

◆ TryGetDefaultPackageRepository() [1/2]

bool PackageManager::TryGetDefaultPackageRepository ( RepositoryType repositoryType,
RepositoryReleaseState repositoryReleaseState,
std::string &  urlOrPath 
)
static

Gets the configured package repository.

Parameters
[out]repositoryThe repository type.
[out]repositoryReleaseStateThe repository release state.
[out]urlOrPathThe configured package repository.
Returns
Returns true.
See also
SetDefaultPackageRepository

◆ TryGetDefaultPackageRepository() [2/2]

static bool MiKTeX::Packages::PackageManager::TryGetDefaultPackageRepository ( RepositoryType repositoryType,
std::string &  urlOrPath 
)
inlinestatic

Gets the configured package repository.

Parameters
[out]repositoryThe repository type.
[out]urlOrPathThe configured package repository.
Returns
Returns true.
See also
SetDefaultPackageRepository

◆ TryGetLocalPackageRepository()

bool PackageManager::TryGetLocalPackageRepository ( MiKTeX::Util::PathName path)
static

Gets the configured local package repository.

Parameters
[out]pathThe path to the local package repository.
Returns
Returns false, if the local package repository is not configured.
See also
SetLocalPackageRepository

◆ TryGetMiKTeXDirectRoot()

bool PackageManager::TryGetMiKTeXDirectRoot ( MiKTeX::Util::PathName path)
static

TryGetMiKTeXDirectRoot

Todo:
internal

◆ TryGetPackageInfo()

virtual bool MiKTeX::Packages::PackageManager::TryGetPackageInfo ( const std::string &  packageId,
PackageInfo packageInfo 
)
pure virtual

Tries to get a record from the package database.

Parameters
urlIdentifies the package.
[out]packageInfoThe loaded record.
Returns
Returns true, if the record could be retrieved.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ TryGetProxy() [1/2]

bool PackageManager::TryGetProxy ( const std::string &  url,
ProxySettings proxySettings 
)
static

Gets the configured proxy server.

Parameters
urlIdentifies the scheme the proxy must support.
[out]proxySettingsThe proxy settings.
Returns
Returns true, if the proxy server is configured.
See also
SetProxy

◆ TryGetProxy() [2/2]

bool PackageManager::TryGetProxy ( ProxySettings proxySettings)
static

Gets the configured proxy server.

Parameters
[out]proxySettingsThe proxy settings.
Returns
Returns true, if the proxy server is configured.
See also
SetProxy

◆ TryGetRemotePackageRepository() [1/2]

static bool MiKTeX::Packages::PackageManager::TryGetRemotePackageRepository ( std::string &  url)
inlinestatic

Gets the configured remote package repository.

Parameters
[out]urlThe URL of the remote package repository.
Returns
Returns false, if the remote package repository is not configured.
See also
SetRemotePackageRepository

◆ TryGetRemotePackageRepository() [2/2]

bool PackageManager::TryGetRemotePackageRepository ( std::string &  url,
RepositoryReleaseState repositoryReleaseState 
)
static

Gets the configured remote package repository.

Parameters
[out]urlThe URL of the remote package repository.
[out]repositoryReleaseStateThe release state of the package repository.
Returns
Returns false, if the remote package repository is not configured.
See also
SetRemotePackageRepository

◆ TryGetRepositoryInfo()

virtual bool MiKTeX::Packages::PackageManager::TryGetRepositoryInfo ( const std::string &  url,
RepositoryInfo repositoryInfo 
)
pure virtual

Tries to get a record from the repository data store.

Parameters
urlIdentifies the remote package repository.
[out]repositoryInfoThe loaded record.
Returns
Returns true, if the record could be retrieved.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ TryVerifyInstalledPackage()

virtual bool MiKTeX::Packages::PackageManager::TryVerifyInstalledPackage ( const std::string &  packageId)
pure virtual

Verifies an installed package.

This method reads all files in order to verify the integrity of the package.

Parameters
packageIdIdentifies the package.
Returns
Returns true, if the package is correctly installed.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ UnloadDatabase()

virtual void MiKTeX::Packages::PackageManager::UnloadDatabase ( )
pure virtual

Unloads the package database.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ VerifyPackageRepository()

virtual RepositoryInfo MiKTeX::Packages::PackageManager::VerifyPackageRepository ( const std::string &  url)
pure virtual

Lets the server verify a remote package repository.

Parameters
urlIdentifies the repository to verify.
Returns
repositoryInfo Returns the repository record returned by the server.
Exceptions
MiKTeXExceptionThe repository is not valid.

Implemented in MiKTeX::Packages::internal::PackageManagerImpl.

◆ WritePackageManifestFile()

void PackageManager::WritePackageManifestFile ( const MiKTeX::Util::PathName path,
const PackageInfo packageInfo,
std::time_t  timePackaged 
)
static

Writes a package manifest into an INI file.

Parameters
pathThe path to the INI file.
packageInfoThe package manifest.
timePackagedThe packaging timestamp.

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