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