]> git.saurik.com Git - apt.git/blob - apt-pkg/pkgsystem.cc
debian/control: Set Standards-Version to 3.9.7
[apt.git] / apt-pkg / pkgsystem.cc
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: pkgsystem.cc,v 1.3 2004/02/27 00:43:16 mdz Exp $
4 /* ######################################################################
5
6 System - Abstraction for running on different systems.
7
8 Basic general structure..
9
10 ##################################################################### */
11 /*}}}*/
12 // Include Files /*{{{*/
13 #include<config.h>
14
15 #include <apt-pkg/debsystem.h>
16 #include <apt-pkg/pkgsystem.h>
17 #include <apt-pkg/macros.h>
18
19 #include <cassert>
20 #include <cstring>
21 /*}}}*/
22
23 pkgSystem *_system = 0;
24 static pkgSystem *SysList[10];
25 pkgSystem **pkgSystem::GlobalList = SysList;
26 unsigned long pkgSystem::GlobalListLen = 0;
27
28 // System::pkgSystem - Constructor /*{{{*/
29 // ---------------------------------------------------------------------
30 /* Add it to the global list.. */
31 pkgSystem::pkgSystem(char const * const label, pkgVersioningSystem * const vs) :
32 Label(label), VS(vs), d(NULL)
33 {
34 assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList));
35 SysList[GlobalListLen] = this;
36 ++GlobalListLen;
37 }
38 /*}}}*/
39 // System::GetSystem - Get the named system /*{{{*/
40 // ---------------------------------------------------------------------
41 /* */
42 APT_PURE pkgSystem *pkgSystem::GetSystem(const char *Label)
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 /*}}}*/
50 bool 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 /*}}}*/
58 std::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 /*}}}*/
66
67 pkgSystem::~pkgSystem() {}