MiKTeX 26.5-next
A scalable TeX distribution
Loading...
Searching...
No Matches
PackageRepositoryDataStore.h
1/* PackageRepositoryDataStore.h: -*- C++ -*-
2
3 Copyright (C) 2019 Christian Schenk
4
5 This file is part of MiKTeX Package Manager.
6
7 MiKTeX Package Manager is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2, or
10 (at your option) any later version.
11
12 MiKTeX Package Manager is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with MiKTeX Package Manager; if not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22#pragma once
23
24#if !defined(DBD8ED6A4EAB41A49E187B7912407D4D)
25#define DBD8ED6A4EAB41A49E187B7912407D4D
26
27#include <memory>
28#include <string>
29#include <vector>
30
31#include <miktex/Core/Session>
32
33#include <miktex/PackageManager/PackageManager>
34
35#include "ComboCfg.h"
36#include "WebSession.h"
37
38MPM_INTERNAL_BEGIN_NAMESPACE;
39
40class PackageRepositoryDataStore
41{
42public:
43 PackageRepositoryDataStore(std::shared_ptr<WebSession> webSession);
44
45public:
46 void Download();
47
48public:
49 std::vector<MiKTeX::Packages::RepositoryInfo> GetRepositories() const
50 {
51 return repositories;
52 }
53
54public:
55 std::string PickRepositoryUrl();
56
57public:
58 MiKTeX::Packages::RepositoryInfo CheckPackageRepository(const std::string& url);
59
60public:
61 bool TryGetRepositoryInfo(const std::string& url, RepositoryInfo& repositoryInfo);
62
63public:
64 MiKTeX::Packages::RepositoryInfo VerifyPackageRepository(const std::string& url);
65
66public:
67 static MiKTeX::Packages::RepositoryType DetermineRepositoryType(const std::string& repository);
68
69public:
70 MiKTeX::Packages::RepositoryReleaseState GetRepositoryReleaseState()
71 {
72 return repositoryReleaseState;
73 }
74
75public:
76 void SetRepositoryReleaseState(MiKTeX::Packages::RepositoryReleaseState repositoryReleaseState)
77 {
78 this->repositoryReleaseState = repositoryReleaseState;
79 }
80
81private:
82 void LoadVarData(MiKTeX::Packages::RepositoryInfo& repositoryInfo);
83
84private:
85 void SaveVarData(const MiKTeX::Packages::RepositoryInfo& repositoryInfo);
86
87private:
88 std::string GetRemoteServiceBaseUrl();
89
90private:
91 std::vector<MiKTeX::Packages::RepositoryInfo> repositories;
92
93private:
94#if MIKTEX_RELEASE_STATE == 1
96#else
98#endif
99
100private:
101 std::string remoteServiceBaseUrl;
102
103private:
104 std::shared_ptr<WebSession> webSession;
105
106private:
107 ComboCfg comboCfg;
108
109private:
110 std::shared_ptr<MiKTeX::Core::Session> session = MIKTEX_SESSION();
111};
112
113MPM_INTERNAL_END_NAMESPACE;
114
115#endif
Definition ComboCfg.h:36
RepositoryReleaseState
Repository release state.
Definition RepositoryInfo.h:174
@ Next
Experimental channel.
Definition RepositoryInfo.h:179
@ Stable
Stable channel.
Definition RepositoryInfo.h:177
RepositoryType
Repository type.
Definition RepositoryInfo.h:78
Package repository info struct.
Definition RepositoryInfo.h:204