sourcelist.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: sourcelist.h,v 1.8 1999/04/07 05:30:18 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, DebSrc} 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 ReleaseURI() const;
  41. string ReleaseInfo() const;
  42. string SourceInfo(string Pkg,string Ver,string Comp) const;
  43. string SiteOnly(string URI) const;
  44. string ArchiveInfo(pkgCache::VerIterator Ver) const;
  45. string ArchiveURI(string File) const;
  46. };
  47. typedef vector<Item>::const_iterator const_iterator;
  48. protected:
  49. vector<Item> List;
  50. public:
  51. bool ReadMainList();
  52. bool Read(string File);
  53. // List accessors
  54. inline const_iterator begin() const {return List.begin();};
  55. inline const_iterator end() const {return List.end();};
  56. inline unsigned int size() const {return List.size();};
  57. inline bool empty() const {return List.empty();};
  58. pkgSourceList();
  59. pkgSourceList(string File);
  60. };
  61. ostream &operator <<(ostream &O,pkgSourceList::Item &Itm);
  62. #endif