agentList.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #ifndef agentList_H_
  3. #define agentList_H_
  4. #include "unicode/uniFile.h"
  5. // class that manages lists of blocked user agents
  6. class agentList
  7. {
  8. private:
  9. class impl;
  10. impl *m_impl;
  11. public:
  12. struct agent_t
  13. {
  14. uniString::utf8 m_agent; // used to hold the user agent to not allow
  15. size_t m_stream_ID; // used to differentiate
  16. agent_t(const uniString::utf8 &agent, const size_t stream_ID) throw() : m_agent(agent), m_stream_ID(stream_ID) {}
  17. agent_t() throw() : m_stream_ID(0) {}
  18. };
  19. // throws if parameters are invalid
  20. bool add(const uniString::utf8 &agent, const size_t stream_ID, const bool soft) throw(std::exception);
  21. // true if removed
  22. bool remove(const uniString::utf8 &agent, const size_t stream_ID, const bool allStream) throw();
  23. // true if found
  24. bool find(const uniString::utf8 &agent, const size_t stream_ID) throw();
  25. bool load(const uniFile::filenameType &fn, const size_t stream_ID) throw();
  26. bool save(const uniFile::filenameType &fn, const size_t stream_ID) throw();
  27. agentList();
  28. ~agentList() throw();
  29. // for web administration reference
  30. void get(std::vector<agent_t> &rl, const size_t stream_ID) throw();
  31. };
  32. extern agentList g_agentList;
  33. #endif