• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Solid

device.h

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright (C) 2005-2007 Kevin Ottens <ervin@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License version 2 as published by the Free Software Foundation.
00007 
00008     This library is distributed in the hope that it will be useful,
00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011     Library General Public License for more details.
00012 
00013     You should have received a copy of the GNU Library General Public License
00014     along with this library; see the file COPYING.LIB.  If not, write to
00015     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016     Boston, MA 02110-1301, USA.
00017 
00018 */
00019 
00020 #ifndef SOLID_DEVICE_H
00021 #define SOLID_DEVICE_H
00022 
00023 #include <QtCore/QVariant>
00024 
00025 #include <QtCore/QMap>
00026 #include <QtCore/QList>
00027 #include <QtCore/QSharedData>
00028 
00029 #include <solid/solid_export.h>
00030 
00031 #include <solid/deviceinterface.h>
00032 
00033 namespace Solid
00034 {
00035     class DevicePrivate;
00036 
00047     class SOLID_EXPORT Device
00048     {
00049     public:
00055         static QList<Device> allDevices();
00056 
00068         static QList<Device> listFromType(const DeviceInterface::Type &type,
00069                                           const QString &parentUdi = QString());
00070 
00081         static QList<Device> listFromQuery(const Predicate &predicate,
00082                                            const QString &parentUdi = QString());
00083 
00091         static QList<Device> listFromQuery(const QString &predicate,
00092                                            const QString &parentUdi = QString());
00093 
00094 
00100         explicit Device(const QString &udi = QString());
00101 
00107         Device(const Device &device);
00108 
00112         ~Device();
00113 
00114 
00115 
00122         Device &operator=(const Device &device);
00123 
00130         bool isValid() const;
00131 
00132 
00145         QString udi() const;
00146 
00153         QString parentUdi() const;
00154 
00155 
00162         Device parent() const;
00163 
00164 
00165 
00171         QString vendor() const;
00172 
00178         QString product() const;
00179 
00186         QString icon() const;
00187 
00188 
00195         bool isDeviceInterface(const DeviceInterface::Type &type) const;
00196 
00204         DeviceInterface *asDeviceInterface(const DeviceInterface::Type &type);
00205 
00213         const DeviceInterface *asDeviceInterface(const DeviceInterface::Type &type) const;
00214 
00221         template <class DevIface> DevIface *as()
00222         {
00223             DeviceInterface::Type type = DevIface::deviceInterfaceType();
00224             DeviceInterface *iface = asDeviceInterface(type);
00225             return qobject_cast<DevIface *>(iface);
00226         }
00227 
00234         template <class DevIface> const DevIface *as() const
00235         {
00236             DeviceInterface::Type type = DevIface::deviceInterfaceType();
00237             const DeviceInterface *iface = asDeviceInterface(type);
00238             return qobject_cast<const DevIface *>(iface);
00239         }
00240 
00246         template <class DevIface> bool is() const
00247         {
00248             return isDeviceInterface(DevIface::deviceInterfaceType());
00249         }
00250 
00251     private:
00252         QExplicitlySharedDataPointer<DevicePrivate> d;
00253         friend class DeviceManagerPrivate;
00254     };
00255 }
00256 
00257 #endif

Solid

Skip menu "Solid"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal