File indexing completed on 2024-06-16 03:54:30

0001 /*
0002     SPDX-FileCopyrightText: 2018 René J.V. Bertin <rjvbertin@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef SOLID_BACKENDS_IOKIT_DADICTIONARY_P_H
0008 #define SOLID_BACKENDS_IOKIT_DADICTIONARY_P_H
0009 
0010 #include <QString>
0011 
0012 #include "iokitdevice.h"
0013 
0014 #include <CoreFoundation/CoreFoundation.h>
0015 #include <DiskArbitration/DiskArbitration.h>
0016 
0017 namespace Solid
0018 {
0019 namespace Backends
0020 {
0021 namespace IOKit
0022 {
0023 class DADictionary
0024 {
0025 public:
0026     DADictionary(const IOKitDevice *device);
0027     virtual ~DADictionary();
0028 
0029     /**
0030      * get a fresh copy of the DA disk description dict;
0031      * the result is stored in daRef (after releasing any
0032      * dict it may currently point to).
0033      */
0034     bool getDict();
0035     /**
0036      * release the DA disk description dict and reset daRef.
0037      */
0038     void releaseDict();
0039 
0040     /**
0041      * fetch the value of @p key as a string, from the current
0042      * disk description (calls getDict() and releaseDict()).
0043      */
0044     const QString stringForKey(const CFStringRef key);
0045     /**
0046      * fetch the value of @p key as a CFURLRef, from the current
0047      * disk description. Calls getDict() but not releaseDict().
0048      *The contents of the CFURLRef must be retrieved before
0049      * calling releaseDict() (and thus getDict()).
0050      */
0051     CFURLRef cfUrLRefForKey(const CFStringRef key);
0052     /**
0053      * fetch the value of @p key as a boolean, from the current
0054      * disk description (calls getDict() and releaseDict()).
0055      */
0056     bool boolForKey(const CFStringRef key, bool &value);
0057 
0058     const IOKitDevice *device;
0059     DASessionRef daSession;
0060     DADiskRef daRef;
0061     CFDictionaryRef daDict;
0062 };
0063 }
0064 }
0065 }
0066 
0067 #endif // SOLID_BACKENDS_IOKIT_DADICTIONARY_P_H