sourcelist.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: sourcelist.h,v 1.5 1998/07/19 21:24:15 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 distinct
  8. sources.
  9. All sources have a type associated with them that defines the layout
  10. of the archive. The exact format of the file is documented in
  11. files.sgml.
  12. ##################################################################### */
  13. /*}}}*/
  14. // Header section: pkglib
  15. #ifndef PKGLIB_SOURCELIST_H
  16. #define PKGLIB_SOURCELIST_H
  17. #include <string>
  18. #include <vector>
  19. #include <iostream.h>
  20. #include <apt-pkg/pkgcache.h>
  21. #ifdef __GNUG__
  22. #pragma interface "apt-pkg/sourcelist.h"
  23. #endif
  24. class pkgAquire;
  25. class pkgSourceList
  26. {
  27. public:
  28. /* Each item in the source list, each line can have more than one
  29. item */
  30. struct Item
  31. {
  32. enum {Deb} Type;
  33. string URI;
  34. string Dist;
  35. string Section;
  36. bool SetType(string S);
  37. bool SetURI(string S);
  38. string PackagesURI() const;
  39. string PackagesInfo() const;
  40. string SiteOnly(string URI) const;
  41. string ArchiveInfo(pkgCache::VerIterator Ver) const;
  42. string ArchiveURI(string File) const;
  43. };
  44. typedef vector<Item>::const_iterator const_iterator;
  45. protected:
  46. vector<Item> List;
  47. public:
  48. bool ReadMainList();
  49. bool Read(string File);
  50. // List accessors
  51. inline const_iterator begin() const {return List.begin();};
  52. inline const_iterator end() const {return List.end();};
  53. inline unsigned int size() const {return List.size();};
  54. inline bool empty() const {return List.empty();};
  55. pkgSourceList();
  56. pkgSourceList(string File);
  57. };
  58. ostream &operator <<(ostream &O,pkgSourceList::Item &Itm);
  59. #endif