]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/commitdiff
use friend class and hide methods
authorTomi Valkeinen <tomi.valkeinen@iki.fi>
Sat, 3 Oct 2015 08:27:26 +0000 (11:27 +0300)
committerTomi Valkeinen <tomi.valkeinen@iki.fi>
Sat, 3 Oct 2015 14:49:45 +0000 (17:49 +0300)
libkms++/connector.h
libkms++/crtc.h
libkms++/drmobject.h
libkms++/encoder.h
libkms++/plane.h
libkms++/property.h

index 14e6b369420c1522e87bbda6ff144e4b02209ce0..84845d5326b8c2235ff551b5d5953747150e541e 100644 (file)
@@ -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;
index fabc6e250d3314f3fead222a1f7cf9beb71e658c..d30d4972dda0113fbbbbdf2514b3428ce9d56d29 100644 (file)
@@ -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;
index 6c3062c024852d7453c43e424be97e888dbe5254..f1791919ece511015491952a05e00ed910ee22a0 100644 (file)
@@ -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:
index 3e9a8e46c2bff96df3b0f6e9797abd2522390c83..77e4e3e77001ea57fe6eff0f53e6f226aa91a4a3 100644 (file)
@@ -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;
 };
 }
index 890a28fdfc9b77c127d84c434f81742c8300791d..671e1508964b7b6cf9b14f3a85db9a392eec4dce 100644 (file)
@@ -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;
 };
 }
index d5306d0be34db2c0b0be3a30c34ff5822b10502e..24d2ae93887de1bb41df516b11423e98aa05fb0d 100644 (file)
@@ -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;
 };
 }