pkgsystem.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: pkgsystem.cc,v 1.2 2001/02/20 07:03:17 jgg Exp $
  4. /* ######################################################################
  5. System - Abstraction for running on different systems.
  6. Basic general structure..
  7. ##################################################################### */
  8. /*}}}*/
  9. // Include Files /*{{{*/
  10. #ifdef __GNUG__
  11. #pragma implementation "apt-pkg/pkgsystem.h"
  12. #endif
  13. #include <apt-pkg/pkgsystem.h>
  14. #include <apt-pkg/policy.h>
  15. /*}}}*/
  16. pkgSystem *_system = 0;
  17. static pkgSystem *SysList[10];
  18. pkgSystem **pkgSystem::GlobalList = SysList;
  19. unsigned long pkgSystem::GlobalListLen = 0;
  20. // System::pkgSystem - Constructor /*{{{*/
  21. // ---------------------------------------------------------------------
  22. /* Add it to the global list.. */
  23. pkgSystem::pkgSystem()
  24. {
  25. SysList[GlobalListLen] = this;
  26. GlobalListLen++;
  27. }
  28. /*}}}*/
  29. // System::GetSystem - Get the named system /*{{{*/
  30. // ---------------------------------------------------------------------
  31. /* */
  32. pkgSystem *pkgSystem::GetSystem(const char *Label)
  33. {
  34. for (unsigned I = 0; I != GlobalListLen; I++)
  35. if (strcmp(SysList[I]->Label,Label) == 0)
  36. return SysList[I];
  37. return 0;
  38. }
  39. /*}}}*/