sourcelist.h 2.0 KB

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