]> git.saurik.com Git - apt.git/blame - apt-pkg/pkgsystem.cc
* cleanups
[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 /*{{{*/
13#ifdef __GNUG__
14#pragma implementation "apt-pkg/pkgsystem.h"
15#endif
16
17#include <apt-pkg/pkgsystem.h>
18#include <apt-pkg/policy.h>
cb063009 19#include <cassert>
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.. */
30pkgSystem::pkgSystem()
31{
cb063009 32 assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList));
b2e465d6
AL
33 SysList[GlobalListLen] = this;
34 GlobalListLen++;
35}
36 /*}}}*/
37// System::GetSystem - Get the named system /*{{{*/
38// ---------------------------------------------------------------------
39/* */
40pkgSystem *pkgSystem::GetSystem(const char *Label)
41{
42 for (unsigned I = 0; I != GlobalListLen; I++)
43 if (strcmp(SysList[I]->Label,Label) == 0)
44 return SysList[I];
45 return 0;
46}
47 /*}}}*/