sourcelist.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: sourcelist.h,v 1.3 1998/07/12 23:58:38 jgg Exp $
  4. /* ######################################################################
  5. SourceList - Manage a list of sources
  6. The Source List class provides access to a list of sources. It
  7. can read them from a file and generate a list of all the permutations.
  8. ##################################################################### */
  9. /*}}}*/
  10. // Header section: pkglib
  11. #ifndef PKGLIB_SOURCELIST_H
  12. #define PKGLIB_SOURCELIST_H
  13. #include <string>
  14. #include <vector>
  15. #include <iostream.h>
  16. #include <apt-pkg/pkgcache.h>
  17. #ifdef __GNUG__
  18. #pragma interface "apt-pkg/sourcelist.h"
  19. #endif
  20. class pkgAquire;
  21. class pkgSourceList
  22. {
  23. public:
  24. /* Each item in the source list, each line can have more than one
  25. item */
  26. struct Item
  27. {
  28. enum {Deb} Type;
  29. string URI;
  30. string Dist;
  31. string Section;
  32. bool SetType(string S);
  33. bool SetURI(string S);
  34. string PackagesURI() const;
  35. string PackagesInfo() const;
  36. string SiteOnly(string URI) const;
  37. string ArchiveInfo(pkgCache::VerIterator Ver) const;
  38. string ArchiveURI(string File) const;
  39. };
  40. typedef vector<Item>::const_iterator const_iterator;
  41. protected:
  42. vector<Item> List;
  43. public:
  44. bool ReadMainList();
  45. bool Read(string File);
  46. string SanitizeURI(string URI);
  47. const_iterator MatchPkgFile(pkgCache::VerIterator Ver);
  48. // List accessors
  49. inline const_iterator begin() const {return List.begin();};
  50. inline const_iterator end() const {return List.end();};
  51. inline unsigned int size() const {return List.size();};
  52. inline bool empty() const {return List.empty();};
  53. pkgSourceList();
  54. pkgSourceList(string File);
  55. };
  56. ostream &operator <<(ostream &O,pkgSourceList::Item &Itm);
  57. #endif