Newer
Older
libj / include / j / util / collection.hpp
  1. /**
  2. * @file collection.hpp
  3. * @brief J Library Collection ヘッダファイル。
  4. * @copyright 2001 - 2024 Nomura Kei
  5. * @depends
  6. * j/lang/iterable.hpp
  7. */
  8. #ifndef J_UTIL_COLLECTION_HPP
  9. #define J_UTIL_COLLECTION_HPP
  10.  
  11. #include <j/lang/iterable.hpp>
  12.  
  13. namespace j
  14. {
  15. namespace util
  16. {
  17.  
  18. template <typename T>
  19. class Collection : public j::lang::Iterable<T>
  20. {
  21. public:
  22. virtual ~Collection() = default;
  23. virtual int size() const = 0;
  24. virtual bool isEmpty() const = 0;
  25. virtual bool contains(const T &t) const = 0;
  26. virtual bool add(const T &t) = 0;
  27. virtual void clear() = 0;
  28. virtual bool remove(const T &t) = 0;
  29. };
  30.  
  31. } // namespace util
  32. } // namespace j
  33.  
  34. #endif // J_UTIL_COLLECTION_HPP