diff options
author | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-10-03 11:27:26 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-10-03 17:49:45 +0300 |
commit | 9b382fd474a6cc949e93bf6f34ce258ef7dd76a2 (patch) | |
tree | 339be22fdc7cea3a7f7264e89786ff7f9cf09b34 /libkms++ | |
parent | 624dadeeda877972969f2d9096301fcc652822ea (diff) |
use friend class and hide methods
Diffstat (limited to 'libkms++')
-rw-r--r-- | libkms++/connector.h | 11 | ||||
-rw-r--r-- | libkms++/crtc.h | 11 | ||||
-rw-r--r-- | libkms++/drmobject.h | 14 | ||||
-rw-r--r-- | libkms++/encoder.h | 7 | ||||
-rw-r--r-- | libkms++/plane.h | 7 | ||||
-rw-r--r-- | libkms++/property.h | 7 |
6 files changed, 32 insertions, 25 deletions
diff --git a/libkms++/connector.h b/libkms++/connector.h index 14e6b36..84845d5 100644 --- a/libkms++/connector.h +++ b/libkms++/connector.h @@ -24,12 +24,8 @@ struct Videomode class Connector : public DrmObject { + friend class Card; public: - Connector(Card& card, uint32_t id, uint32_t idx); - ~Connector(); - - void setup(); - void print_short() const; Videomode get_default_mode() const; @@ -42,6 +38,11 @@ public: bool connected() const; private: + Connector(Card& card, uint32_t id, uint32_t idx); + ~Connector(); + + void setup(); + ConnectorPriv* m_priv; std::string m_fullname; diff --git a/libkms++/crtc.h b/libkms++/crtc.h index fabc6e2..d30d497 100644 --- a/libkms++/crtc.h +++ b/libkms++/crtc.h @@ -11,12 +11,8 @@ struct CrtcPriv; class Crtc : public DrmObject { + friend class Card; public: - Crtc(Card& card, uint32_t id, uint32_t idx); - ~Crtc(); - - void setup(); - void print_short() const; const std::vector<Plane*>& get_possible_planes() const { return m_possible_planes; } @@ -30,6 +26,11 @@ public: int page_flip(Framebuffer& fb, void *data); private: + Crtc(Card& card, uint32_t id, uint32_t idx); + ~Crtc(); + + void setup(); + CrtcPriv* m_priv; std::vector<Plane*> m_possible_planes; diff --git a/libkms++/drmobject.h b/libkms++/drmobject.h index 6c3062c..f179191 100644 --- a/libkms++/drmobject.h +++ b/libkms++/drmobject.h @@ -9,16 +9,11 @@ namespace kms class DrmObject { + friend class Card; public: - DrmObject(Card& card, uint32_t object_type); - DrmObject(Card& card, uint32_t id, uint32_t object_type, uint32_t idx = 0); - virtual ~DrmObject(); - DrmObject(const DrmObject& other) = delete; DrmObject& operator=(const DrmObject& other) = delete; - virtual void setup() { }; - virtual void print_short() const = 0; void print_props() const; @@ -33,6 +28,13 @@ public: uint64_t get_prop_value(const char *name) const; protected: + DrmObject(Card& card, uint32_t object_type); + DrmObject(Card& card, uint32_t id, uint32_t object_type, uint32_t idx = 0); + + virtual ~DrmObject(); + + virtual void setup() { } + virtual void set_id(uint32_t id); private: diff --git a/libkms++/encoder.h b/libkms++/encoder.h index 3e9a8e4..77e4e3e 100644 --- a/libkms++/encoder.h +++ b/libkms++/encoder.h @@ -10,16 +10,17 @@ struct EncoderPriv; class Encoder : public DrmObject { + friend class Card; public: - Encoder(Card& card, uint32_t id); - ~Encoder(); - void print_short() const; Crtc* get_crtc() const; std::vector<Crtc*> get_possible_crtcs() const; private: + Encoder(Card& card, uint32_t id); + ~Encoder(); + EncoderPriv* m_priv; }; } diff --git a/libkms++/plane.h b/libkms++/plane.h index 890a28f..671e150 100644 --- a/libkms++/plane.h +++ b/libkms++/plane.h @@ -16,10 +16,8 @@ struct PlanePriv; class Plane : public DrmObject { + friend class Card; public: - Plane(Card& card, uint32_t id); - ~Plane(); - void print_short() const; bool supports_crtc(Crtc* crtc) const; @@ -27,6 +25,9 @@ public: PlaneType plane_type() const; private: + Plane(Card& card, uint32_t id); + ~Plane(); + PlanePriv* m_priv; }; } diff --git a/libkms++/property.h b/libkms++/property.h index d5306d0..24d2ae9 100644 --- a/libkms++/property.h +++ b/libkms++/property.h @@ -9,15 +9,16 @@ struct PropertyPriv; class Property : public DrmObject { + friend class Card; public: - Property(Card& card, uint32_t id); - ~Property(); - void print_short() const; const char *name() const; private: + Property(Card& card, uint32_t id); + ~Property(); + PropertyPriv* m_priv; }; } |