webengine/device/inc/Device.h
changeset 10 a359256acfc6
parent 0 dd21522fd290
child 15 60c5402cb945
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
    33 namespace KJS
    33 namespace KJS
    34     {
    34     {
    35 
    35 
    36     class MDeviceBinding;
    36     class MDeviceBinding;
    37     class ServiceObject;
    37     class ServiceObject;
    38     class DevicePrivate;
    38     class Device;
    39 
    39     
       
    40     class DevicePrivateBase
       
    41         {
       
    42         public:
       
    43             DevicePrivateBase();
       
    44             virtual ~DevicePrivateBase();
       
    45             void AddChild( DevicePrivateBase* aValue );
       
    46             void RemoveChild( DevicePrivateBase* aValue );
       
    47             void SetParent( DevicePrivateBase* aValue );
       
    48 
       
    49         private: 
       
    50             TBool m_isDeleting;   
       
    51             DevicePrivateBase* m_parent;
       
    52             RPointerArray<DevicePrivateBase>* m_children;
       
    53         };
       
    54         
       
    55     class DevicePrivate : public DevicePrivateBase
       
    56         {
       
    57         friend class Device;
       
    58         friend class DeviceFunc;
       
    59         public:
       
    60             DevicePrivate(Device* jsobj);
       
    61             ~DevicePrivate();
       
    62             void SetUid( const TUint& aValue);
       
    63 
       
    64         private:
       
    65             MDeviceBinding* m_deviceBinding;                 // Owned
       
    66             Identifier m_propName;
       
    67             ExecState* m_exec;                               // not owned
       
    68             Device* m_jsobj;                                 // not owned
       
    69         };
       
    70     
    40     class Device: public JSObject
    71     class Device: public JSObject
    41         {
    72         {
       
    73         friend class DevicePrivate;
    42         friend class DeviceFunc;
    74         friend class DeviceFunc;
    43         public: // constructor and destructor
    75         public: // constructor and destructor
    44 
    76 
    45            /**
    77            /**
    46             * Constructor
    78             * Constructor
    90            /**
   122            /**
    91             * whether this object is valid
   123             * whether this object is valid
    92             * @return boolean
   124             * @return boolean
    93             * @since 5.0
   125             * @since 5.0
    94             */
   126             */
    95             const bool valid() const { return m_valid; }
   127             const TBool valid() const { return m_valid; }
    96 
   128 
       
   129             /**
       
   130             * getServiceData
       
   131             * @return DevicePrivateBase*
       
   132             * @since 7.x
       
   133             */
       
   134             DevicePrivateBase* getDeviceData() { return m_privateData; }
       
   135             
    97             static const ClassInfo info;
   136             static const ClassInfo info;
    98 
   137 
    99            /**
   138            /**
   100             * entries in lookup table
   139             * entries in lookup table
   101             */
   140             */
   116             * SetUid
   155             * SetUid
   117             * @return none
   156             * @return none
   118             * @since 5.0
   157             * @since 5.0
   119             **/
   158             **/
   120             void SetUid( const TUint& aValue);
   159             void SetUid( const TUint& aValue);
       
   160             
       
   161             MDeviceBinding* GetDeviceBinding();
   121 
   162 
   122         private:
   163         private:
   123             DevicePrivate* m_privateData;   // private object to hold data
   164             DevicePrivate* m_privateData;   // private object to hold data
   124             bool m_valid;                   // object is valid or not
   165             TBool m_valid;                   // object is valid or not
   125         };
       
   126 
       
   127     class DevicePrivate
       
   128         {
       
   129         friend class Device;
       
   130         friend class DeviceFunc;
       
   131         public:
       
   132             DevicePrivate();
       
   133             ~DevicePrivate()   { Close(); }
       
   134             void Close();
       
   135             void SetUid( const TUint& aValue);
       
   136 
       
   137         private:
       
   138             MDeviceBinding* m_deviceBinding;                 // Owned
       
   139             Identifier m_propName;
       
   140             RPointerArray<ServiceObject>* m_serviceObjArray; // owned
       
   141             ExecState* m_exec;                               // not owned
       
   142 
       
   143         };
   166         };
   144 
   167 
   145     class DeviceFunc : public JSObject
   168     class DeviceFunc : public JSObject
   146         {
   169         {
   147 
   170