gitbase.h 682 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef GITBASE_H
  2. #define GITBASE_H
  3. #include <gitrepository.h>
  4. #include <QObject>
  5. #include <git2/types.h>
  6. #include <git2/oid.h>
  7. class GitRepository;
  8. template <typename T>
  9. class GitBase : public QObject
  10. {
  11. public:
  12. GitBase(T* raw, GitRepository* parent) : QObject(parent)
  13. ,m_raw(raw)
  14. ,m_repository(parent)
  15. {}
  16. T* raw() const {
  17. return m_raw;
  18. }
  19. bool isValid() const {
  20. return m_raw != nullptr;
  21. }
  22. GitRepository* repository() const {
  23. return m_repository;
  24. }
  25. git_oid* oid() const {
  26. return &m_oid;
  27. }
  28. protected:
  29. T* m_raw;
  30. GitRepository* m_repository;
  31. git_oid m_oid;
  32. };
  33. #endif // GITBASE_H