]> git.saurik.com Git - apt.git/blame - apt-pkg/pkgsystem.cc
just-in-time creation for (implicit) Provides
[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
b2e465d6 15#include <apt-pkg/pkgsystem.h>
a02db58f
DK
16#include <apt-pkg/macros.h>
17
cb063009 18#include <cassert>
4f333a8b 19#include <cstring>
b2e465d6
AL
20 /*}}}*/
21
22pkgSystem *_system = 0;
23static pkgSystem *SysList[10];
24pkgSystem **pkgSystem::GlobalList = SysList;
25unsigned long pkgSystem::GlobalListLen = 0;
26
27// System::pkgSystem - Constructor /*{{{*/
28// ---------------------------------------------------------------------
29/* Add it to the global list.. */
6c55f07a
DK
30pkgSystem::pkgSystem(char const * const label, pkgVersioningSystem * const vs) :
31 Label(label), VS(vs), d(NULL)
b2e465d6 32{
cb063009 33 assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList));
b2e465d6 34 SysList[GlobalListLen] = this;
dcaa1185 35 ++GlobalListLen;
b2e465d6
AL
36}
37 /*}}}*/
38// System::GetSystem - Get the named system /*{{{*/
39// ---------------------------------------------------------------------
40/* */
a02db58f 41APT_PURE pkgSystem *pkgSystem::GetSystem(const char *Label)
b2e465d6
AL
42{
43 for (unsigned I = 0; I != GlobalListLen; I++)
44 if (strcmp(SysList[I]->Label,Label) == 0)
45 return SysList[I];
46 return 0;
47}
48 /*}}}*/
c8a4ce6c
DK
49
50pkgSystem::~pkgSystem() {}