]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSDictionary.h
c5438e9d3ad47f72060dc5e9fd8167e47418acfc
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Copyright (c) 1998-1999 Apple Computer, Inc. All rights reserved.
33 * OSDictionary.h created by rsulack on Wed 17-Sep-1997
34 * OSDictionary.h converted to C++ by gvdl on Fri 1998-10-30
37 #ifndef _IOKIT_IODICTIONARY_H
38 #define _IOKIT_IODICTIONARY_H
40 #include <libkern/c++/OSCollection.h>
50 * This header declares the OSDictionary collection class.
58 * OSDictionary provides an associative store using strings for keys.
61 * OSDictionary is a container for Libkern C++ objects
63 * @link //apple_ref/doc/class/OSMetaClassBase OSMetaClassBase@/link,
64 * in particular @link //apple_ref/doc/class/OSObject OSObject@/link).
65 * Storage and access are associative, based on string-valued keys
66 * (C string, @link //apple_ref/cpp/cl/OSString OSString@/link,
67 * or @link //apple_ref/cpp/cl/OSSymbol OSSymbol@/link).
68 * When adding an object to an OSDictionary, you provide a string identifier,
69 * which can then used to retrieve that object or remove it from the dictionary.
70 * Setting an object with a key that already has an associated object
71 * replaces the original object.
73 * You must generally cast retrieved objects from
74 * @link //apple_ref/cpp/cl/OSObject OSObject@/link
75 * to the desired class using
76 * <code>@link //apple_ref/cpp/macro/OSDynamicCast OSDynamicCast@/link</code>.
77 * This macro returns the object cast to the desired class,
78 * or <code>NULL</code> if the object isn't derived from that class.
80 * When iterating an OSDictionary using
81 * @link //apple_ref/doc/class/OSCollectionIterator OSCollectionIterator@/link,
82 * the objects returned from
83 * <code>@link //apple_ref/doc/function/OSCollectionIterator::getNextObject
84 * getNextObject@/link</code>
85 * are dictionary keys (not the object values for those keys).
86 * You can use the keys to retrieve their associated object values.
88 * As with all Libkern collection classes,
89 * OSDictionary retains keys and objects added to it,
90 * and releases keys and objects removed from it (or replaced).
91 * An OSDictionary also grows as necessary to accommodate new key/value pairs,
92 * <i>unlike</i> Core Foundation collections (it does not, however, shrink).
94 * <b>Note:</b> OSDictionary currently uses a linear search algorithm,
95 * and is not designed for high-performance access of many values.
96 * It is intended as a simple associative-storage mechanism only.
98 * <b>Use Restrictions</b>
100 * With very few exceptions in the I/O Kit, all Libkern-based C++
101 * classes, functions, and macros are <b>unsafe</b>
102 * to use in a primary interrupt context.
103 * Consult the I/O Kit documentation related to primary interrupts
104 * for more information.
106 * OSDictionary provides no concurrency protection;
107 * it's up to the usage context to provide any protection necessary.
108 * Some portions of the I/O Kit, such as
109 * @link //apple_ref/doc/class/IORegistryEntry IORegistryEntry@/link,
110 * handle synchronization via defined member functions for setting
113 class OSDictionary
: public OSCollection
115 friend class OSSerialize
;
117 OSDeclareDefaultStructors(OSDictionary
)
119 #if APPLE_KEXT_ALIGN_CONTAINERS
123 unsigned int capacity
;
124 unsigned int capacityIncrement
;
126 const OSSymbol
* key
;
127 const OSMetaClassBase
* value
;
129 dictEntry
* dictionary
;
131 #else /* APPLE_KEXT_ALIGN_CONTAINERS */
135 const OSSymbol
* key
;
136 const OSMetaClassBase
* value
;
138 dictEntry
* dictionary
;
140 unsigned int capacity
;
141 unsigned int capacityIncrement
;
143 struct ExpansionData
{ };
145 /* Reserved for future use. (Internal use only) */
146 ExpansionData
* reserved
;
148 #endif /* APPLE_KEXT_ALIGN_CONTAINERS */
150 // Member functions used by the OSCollectionIterator class.
151 virtual unsigned int iteratorSize() const APPLE_KEXT_OVERRIDE
;
152 virtual bool initIterator(void * iterator
) const APPLE_KEXT_OVERRIDE
;
153 virtual bool getNextObjectForIterator(void * iterator
, OSObject
** ret
) const APPLE_KEXT_OVERRIDE
;
158 * @function withCapacity
161 * Creates and initializes an empty OSDictionary.
163 * @param capacity The initial storage capacity of the new dictionary object.
166 * An empty instance of OSDictionary
167 * with a retain count of 1;
168 * <code>NULL</code> on failure.
171 * <code>capacity</code> must be nonzero.
172 * The new dictionary will grow as needed to accommodate more key/object pairs
173 * (<i>unlike</i> @link //apple_ref/doc/uid/20001497 CFMutableDictionary@/link,
174 * for which the initial capacity is a hard limit).
176 static OSDictionary
* withCapacity(unsigned int capacity
);
180 * @function withObjects
182 * @abstract Creates and initializes an OSDictionary
183 * populated with keys and objects provided.
185 * @param objects A C array of OSMetaClassBase-derived objects.
186 * @param keys A C array of OSSymbol keys
187 * for the corresponding objects in <code>objects</code>.
188 * @param count The number of keys and objects
189 * to be placed into the dictionary.
190 * @param capacity The initial storage capacity of the new dictionary object.
191 * If 0, <code>count</code> is used; otherwise this value
192 * must be greater than or equal to <code>count</code>.
195 * An instance of OSDictionary
196 * containing the key/object pairs provided,
197 * with a retain count of 1;
198 * <code>NULL</code> on failure.
201 * <code>objects</code> and <code>keys</code> must be non-<code>NULL</code>,
202 * and <code>count</code> must be nonzero.
203 * If <code>capacity</code> is nonzero,
204 * it must be greater than or equal to <code>count</code>.
205 * The new dictionary will grow as needed
206 * to accommodate more key/object pairs
208 * @link //apple_ref/doc/uid/20001497 CFMutableDictionary@/link,
209 * for which the initial capacity is a hard limit).
211 static OSDictionary
* withObjects(
212 const OSObject
* objects
[],
213 const OSSymbol
* keys
[],
215 unsigned int capacity
= 0);
218 * @function withObjects
221 * Creates and initializes an OSDictionary
222 * populated with keys and objects provided.
224 * @param objects A C array of OSMetaClassBase-derived objects.
225 * @param keys A C array of OSString keys for the corresponding objects
226 * in <code>objects</code>.
227 * @param count The number of keys and objects
228 * to be placed into the dictionary.
229 * @param capacity The initial storage capacity of the new dictionary object.
230 * If 0, <code>count</code> is used; otherwise this value
231 * must be greater than or equal to <code>count</code>.
234 * An instance of OSDictionary
235 * containing the key/object pairs provided,
236 * with a retain count of 1;
237 * <code>NULL</code> on failure.
240 * <code>objects</code> and <code>keys</code> must be non-<code>NULL</code>,
241 * and <code>count</code> must be nonzero.
242 * If <code>capacity</code> is nonzero, it must be greater than or equal to <code>count</code>.
243 * The new dictionary will grow as needed
244 * to accommodate more key/object pairs
246 * @link //apple_ref/doc/uid/20001497 CFMutableDictionary@/link,
247 * for which the initial capacity is a hard limit).
249 static OSDictionary
* withObjects(
250 const OSObject
* objects
[],
251 const OSString
* keys
[],
253 unsigned int capacity
= 0);
257 * @function withDictionary
260 * Creates and initializes an OSDictionary
261 * populated with the contents of another dictionary.
263 * @param dict A dictionary whose contents will be stored
264 * in the new instance.
265 * @param capacity The initial storage capacity of the new dictionary object.
266 * If 0, the capacity is set to the number of key/value pairs
267 * in <code>dict</code>;
268 * otherwise <code>capacity</code> must be greater than or equal to
269 * the number of key/value pairs in <code>dict</code>.
272 * An instance of OSDictionary
273 * containing the key/value pairs of <code>dict</code>,
274 * with a retain count of 1;
275 * <code>NULL</code> on failure.
278 * <code>dict</code> must be non-<code>NULL</code>.
279 * If <code>capacity</code> is nonzero, it must be greater than or equal to <code>count</code>.
280 * The new dictionary will grow as needed
281 * to accommodate more key/object pairs
283 * @link //apple_ref/doc/uid/20001497 CFMutableDictionary@/link,
284 * for which the initial capacity is a hard limit).
286 * The keys and objects in <code>dict</code> are retained for storage
287 * in the new OSDictionary,
290 static OSDictionary
* withDictionary(
291 const OSDictionary
* dict
,
292 unsigned int capacity
= 0);
296 * @function initWithCapacity
299 * Initializes a new instance of OSDictionary.
301 * @param capacity The initial storage capacity of the new dictionary object.
303 * <code>true</code> on success, <code>false</code> on failure.
306 * Not for general use. Use the static instance creation method
307 * <code>@link //apple_ref/cpp/clm/OSDictionary/withCapacity/staticOSDictionary*\/(unsignedint)
308 * withCapacity@/link</code>
311 * <code>capacity</code> must be nonzero.
312 * The new dictionary will grow as needed
313 * to accommodate more key/object pairs
315 * @link //apple_ref/doc/uid/20001497 CFMutableDictionary@/link,
316 * for which the initial capacity is a hard limit).
318 virtual bool initWithCapacity(unsigned int capacity
);
322 * @function initWithObjects
324 * @abstract Initializes a new OSDictionary with keys and objects provided.
326 * @param objects A C array of OSMetaClassBase-derived objects.
327 * @param keys A C array of OSSymbol keys
328 * for the corresponding objects in <code>objects</code>.
329 * @param count The number of keys and objects to be placed
330 * into the dictionary.
331 * @param capacity The initial storage capacity of the new dictionary object.
332 * If 0, <code>count</code> is used; otherwise this value
333 * must be greater than or equal to <code>count</code>.
336 * <code>true</code> on success, <code>false</code> on failure.
339 * Not for general use. Use the static instance creation method
341 * //apple_ref/cpp/clm/OSDictionary/withObjects/staticOSDictionary*\/(constOSObject*,constOSString*,unsignedint,unsignedint)
342 * withObjects@/link</code>
345 * <code>objects</code> and <code>keys</code> must be non-<code>NULL</code>,
346 * and <code>count</code> must be nonzero.
347 * If <code>capacity</code> is nonzero,
348 * it must be greater than or equal to <code>count</code>.
349 * The new dictionary will grow as neede
350 * to accommodate more key/object pairs
352 * @link //apple_ref/doc/uid/20001497 CFMutableDictionary@/link,
353 * for which the initial capacity is a hard limit).
355 virtual bool initWithObjects(
356 const OSObject
* objects
[],
357 const OSSymbol
* keys
[],
359 unsigned int capacity
= 0);
363 * @function initWithObjects
366 * Initializes a new OSDictionary with keys and objects provided.
368 * @param objects A C array of OSMetaClassBase-derived objects.
369 * @param keys A C array of OSString keys
370 * for the corresponding objects in <code>objects</code>.
371 * @param count The number of keys and objects
372 * to be placed into the dictionary.
373 * @param capacity The initial storage capacity of the new dictionary object.
374 * If 0, <code>count</code> is used; otherwise this value
375 * must be greater than or equal to <code>count</code>.
378 * <code>true</code> on success, <code>false</code> on failure.
381 * Not for general use. Use the static instance creation method
383 * //apple_ref/cpp/clm/OSDictionary/withObjects/staticOSDictionary*\/(constOSObject*,constOSString*,unsignedint,unsignedint)
384 * withObjects@/link</code>
387 * <code>objects</code> and <code>keys</code> must be non-<code>NULL</code>,
388 * and <code>count</code> must be nonzero.
389 * If <code>capacity</code> is nonzero, it must be greater than or equal to <code>count</code>.
390 * The new dictionary will grow as needed
391 * to accommodate more key/object pairs
393 * @link //apple_ref/doc/uid/20001497 CFMutableDictionary@/link,
394 * for which the initial capacity is a hard limit).
396 virtual bool initWithObjects(
397 const OSObject
* objects
[],
398 const OSString
* keys
[],
400 unsigned int capacity
= 0);
404 * @function initWithDictionary
407 * Initializes a new OSDictionary
408 * with the contents of another dictionary.
410 * @param dict A dictionary whose contents will be placed
411 * in the new instance.
412 * @param capacity The initial storage capacity of the new dictionary object.
413 * If 0, the capacity is set to the number of key/value pairs
414 * in <code>dict</code>;
415 * otherwise <code>capacity</code> must be greater than or equal to
416 * the number of key/value pairs in <code>dict</code>.
419 * <code>true</code> on success, <code>false</code> on failure.
422 * Not for general use. Use the static instance creation method
423 * <code>@link withDictionary withDictionary@/link</code> instead.
425 * <code>dict</code> must be non-<code>NULL</code>.
426 * If <code>capacity</code> is nonzero,
427 * it must be greater than or equal to <code>count</code>.
428 * The new dictionary will grow as needed
429 * to accommodate more key/object pairs
431 * @link //apple_ref/doc/uid/20001497 CFMutableDictionary@/link,
432 * for which the initial capacity is a hard limit).
434 * The keys and objects in <code>dict</code> are retained for storage
435 * in the new OSDictionary,
438 virtual bool initWithDictionary(
439 const OSDictionary
* dict
,
440 unsigned int capacity
= 0);
447 * Deallocates or releases any resources
448 * used by the OSDictionary instance.
451 * This function should not be called directly,
454 * //apple_ref/cpp/instm/OSObject/release/virtualvoid/()
455 * release@/link</code>
458 virtual void free() APPLE_KEXT_OVERRIDE
;
465 * Returns the current number of key/object pairs
466 * contained within the dictionary.
469 * The current number of key/object pairs
470 * contained within the dictionary.
472 virtual unsigned int getCount() const APPLE_KEXT_OVERRIDE
;
476 * @function getCapacity
479 * Returns the number of objects the dictionary can store without reallocating.
482 * The number objects the dictionary can store without reallocating.
485 * OSDictionary objects grow when full
486 * to accommodate additional key/object pairs.
489 * //apple_ref/cpp/instm/OSDictionary/getCapacityIncrement/virtualunsignedint/()
490 * getCapacityIncrement@/link</code>
493 * //apple_ref/cpp/instm/OSDictionary/ensureCapacity/virtualunsignedint/(unsignedint)
494 * ensureCapacity@/link</code>.
496 virtual unsigned int getCapacity() const APPLE_KEXT_OVERRIDE
;
500 * @function getCapacityIncrement
503 * Returns the storage increment of the dictionary.
506 * The storage increment of the dictionary.
509 * An OSDictionary allocates storage for key/object pairs in multiples
510 * of the capacity increment.
512 virtual unsigned int getCapacityIncrement() const APPLE_KEXT_OVERRIDE
;
516 * @function setCapacityIncrement
519 * Sets the storage increment of the dictionary.
522 * The new storage increment of the dictionary,
523 * which may be different from the number requested.
526 * An OSDictionary allocates storage for key/object pairs in multiples
527 * of the capacity increment.
528 * Calling this function does not immediately reallocate storage.
530 virtual unsigned int setCapacityIncrement(unsigned increment
) APPLE_KEXT_OVERRIDE
;
534 * @function ensureCapacity
537 * Ensures the dictionary has enough space
538 * to store the requested number of key/object pairs.
540 * @param newCapacity The total number of key/object pairs the dictionary
541 * should be able to store.
544 * The new capacity of the dictionary,
545 * which may be different from the number requested
546 * (if smaller, reallocation of storage failed).
549 * This function immediately resizes the dictionary, if necessary,
550 * to accommodate at least <code>newCapacity</code> key/object pairs.
551 * If <code>newCapacity</code> is not greater than the current capacity,
552 * or if an allocation error occurs, the original capacity is returned.
554 * There is no way to reduce the capacity of an OSDictionary.
556 virtual unsigned int ensureCapacity(unsigned int newCapacity
) APPLE_KEXT_OVERRIDE
;
560 * @function flushCollection
563 * Removes and releases all keys and objects within the dictionary.
566 * The dictionary's capacity (and therefore direct memory consumption)
567 * is not reduced by this function.
569 virtual void flushCollection() APPLE_KEXT_OVERRIDE
;
573 * @function setObject
576 * Stores an object in the dictionary under a key.
578 * @param aKey An OSSymbol identifying the object
579 * placed within the dictionary.
580 * It is automatically retained.
581 * @param anObject The object to be stored in the dictionary.
582 * It is automatically retained.
585 * <code>true</code> if the addition was successful,
586 * <code>false</code> otherwise.
589 * An object already stored under <code>aKey</code> is released.
591 virtual bool setObject(
592 const OSSymbol
* aKey
,
593 const OSMetaClassBase
* anObject
);
597 * @function setObject
599 * @abstract Stores an object in the dictionary under a key.
601 * @param aKey An OSString identifying the object
602 * placed within the dictionary.
603 * @param anObject The object to be stored in the dictionary.
604 * It is automatically retained.
607 * <code>true</code> if the addition was successful,
608 * <code>false</code> otherwise.
611 * An OSSymbol for <code>aKey</code> is created internally.
612 * An object already stored under <code>aKey</code> is released.
614 virtual bool setObject(
615 const OSString
* aKey
,
616 const OSMetaClassBase
* anObject
);
620 * @function setObject
623 * Stores an object in the dictionary under a key.
625 * @param aKey A C string identifying the object
626 * placed within the dictionary.
627 * @param anObject The object to be stored in the dictionary.
628 * It is automatically retained.
631 * <code>true</code> if the addition was successful,
632 * <code>false</code> otherwise.
635 * An OSSymbol for <code>aKey</code> is created internally.
636 * An object already stored under <code>aKey</code> is released.
638 virtual bool setObject(
640 const OSMetaClassBase
* anObject
);
644 * @function removeObject
647 * Removes a key/object pair from the dictionary.
649 * @param aKey An OSSymbol identifying the object
650 * to be removed from the dictionary.
653 * The removed key (not necessarily <code>aKey</code> itself)
654 * and object are automatically released.
656 virtual void removeObject(const OSSymbol
* aKey
);
660 * @function removeObject
663 * Removes a key/object pair from the dictionary.
665 * @param aKey A OSString identifying the object
666 * to be removed from the dictionary.
669 * The removed key (not necessarily <code>aKey</code> itself)
670 * and object are automatically released.
672 virtual void removeObject(const OSString
* aKey
);
676 * @function removeObject
679 * Removes a key/object pair from the dictionary.
681 * @param aKey A C string identifying the object
682 * to be removed from the dictionary.
685 * The removed key (internally an OSSymbol)
686 * and object are automatically released.
688 virtual void removeObject(const char * aKey
);
695 * Merges the contents of a dictionary into the receiver.
697 * @param aDictionary The dictionary whose contents
698 * are to be merged with the receiver.
700 * <code>true</code> if the merge succeeds, <code>false</code> otherwise.
703 * If there are keys in <code>aDictionary</code> that match keys
704 * in the receiving dictionary,
705 * then the objects in the receiver are replaced
706 * by those from <code>aDictionary</code>,
707 * and the replaced objects are released.
709 virtual bool merge(const OSDictionary
* aDictionary
);
713 * @function getObject
716 * Returns the object stored under a given key.
718 * @param aKey An OSSymbol key identifying the object
719 * to be returned to the caller.
722 * The object stored under <code>aKey</code>,
723 * or <code>NULL</code> if the key does not exist in the dictionary.
726 * The returned object will be released if removed from the dictionary;
727 * if you plan to store the reference, you should call
729 * //apple_ref/cpp/instm/OSObject/retain/virtualvoid/()
730 * retain@/link</code>
733 virtual OSObject
* getObject(const OSSymbol
* aKey
) const;
737 * @function getObject
739 * @abstract Returns the object stored under a given key.
741 * @param aKey An OSString key identifying the object
742 * to be returned to caller.
745 * The object stored under <code>aKey</code>,
746 * or <code>NULL</code> if the key does not exist in the dictionary.
749 * The returned object will be released if removed from the dictionary;
750 * if you plan to store the reference, you should call
752 * //apple_ref/cpp/instm/OSObject/retain/virtualvoid/()
753 * retain@/link</code>
756 virtual OSObject
* getObject(const OSString
* aKey
) const;
760 * @function getObject
763 * Returns the object stored under a given key.
765 * @param aKey A C string key identifying the object
766 * to be returned to caller.
769 * The object stored under <code>aKey</code>,
770 * or <code>NULL</code> if the key does not exist in the dictionary.
773 * The returned object will be released if removed from the dictionary;
774 * if you plan to store the reference, you should call
776 * //apple_ref/cpp/instm/OSObject/retain/virtualvoid/()
777 * retain@/link</code>
780 virtual OSObject
* getObject(const char * aKey
) const;
784 * @function isEqualTo
786 * @abstract Tests the equality of two OSDictionary objects
787 * over a subset of keys.
789 * @param aDictionary The dictionary to be compared against the receiver.
790 * @param keys An OSArray or OSDictionary containing the keys
791 * (as @link //apple_ref/cpp/cl/OSString OSStrings@/link or
792 * @link //apple_ref/cpp/cl/OSSymbol OSSymbols@/link)
793 * describing the intersection for the comparison.
796 * <code>true</code> if the intersections
797 * of the two dictionaries are equal.
800 * Two OSDictionary objects are considered equal by this function
801 * if both have objects stored for all keys provided,
802 * and if the objects stored in each under
803 * a given key compare as equal using
805 * //apple_ref/cpp/instm/OSMetaClassBase/isEqualTo/virtualbool/(constOSMetaClassBase*)
806 * isEqualTo@/link</code>.
808 virtual bool isEqualTo(
809 const OSDictionary
* aDictionary
,
810 const OSCollection
* keys
) const;
814 * @function isEqualTo
816 * @abstract Tests the equality of two OSDictionary objects.
818 * @param aDictionary The dictionary to be compared against the receiver.
821 * <code>true</code> if the dictionaries are equal,
822 * <code>false</code> if not.
825 * Two OSDictionary objects are considered equal if they have same count,
826 * the same keys, and if the objects stored in each under
827 * a given key compare as equal using
829 * //apple_ref/cpp/instm/OSMetaClassBase/isEqualTo/virtualbool/(constOSMetaClassBase*)
830 * isEqualTo@/link</code>.
832 virtual bool isEqualTo(const OSDictionary
* aDictionary
) const;
836 * @function isEqualTo
839 * Tests the equality of an OSDictionary to an arbitrary object.
841 * @param anObject An object to be compared against the receiver.
844 * <code>true</code> if the objects are equal.
847 * An OSDictionary is considered equal to another object
848 * if that object is derived from OSDictionary
849 * and contains the same or equivalent objects.
851 virtual bool isEqualTo(const OSMetaClassBase
* anObject
) const APPLE_KEXT_OVERRIDE
;
855 * @function serialize
858 * Archives the receiver into the provided
859 * @link //apple_ref/doc/class/OSSerialize OSSerialize@/link object.
861 * @param serializer The OSSerialize object.
864 * <code>true</code> if serialization succeeds, <code>false</code> if not.
866 virtual bool serialize(OSSerialize
* serializer
) const APPLE_KEXT_OVERRIDE
;
870 * @function setOptions
873 * Recursively sets option bits in the dictionary
874 * and all child collections.
876 * @param options A bitfield whose values turn the options on (1) or off (0).
877 * @param mask A mask indicating which bits
878 * in <code>options</code> to change.
879 * Pass 0 to get the whole current options bitfield
880 * without changing any settings.
881 * @param context Unused.
884 * The options bitfield as it was before the set operation.
887 * Kernel extensions should not call this function.
889 * Child collections' options are changed only if the receiving dictionary's
890 * options actually change.
892 virtual unsigned setOptions(
895 void * context
= 0) APPLE_KEXT_OVERRIDE
;
899 * @function copyCollection
902 * Creates a deep copy of the dictionary
903 * and its child collections.
905 * @param cycleDict A dictionary of all of the collections
906 * that have been copied so far,
907 * which is used to track circular references.
908 * To start the copy at the top level,
909 * pass <code>NULL</code>.
912 * The newly copied dictionary, with a retain count of 1,
913 * or <code>NULL</code> if there is insufficient memory to do the copy.
916 * The receiving dictionary, and any collections it contains, recursively,
918 * Objects that are not derived from OSCollection are retained
919 * rather than copied.
921 OSCollection
* copyCollection(OSDictionary
* cycleDict
= 0) APPLE_KEXT_OVERRIDE
;
923 #if XNU_KERNEL_PRIVATE
924 bool setObject(const OSSymbol
*aKey
, const OSMetaClassBase
*anObject
, bool onlyAdd
);
925 OSArray
* copyKeys(void);
926 #endif /* XNU_KERNEL_PRIVATE */
928 OSMetaClassDeclareReservedUnused(OSDictionary
, 0);
929 OSMetaClassDeclareReservedUnused(OSDictionary
, 1);
930 OSMetaClassDeclareReservedUnused(OSDictionary
, 2);
931 OSMetaClassDeclareReservedUnused(OSDictionary
, 3);
932 OSMetaClassDeclareReservedUnused(OSDictionary
, 4);
933 OSMetaClassDeclareReservedUnused(OSDictionary
, 5);
934 OSMetaClassDeclareReservedUnused(OSDictionary
, 6);
935 OSMetaClassDeclareReservedUnused(OSDictionary
, 7);
938 #endif /* !_IOKIT_IODICTIONARY_H */