pkgsystem.cc 1.3 KB

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