]>
Commit | Line | Data |
---|---|---|
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> |
4f333a8b | 16 | #include <cstring> |
b2e465d6 AL |
17 | /*}}}*/ |
18 | ||
19 | pkgSystem *_system = 0; | |
20 | static pkgSystem *SysList[10]; | |
21 | pkgSystem **pkgSystem::GlobalList = SysList; | |
22 | unsigned long pkgSystem::GlobalListLen = 0; | |
23 | ||
24 | // System::pkgSystem - Constructor /*{{{*/ | |
25 | // --------------------------------------------------------------------- | |
26 | /* Add it to the global list.. */ | |
27 | pkgSystem::pkgSystem() | |
28 | { | |
cb063009 | 29 | assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList)); |
b2e465d6 AL |
30 | SysList[GlobalListLen] = this; |
31 | GlobalListLen++; | |
32 | } | |
33 | /*}}}*/ | |
34 | // System::GetSystem - Get the named system /*{{{*/ | |
35 | // --------------------------------------------------------------------- | |
36 | /* */ | |
37 | pkgSystem *pkgSystem::GetSystem(const char *Label) | |
38 | { | |
39 | for (unsigned I = 0; I != GlobalListLen; I++) | |
40 | if (strcmp(SysList[I]->Label,Label) == 0) | |
41 | return SysList[I]; | |
42 | return 0; | |
43 | } | |
44 | /*}}}*/ |