qthighway/xqserviceutil/src/xqservicemetadata/xqaiwinterfacedescriptor.cpp
changeset 24 9d760f716ca8
parent 1 2b40d63a9c3d
equal deleted inserted replaced
19:46686fb6258c 24:9d760f716ca8
    67 /*!
    67 /*!
    68     \enum XQAiwInterfaceDescriptor::PropertyKey
    68     \enum XQAiwInterfaceDescriptor::PropertyKey
    69 
    69 
    70     This enum describes the possible property types which can be attached
    70     This enum describes the possible property types which can be attached
    71     to a XQAiwInterfaceDescriptor.
    71     to a XQAiwInterfaceDescriptor.
    72 
    72 */
    73     \value      Capabilities            The capabilities property is a QStringList and
    73 
    74                                         describes the capabilities that a service client
    74 /*! \var XQAiwInterfaceDescriptor::PropertyKey  XQAiwInterfaceDescriptor::Capabilities
    75                                         would require to use the service if capability 
    75     
    76                                         checks are enforced.
    76     The capabilities property is a QStringList and
    77     \value      Location                This property points to the location
    77     describes the capabilities that a service client
    78                                         where the plug-in providing this service is stored.
    78     would require to use the service if capability 
    79                                         If the service is plug-in based the location is the
    79     checks are enforced.
    80                                         name and/or path of the plugin.
    80 */
    81     \value      ServiceDescription      This property provides a general description for
    81 
    82                                         the service.
    82 /*! \var XQAiwInterfaceDescriptor::PropertyKey  XQAiwInterfaceDescriptor::Location
    83     \value      InterfaceDescription    This property provides a description for the interface 
    83     
    84                                         implementation.
    84     This property points to the location
       
    85     where the plug-in providing this service is stored.
       
    86     If the service is plug-in based the location is the
       
    87     name and/or path of the plugin.
       
    88 */
       
    89 
       
    90 /*! \var XQAiwInterfaceDescriptor::PropertyKey  XQAiwInterfaceDescriptor::ServiceDescription
       
    91     
       
    92     This property provides a general description for
       
    93     the service.
       
    94 */
       
    95 
       
    96 /*! \var XQAiwInterfaceDescriptor::PropertyKey  XQAiwInterfaceDescriptor::InterfaceDescription
       
    97     
       
    98     This property provides a description for the interface 
       
    99     implementation.
       
   100 */
       
   101 
       
   102 /*! \var XQAiwInterfaceDescriptor::PropertyKey  XQAiwInterfaceDescriptor::ImplementationId
       
   103 
       
   104     Extension: settable property, contains implementation id
    85 */
   105 */
    86 
   106 
    87 /*!
   107 /*!
    88     Creates a new XQAiwInterfaceDescriptor.
   108     Creates a new XQAiwInterfaceDescriptor.
    89 */
   109 */
   104         delete d;
   124         delete d;
   105 }
   125 }
   106 
   126 
   107 /*!
   127 /*!
   108     Creates a copy of XQAiwInterfaceDescriptor contained in \a other.
   128     Creates a copy of XQAiwInterfaceDescriptor contained in \a other.
       
   129     \param other Reference to the other XQAiwInterfaceDescriptor object, from
       
   130                  which new object will be created
   109 */
   131 */
   110 XQAiwInterfaceDescriptor::XQAiwInterfaceDescriptor(const XQAiwInterfaceDescriptor& other)
   132 XQAiwInterfaceDescriptor::XQAiwInterfaceDescriptor(const XQAiwInterfaceDescriptor& other)
   111     : d(0)
   133     : d(0)
   112 {
   134 {
   113     (*this) = other; //use assignment operator
   135     (*this) = other; //use assignment operator
   115 
   137 
   116 
   138 
   117 /*!
   139 /*!
   118     Copies the content of the XQAiwInterfaceDescriptor object contained 
   140     Copies the content of the XQAiwInterfaceDescriptor object contained 
   119     in \a other into this one.
   141     in \a other into this one.
       
   142     \param other Reference to XQAiwInterfaceDescriptor object, from which content will be copied
   120 */
   143 */
   121 XQAiwInterfaceDescriptor& XQAiwInterfaceDescriptor::operator=(const XQAiwInterfaceDescriptor& other)
   144 XQAiwInterfaceDescriptor& XQAiwInterfaceDescriptor::operator=(const XQAiwInterfaceDescriptor& other)
   122 {
   145 {
   123     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor: operator=");
   146     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor: operator=");
   124     if ( !other.isValid() ) {
   147     if ( !other.isValid() ) {
   134     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor: operator= done");
   157     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor: operator= done");
   135     return *this;
   158     return *this;
   136 }
   159 }
   137 
   160 
   138 /*!
   161 /*!
   139     Compares a XQAiwInterfaceDescriptor to \a other. Returns true if they 
   162     Compares a XQAiwInterfaceDescriptor to \a other.
   140     are equal and false otherwise.
   163     \param other Reference to XQAiwInterfaceDescriptor object, which will be compared
       
   164                  to this one.
       
   165     \return True if both instances are equal, false otherwise.
   141 */
   166 */
   142 bool XQAiwInterfaceDescriptor::operator==(const XQAiwInterfaceDescriptor& other) const
   167 bool XQAiwInterfaceDescriptor::operator==(const XQAiwInterfaceDescriptor& other) const
   143 {
   168 {
   144     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor: operator==");
   169     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor: operator==");
   145     
   170     
   162 /*!
   187 /*!
   163     \fn bool XQAiwInterfaceDescriptor::operator!=(const XQAiwInterfaceDescriptor& other) const
   188     \fn bool XQAiwInterfaceDescriptor::operator!=(const XQAiwInterfaceDescriptor& other) const
   164 
   189 
   165     Compares a XQAiwInterfaceDescriptor to \a other. Returns true
   190     Compares a XQAiwInterfaceDescriptor to \a other. Returns true
   166     if they are not equal and false otherwise.
   191     if they are not equal and false otherwise.
   167 */
   192     \param other Reference to XQAiwInterfaceDescriptor object, which will be compared
   168 
   193                  to this one.
   169 /*!
   194     \return False if both instances are equal, true otherwise.
   170     Returns true if this descriptor is valid; otherwise returns false.
   195 */
       
   196 
       
   197 /*!
       
   198     Checks if the descriptor is valid.
       
   199     \return True if this descriptor is valid, false otherwise
   171 */
   200 */
   172 bool XQAiwInterfaceDescriptor::isValid() const
   201 bool XQAiwInterfaceDescriptor::isValid() const
   173 {
   202 {
   174     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor:isValid");
   203     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor:isValid");
   175     if (d)
   204     if (d)
   180     XQSERVICE_DEBUG_PRINT("isValid=false");
   209     XQSERVICE_DEBUG_PRINT("isValid=false");
   181     return false;
   210     return false;
   182 }
   211 }
   183 
   212 
   184 /*!
   213 /*!
   185     Returns true if this implementation is provided for all users on the system.
   214     Checks if this implementation is provided for all users on the system.
       
   215     \return True if this implementation is provided for all users on the system,
       
   216             false otherwise
   186 
   217 
   187     \sa QServiceManager::Scope
   218     \sa QServiceManager::Scope
   188 */
   219 */
   189 bool XQAiwInterfaceDescriptor::inSystemScope() const
   220 bool XQAiwInterfaceDescriptor::inSystemScope() const
   190 {
   221 {
   191     return d ? d->systemScope : false;
   222     return d ? d->systemScope : false;
   192 }
   223 }
   193 
   224 
   194 /*!
   225 /*!
   195     Returns the name of service that provides this implementation.
   226     Gets the name of service that provides this implementation.
       
   227     \return Name of service
   196 */
   228 */
   197 QString XQAiwInterfaceDescriptor::serviceName() const
   229 QString XQAiwInterfaceDescriptor::serviceName() const
   198 {
   230 {
   199     return d ? d->serviceName : QString();
   231     return d ? d->serviceName : QString();
   200 }
   232 }
   201 
   233 
   202 /*!
   234 /*!
   203     Returns the name of the interface that is implemented.
   235     Gets the name of the interface that is implemented.
       
   236     \return Name of the interface
   204 */
   237 */
   205 QString XQAiwInterfaceDescriptor::interfaceName() const
   238 QString XQAiwInterfaceDescriptor::interfaceName() const
   206 {
   239 {
   207     return d ? d->interfaceName : QString();
   240     return d ? d->interfaceName : QString();
   208 }
   241 }
   209 
   242 
   210 
   243 
   211 /*!
   244 /*!
   212     Returns the version of the interface. 
   245     Gets the version of the interface. 
   213     
       
   214     Subsequent versions of an interface are binary compatible 
   246     Subsequent versions of an interface are binary compatible 
   215     to previous versions of the same interface. If an intcerface 
   247     to previous versions of the same interface. If an intcerface 
   216     is broken it must use a new interface name.
   248     is broken it must use a new interface name.
       
   249     \return Interface version as integer value
   217 */
   250 */
   218 int XQAiwInterfaceDescriptor::majorVersion() const
   251 int XQAiwInterfaceDescriptor::majorVersion() const
   219 {
   252 {
   220     return d ? d->major : -1;
   253     return d ? d->major : -1;
   221 }
   254 }
   222 
   255 
   223 /*!
   256 /*!
   224     Returns the version of the implementation. 
   257     Gets the version of the implementation.
       
   258     \return Implementation version as integer value
   225 */
   259 */
   226 int XQAiwInterfaceDescriptor::minorVersion() const
   260 int XQAiwInterfaceDescriptor::minorVersion() const
   227 {
   261 {
   228     return d ? d->minor : -1;
   262     return d ? d->minor : -1;
   229 }
   263 }
   230 
   264 
   231 /*!
   265 /*!
   232     Returns the value for the property \a key; otherwise returns 
   266     Gets the value for the property.
   233     an invalid QVariant.
   267     \param key Key of the property
       
   268     \return Value of the property, invalid QVariant if does not exist
   234 */
   269 */
   235 QVariant XQAiwInterfaceDescriptor::property(XQAiwInterfaceDescriptor::PropertyKey key) const
   270 QVariant XQAiwInterfaceDescriptor::property(XQAiwInterfaceDescriptor::PropertyKey key) const
   236 {
   271 {
   237     if (d)
   272     if (d)
   238     {
   273     {
   264     return false;
   299     return false;
   265 }
   300 }
   266 
   301 
   267 
   302 
   268 /*!
   303 /*!
   269     Returns the value for the custom property \a key; otherwise 
   304     Gets the value for the property.
   270     returns a null string.
   305     \param key Key of the custom property
       
   306     \return Value of the custom property, invalid null if does not exist
   271 */
   307 */
   272 QString XQAiwInterfaceDescriptor::customProperty(const QString& key) const
   308 QString XQAiwInterfaceDescriptor::customProperty(const QString& key) const
   273 {
   309 {
   274     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor::customProperty %s", qPrintable(key));
   310     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor::customProperty %s", qPrintable(key));
   275     QString val;
   311     QString val;
   280     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor::customProperty value %s", qPrintable(val));
   316     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor::customProperty value %s", qPrintable(val));
   281     
   317     
   282     return val;
   318     return val;
   283 }
   319 }
   284 
   320 
       
   321 /*!
       
   322     Gets list of custom property keys.
       
   323     \return list of custom property keys
       
   324 */
   285 QStringList XQAiwInterfaceDescriptor::customPropertyKeys() const
   325 QStringList XQAiwInterfaceDescriptor::customPropertyKeys() const
   286 {
   326 {
   287     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor::customPropertyKeys");
   327     XQSERVICE_DEBUG_PRINT("XQAiwInterfaceDescriptor::customPropertyKeys");
   288     if (d)
   328     if (d)
   289     {
   329     {
   330     \fn QDataStream &operator<<(QDataStream &out, const XQAiwInterfaceDescriptor &dc)
   370     \fn QDataStream &operator<<(QDataStream &out, const XQAiwInterfaceDescriptor &dc)
   331     \relates XQAiwInterfaceDescriptor
   371     \relates XQAiwInterfaceDescriptor
   332 
   372 
   333     Writes service interface descriptor \a dc to the stream \a out and returns a reference
   373     Writes service interface descriptor \a dc to the stream \a out and returns a reference
   334     to the stream.
   374     to the stream.
       
   375     \param out Stream to write to
       
   376     \param dc Interface descriptor written to stream
       
   377     \return Reference to the stream
   335 */
   378 */
   336 
   379 
   337 QDataStream &operator<<(QDataStream &out, const XQAiwInterfaceDescriptor &dc)
   380 QDataStream &operator<<(QDataStream &out, const XQAiwInterfaceDescriptor &dc)
   338 {
   381 {
   339     const quint32 magicNumber = 0x77AFAFA;
   382     const quint32 magicNumber = 0x77AFAFA;
   358     \fn QDataStream &operator>>(QDataStream &in, XQAiwInterfaceDescriptor &dc)
   401     \fn QDataStream &operator>>(QDataStream &in, XQAiwInterfaceDescriptor &dc)
   359     \relates XQAiwInterfaceDescriptor
   402     \relates XQAiwInterfaceDescriptor
   360 
   403 
   361     Reads a service interface descriptor into \a dc from the stream \a in and returns a
   404     Reads a service interface descriptor into \a dc from the stream \a in and returns a
   362     reference to the stream.
   405     reference to the stream.
       
   406     \param in Stream to read from
       
   407     \param dc Interface descriptor read from stream
       
   408     \return Reference to the stream
   363 */
   409 */
   364 QDataStream &operator>>(QDataStream &in, XQAiwInterfaceDescriptor &dc)
   410 QDataStream &operator>>(QDataStream &in, XQAiwInterfaceDescriptor &dc)
   365 {
   411 {
   366     const quint32 magicNumber = 0x77AFAFA;
   412     const quint32 magicNumber = 0x77AFAFA;
   367     quint32 storedMagicNumber;
   413     quint32 storedMagicNumber;