Wire.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef NULLSOFT_WIREH
  2. #define NULLSOFT_WIREH
  3. #include "Feeds.h"
  4. #include "../nu/AutoLock.h"
  5. #include "api_podcasts.h"
  6. #include <vector>
  7. class ChannelList : public api_podcasts
  8. {
  9. public:
  10. ChannelList() : channelGuard( "Feed Guard" ) {}
  11. typedef std::vector<Channel> ChannelContainer;
  12. typedef ChannelContainer::iterator iterator;
  13. size_t size() { return channelList.size(); }
  14. bool empty() { return channelList.empty(); }
  15. void push_back( const Channel &channel );
  16. bool AddChannel( Channel &channel );
  17. iterator begin() { return channelList.begin(); }
  18. iterator end() { return channelList.end(); }
  19. void RemoveChannel( int index ) { channelList.erase( channelList.begin() + index ); }
  20. Channel &operator[]( size_t index ) { return channelList[ index ]; }
  21. ChannelContainer channelList;
  22. operator Nullsoft::Utility::LockGuard &( ) { return channelGuard; }
  23. void SortByTitle();
  24. Nullsoft::Utility::LockGuard channelGuard;
  25. public: // api_podcasts interface
  26. size_t GetNumPodcasts();
  27. ifc_podcast *EnumPodcast( size_t i );
  28. protected:
  29. RECVS_DISPATCH;
  30. };
  31. extern ChannelList channels;
  32. //extern CategoryIndex sourceByCategory;
  33. #include "ChannelSync.h"
  34. class WireManager : public ChannelSync
  35. {
  36. public:
  37. void BeginChannelSync();
  38. void NewChannel( const Channel &newChannel );
  39. void EndChannelSync();
  40. };
  41. extern WireManager channelMgr;
  42. #endif