]> git.saurik.com Git - apt.git/blame - apt-pkg/pkgsystem.cc
* merged from apt--mvo
[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 /*{{{*/
b2e465d6
AL
13#include <apt-pkg/pkgsystem.h>
14#include <apt-pkg/policy.h>
cb063009 15#include <cassert>
b2e465d6
AL
16 /*}}}*/
17
18pkgSystem *_system = 0;
19static pkgSystem *SysList[10];
20pkgSystem **pkgSystem::GlobalList = SysList;
21unsigned long pkgSystem::GlobalListLen = 0;
22
23// System::pkgSystem - Constructor /*{{{*/
24// ---------------------------------------------------------------------
25/* Add it to the global list.. */
26pkgSystem::pkgSystem()
27{
cb063009 28 assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList));
b2e465d6
AL
29 SysList[GlobalListLen] = this;
30 GlobalListLen++;
31}
32 /*}}}*/
33// System::GetSystem - Get the named system /*{{{*/
34// ---------------------------------------------------------------------
35/* */
36pkgSystem *pkgSystem::GetSystem(const char *Label)
37{
38 for (unsigned I = 0; I != GlobalListLen; I++)
39 if (strcmp(SysList[I]->Label,Label) == 0)
40 return SysList[I];
41 return 0;
42}
43 /*}}}*/