]> git.saurik.com Git - apt.git/blame - apt-pkg/pkgsystem.cc
policy: Remove TODO for replacing old GetCandidateVer()
[apt.git] / apt-pkg / pkgsystem.cc
CommitLineData
b2e465d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
cb063009 3// $Id: pkgsystem.cc,v 1.3 2004/02/27 00:43:16 mdz Exp $
b2e465d6
AL
4/* ######################################################################
5
6 System - Abstraction for running on different systems.
7
8 Basic general structure..
9
10 ##################################################################### */
11 /*}}}*/
12// Include Files /*{{{*/
ea542140
DK
13#include<config.h>
14
8d6d3f00 15#include <apt-pkg/debsystem.h>
b2e465d6 16#include <apt-pkg/pkgsystem.h>
a02db58f
DK
17#include <apt-pkg/macros.h>
18
cb063009 19#include <cassert>
4f333a8b 20#include <cstring>
b2e465d6
AL
21 /*}}}*/
22
23pkgSystem *_system = 0;
24static pkgSystem *SysList[10];
25pkgSystem **pkgSystem::GlobalList = SysList;
26unsigned long pkgSystem::GlobalListLen = 0;
27
28// System::pkgSystem - Constructor /*{{{*/
29// ---------------------------------------------------------------------
30/* Add it to the global list.. */
6c55f07a
DK
31pkgSystem::pkgSystem(char const * const label, pkgVersioningSystem * const vs) :
32 Label(label), VS(vs), d(NULL)
b2e465d6 33{
cb063009 34 assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList));
b2e465d6 35 SysList[GlobalListLen] = this;
dcaa1185 36 ++GlobalListLen;
b2e465d6
AL
37}
38 /*}}}*/
39// System::GetSystem - Get the named system /*{{{*/
40// ---------------------------------------------------------------------
41/* */
a02db58f 42APT_PURE pkgSystem *pkgSystem::GetSystem(const char *Label)
b2e465d6
AL
43{
44 for (unsigned I = 0; I != GlobalListLen; I++)
45 if (strcmp(SysList[I]->Label,Label) == 0)
46 return SysList[I];
47 return 0;
48}
49 /*}}}*/
8d6d3f00
DK
50bool pkgSystem::MultiArchSupported() const /*{{{*/
51{
52 debSystem const * const deb = dynamic_cast<debSystem const *>(this);
53 if (deb != NULL)
54 return deb->SupportsMultiArch();
55 return true;
56}
57 /*}}}*/
825db890
DK
58std::vector<std::string> pkgSystem::ArchitecturesSupported() const /*{{{*/
59{
60 debSystem const * const deb = dynamic_cast<debSystem const *>(this);
61 if (deb != NULL)
62 return deb->SupportedArchitectures();
63 return {};
64}
65 /*}}}*/
c8a4ce6c
DK
66
67pkgSystem::~pkgSystem() {}