CWallpaper.h 695 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include <cassert>
  3. #include "CProject.h"
  4. namespace WallpaperEngine::Core {
  5. class CProject;
  6. class CWallpaper {
  7. public:
  8. template <class T> const T* as () const {
  9. assert (is<T> ());
  10. return reinterpret_cast<const T*> (this);
  11. }
  12. template <class T> T* as () {
  13. assert (is<T> ());
  14. return reinterpret_cast<T*> (this);
  15. }
  16. template <class T> bool is () {
  17. return this->m_type == T::Type;
  18. }
  19. CWallpaper (std::string type, CProject& project);
  20. CProject& getProject () const;
  21. protected:
  22. friend class CProject;
  23. private:
  24. CProject& m_project;
  25. std::string m_type;
  26. };
  27. } // namespace WallpaperEngine::Core