version.cc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: version.cc,v 1.10 2001/02/20 07:03:17 jgg Exp $
  4. /* ######################################################################
  5. Version - Versioning system..
  6. ##################################################################### */
  7. /*}}}*/
  8. // Include Files /*{{{*/
  9. #ifdef __GNUG__
  10. #pragma implementation "apt-pkg/version.h"
  11. #endif
  12. #include <apt-pkg/version.h>
  13. #include <apt-pkg/pkgcache.h>
  14. #include <stdlib.h>
  15. /*}}}*/
  16. static pkgVersioningSystem *VSList[10];
  17. pkgVersioningSystem **pkgVersioningSystem::GlobalList = VSList;
  18. unsigned long pkgVersioningSystem::GlobalListLen = 0;
  19. // pkgVS::pkgVersioningSystem - Constructor /*{{{*/
  20. // ---------------------------------------------------------------------
  21. /* Link to the global list of versioning systems supported */
  22. pkgVersioningSystem::pkgVersioningSystem()
  23. {
  24. VSList[GlobalListLen] = this;
  25. GlobalListLen++;
  26. }
  27. /*}}}*/
  28. // pkgVS::GetVS - Find a VS by name /*{{{*/
  29. // ---------------------------------------------------------------------
  30. /* */
  31. pkgVersioningSystem *pkgVersioningSystem::GetVS(const char *Label)
  32. {
  33. for (unsigned I = 0; I != GlobalListLen; I++)
  34. if (strcmp(VSList[I]->Label,Label) == 0)
  35. return VSList[I];
  36. return 0;
  37. }
  38. /*}}}*/