1*5c2921b0SApple OSS Distributions /* 2*5c2921b0SApple OSS Distributions * Copyright (c) 2019 Apple Inc. All rights reserved. 3*5c2921b0SApple OSS Distributions * 4*5c2921b0SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*5c2921b0SApple OSS Distributions * 6*5c2921b0SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*5c2921b0SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*5c2921b0SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*5c2921b0SApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*5c2921b0SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*5c2921b0SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*5c2921b0SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*5c2921b0SApple OSS Distributions * terms of an Apple operating system software license agreement. 14*5c2921b0SApple OSS Distributions * 15*5c2921b0SApple OSS Distributions * Please obtain a copy of the License at 16*5c2921b0SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*5c2921b0SApple OSS Distributions * 18*5c2921b0SApple OSS Distributions * The Original Code and all software distributed under the License are 19*5c2921b0SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*5c2921b0SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*5c2921b0SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*5c2921b0SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*5c2921b0SApple OSS Distributions * Please see the License for the specific language governing rights and 24*5c2921b0SApple OSS Distributions * limitations under the License. 25*5c2921b0SApple OSS Distributions * 26*5c2921b0SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*5c2921b0SApple OSS Distributions */ 28*5c2921b0SApple OSS Distributions /* IOSymbol.h created by gvdl on Fri 1998-10-30 */ 29*5c2921b0SApple OSS Distributions /* OSSymbol must be created through the factory methods and thus is not subclassable. */ 30*5c2921b0SApple OSS Distributions 31*5c2921b0SApple OSS Distributions #ifndef _OS_OSSYMBOL_H 32*5c2921b0SApple OSS Distributions #define _OS_OSSYMBOL_H 33*5c2921b0SApple OSS Distributions 34*5c2921b0SApple OSS Distributions #include <libkern/c++/OSString.h> 35*5c2921b0SApple OSS Distributions #include <libkern/c++/OSPtr.h> 36*5c2921b0SApple OSS Distributions 37*5c2921b0SApple OSS Distributions class OSSymbol; 38*5c2921b0SApple OSS Distributions 39*5c2921b0SApple OSS Distributions typedef OSSymbol* OSSymbolPtr; 40*5c2921b0SApple OSS Distributions typedef OSSymbol const* OSSymbolConstPtr; 41*5c2921b0SApple OSS Distributions 42*5c2921b0SApple OSS Distributions /*! 43*5c2921b0SApple OSS Distributions * @header 44*5c2921b0SApple OSS Distributions * 45*5c2921b0SApple OSS Distributions * @abstract 46*5c2921b0SApple OSS Distributions * This header declares the OSSymbol container class. 47*5c2921b0SApple OSS Distributions */ 48*5c2921b0SApple OSS Distributions 49*5c2921b0SApple OSS Distributions // xx-review: OSSymbol does not override setChar 50*5c2921b0SApple OSS Distributions 51*5c2921b0SApple OSS Distributions /*! 52*5c2921b0SApple OSS Distributions * @class OSSymbol 53*5c2921b0SApple OSS Distributions * 54*5c2921b0SApple OSS Distributions * @abstract 55*5c2921b0SApple OSS Distributions * OSSymbol wraps a C string in a unique C++ object 56*5c2921b0SApple OSS Distributions * for use as keys in Libkern collections. 57*5c2921b0SApple OSS Distributions * 58*5c2921b0SApple OSS Distributions * @discussion 59*5c2921b0SApple OSS Distributions * OSSymbol is a container class for managing uniqued strings, 60*5c2921b0SApple OSS Distributions * for example, those used as dictionary keys. 61*5c2921b0SApple OSS Distributions * Its static instance-creation functions check 62*5c2921b0SApple OSS Distributions * for an existing instance of OSSymbol 63*5c2921b0SApple OSS Distributions * with the requested C string value before creating a new object. 64*5c2921b0SApple OSS Distributions * If an instance already exists in the pool of unique symbols, 65*5c2921b0SApple OSS Distributions * its reference count is incremented 66*5c2921b0SApple OSS Distributions * and the existing instance is returned. 67*5c2921b0SApple OSS Distributions * 68*5c2921b0SApple OSS Distributions * While OSSymbol provides for uniquing of a given string value, 69*5c2921b0SApple OSS Distributions * it makes no effort to enforce immutability of that value. 70*5c2921b0SApple OSS Distributions * Altering the contents of an OSSymbol should be avoided. 71*5c2921b0SApple OSS Distributions * 72*5c2921b0SApple OSS Distributions * <b>Use Restrictions</b> 73*5c2921b0SApple OSS Distributions * 74*5c2921b0SApple OSS Distributions * With very few exceptions in the I/O Kit, all Libkern-based C++ 75*5c2921b0SApple OSS Distributions * classes, functions, and macros are <b>unsafe</b> 76*5c2921b0SApple OSS Distributions * to use in a primary interrupt context. 77*5c2921b0SApple OSS Distributions * Consult the I/O Kit documentation related to primary interrupts 78*5c2921b0SApple OSS Distributions * for more information. 79*5c2921b0SApple OSS Distributions * 80*5c2921b0SApple OSS Distributions * OSSymbol provides no concurrency protection; 81*5c2921b0SApple OSS Distributions * it's up to the usage context to provide any protection necessary. 82*5c2921b0SApple OSS Distributions * Some portions of the I/O Kit, such as 83*5c2921b0SApple OSS Distributions * @link //apple_ref/doc/class/IORegistryEntry IORegistryEntry@/link, 84*5c2921b0SApple OSS Distributions * handle synchronization via defined member functions for setting 85*5c2921b0SApple OSS Distributions * properties. 86*5c2921b0SApple OSS Distributions */ 87*5c2921b0SApple OSS Distributions class OSSymbol : public OSString 88*5c2921b0SApple OSS Distributions { 89*5c2921b0SApple OSS Distributions friend class OSSymbolPool; 90*5c2921b0SApple OSS Distributions 91*5c2921b0SApple OSS Distributions OSDeclareAbstractStructors(OSSymbol); 92*5c2921b0SApple OSS Distributions 93*5c2921b0SApple OSS Distributions private: 94*5c2921b0SApple OSS Distributions 95*5c2921b0SApple OSS Distributions static void initialize(); 96*5c2921b0SApple OSS Distributions 97*5c2921b0SApple OSS Distributions /*! 98*5c2921b0SApple OSS Distributions * @function initWithString 99*5c2921b0SApple OSS Distributions * 100*5c2921b0SApple OSS Distributions * @abstract 101*5c2921b0SApple OSS Distributions * Overridden to prevent creation of duplicate symbols. 102*5c2921b0SApple OSS Distributions * 103*5c2921b0SApple OSS Distributions * @param aString Unused. 104*5c2921b0SApple OSS Distributions * 105*5c2921b0SApple OSS Distributions * @result 106*5c2921b0SApple OSS Distributions * <code>false</code>. 107*5c2921b0SApple OSS Distributions * 108*5c2921b0SApple OSS Distributions * @discussion 109*5c2921b0SApple OSS Distributions * Overrides OSString's implementation to prevent creation 110*5c2921b0SApple OSS Distributions * of distinct OSSymbols with the same string value. 111*5c2921b0SApple OSS Distributions */ 112*5c2921b0SApple OSS Distributions virtual bool initWithString(const OSString * aString) APPLE_KEXT_OVERRIDE; 113*5c2921b0SApple OSS Distributions 114*5c2921b0SApple OSS Distributions 115*5c2921b0SApple OSS Distributions /*! 116*5c2921b0SApple OSS Distributions * @function initWithCString 117*5c2921b0SApple OSS Distributions * 118*5c2921b0SApple OSS Distributions * @abstract 119*5c2921b0SApple OSS Distributions * Overridden to prevent creation of duplicate symbols. 120*5c2921b0SApple OSS Distributions * 121*5c2921b0SApple OSS Distributions * @param cString Unused. 122*5c2921b0SApple OSS Distributions * 123*5c2921b0SApple OSS Distributions * @result 124*5c2921b0SApple OSS Distributions * <code>false</code>. 125*5c2921b0SApple OSS Distributions * 126*5c2921b0SApple OSS Distributions * @discussion 127*5c2921b0SApple OSS Distributions * Overrides OSString's implementation to prevent creation 128*5c2921b0SApple OSS Distributions * of distinct OSSymbols with the same string value. 129*5c2921b0SApple OSS Distributions */ 130*5c2921b0SApple OSS Distributions virtual bool initWithCString(const char * cString) APPLE_KEXT_OVERRIDE; 131*5c2921b0SApple OSS Distributions 132*5c2921b0SApple OSS Distributions 133*5c2921b0SApple OSS Distributions /*! 134*5c2921b0SApple OSS Distributions * @function initWithCStringNoCopy 135*5c2921b0SApple OSS Distributions * 136*5c2921b0SApple OSS Distributions * @abstract 137*5c2921b0SApple OSS Distributions * Overridden to prevent creation of duplicate symbols. 138*5c2921b0SApple OSS Distributions * 139*5c2921b0SApple OSS Distributions * @param cString Unused. 140*5c2921b0SApple OSS Distributions * 141*5c2921b0SApple OSS Distributions * @result 142*5c2921b0SApple OSS Distributions * <code>false</code>. 143*5c2921b0SApple OSS Distributions * 144*5c2921b0SApple OSS Distributions * @discussion 145*5c2921b0SApple OSS Distributions * Overrides OSString's implementation to prevent creation 146*5c2921b0SApple OSS Distributions * of distinct OSSymbols with the same string value. 147*5c2921b0SApple OSS Distributions */ 148*5c2921b0SApple OSS Distributions virtual bool initWithCStringNoCopy(const char *cString) APPLE_KEXT_OVERRIDE; 149*5c2921b0SApple OSS Distributions 150*5c2921b0SApple OSS Distributions protected: 151*5c2921b0SApple OSS Distributions 152*5c2921b0SApple OSS Distributions // xx-review: should we just omit this from headerdoc? 153*5c2921b0SApple OSS Distributions /*! 154*5c2921b0SApple OSS Distributions * @function taggedRelease 155*5c2921b0SApple OSS Distributions * 156*5c2921b0SApple OSS Distributions * @abstract 157*5c2921b0SApple OSS Distributions * Overrides 158*5c2921b0SApple OSS Distributions * <code>@link 159*5c2921b0SApple OSS Distributions * //apple_ref/cpp/instm/OSObject/taggedRelease/virtualvoid/(constvoid*,constint) 160*5c2921b0SApple OSS Distributions * OSObject::taggedRelease(const void *, const int)@/link</code> 161*5c2921b0SApple OSS Distributions * to synchronize with the symbol pool. 162*5c2921b0SApple OSS Distributions * 163*5c2921b0SApple OSS Distributions * @param tag Used for tracking collection references. 164*5c2921b0SApple OSS Distributions * @param freeWhen If decrementing the reference count makes it 165*5c2921b0SApple OSS Distributions * >= <code>freeWhen</code>, the object is immediately freed. 166*5c2921b0SApple OSS Distributions * 167*5c2921b0SApple OSS Distributions * @discussion 168*5c2921b0SApple OSS Distributions * Because OSSymbol shares instances, the reference-counting functions 169*5c2921b0SApple OSS Distributions * must synchronize access to the class-internal tables 170*5c2921b0SApple OSS Distributions * used to track those instances. 171*5c2921b0SApple OSS Distributions */ 172*5c2921b0SApple OSS Distributions virtual void taggedRelease( 173*5c2921b0SApple OSS Distributions const void * tag, 174*5c2921b0SApple OSS Distributions const int freeWhen) const APPLE_KEXT_OVERRIDE; 175*5c2921b0SApple OSS Distributions 176*5c2921b0SApple OSS Distributions 177*5c2921b0SApple OSS Distributions // xx-review: should we just omit this from headerdoc? 178*5c2921b0SApple OSS Distributions /*! 179*5c2921b0SApple OSS Distributions * @function free 180*5c2921b0SApple OSS Distributions * 181*5c2921b0SApple OSS Distributions * @abstract 182*5c2921b0SApple OSS Distributions * Overrides 183*5c2921b0SApple OSS Distributions * <code>@link 184*5c2921b0SApple OSS Distributions * //apple_ref/cpp/instm/OSObject/free/virtualvoid/() 185*5c2921b0SApple OSS Distributions * OSObject::free@/link</code> 186*5c2921b0SApple OSS Distributions * to synchronize with the symbol pool. 187*5c2921b0SApple OSS Distributions * 188*5c2921b0SApple OSS Distributions * @discussion 189*5c2921b0SApple OSS Distributions * Because OSSymbol shares instances, the reference-counting functions 190*5c2921b0SApple OSS Distributions * must synchronize access to the class-internal tables 191*5c2921b0SApple OSS Distributions * used to track those instances. 192*5c2921b0SApple OSS Distributions */ 193*5c2921b0SApple OSS Distributions virtual void free() APPLE_KEXT_OVERRIDE; 194*5c2921b0SApple OSS Distributions 195*5c2921b0SApple OSS Distributions public: 196*5c2921b0SApple OSS Distributions 197*5c2921b0SApple OSS Distributions // xx-review: should we just omit this from headerdoc? 198*5c2921b0SApple OSS Distributions /*! 199*5c2921b0SApple OSS Distributions * @function taggedRelease 200*5c2921b0SApple OSS Distributions * 201*5c2921b0SApple OSS Distributions * @abstract 202*5c2921b0SApple OSS Distributions * Overrides 203*5c2921b0SApple OSS Distributions * <code>@link 204*5c2921b0SApple OSS Distributions * //apple_ref/cpp/instm/OSObject/taggedRelease/virtualvoid/(constvoid*) 205*5c2921b0SApple OSS Distributions * OSObject::taggedRelease(const void *)@/link</code> 206*5c2921b0SApple OSS Distributions * to synchronize with the symbol pool. 207*5c2921b0SApple OSS Distributions * 208*5c2921b0SApple OSS Distributions * @param tag Used for tracking collection references. 209*5c2921b0SApple OSS Distributions * 210*5c2921b0SApple OSS Distributions * @discussion 211*5c2921b0SApple OSS Distributions * Because OSSymbol shares instances, the reference-counting functions 212*5c2921b0SApple OSS Distributions * must synchronize access to the class-internal tables 213*5c2921b0SApple OSS Distributions * used to track those instances. 214*5c2921b0SApple OSS Distributions */ 215*5c2921b0SApple OSS Distributions 216*5c2921b0SApple OSS Distributions /* Original note (not for headerdoc): 217*5c2921b0SApple OSS Distributions * The C++ language has forced me to override this method 218*5c2921b0SApple OSS Distributions * even though I have implemented it as 219*5c2921b0SApple OSS Distributions * <code>{ super::taggedRelease(tag) }</code>. 220*5c2921b0SApple OSS Distributions * It seems that C++ is confused about the appearance of the protected 221*5c2921b0SApple OSS Distributions * taggedRelease with 2 parameters and refuses to only inherit one function. 222*5c2921b0SApple OSS Distributions * See 223*5c2921b0SApple OSS Distributions * <code>@link 224*5c2921b0SApple OSS Distributions * //apple_ref/cpp/instm/OSObject/taggedRelease/virtualvoid/(constvoid*,constint) 225*5c2921b0SApple OSS Distributions * OSObject::taggedRelease(const void *, const int)@/link</code>. 226*5c2921b0SApple OSS Distributions */ 227*5c2921b0SApple OSS Distributions virtual void taggedRelease(const void * tag) const APPLE_KEXT_OVERRIDE; 228*5c2921b0SApple OSS Distributions 229*5c2921b0SApple OSS Distributions 230*5c2921b0SApple OSS Distributions /*! 231*5c2921b0SApple OSS Distributions * @function withString 232*5c2921b0SApple OSS Distributions * 233*5c2921b0SApple OSS Distributions * @abstract 234*5c2921b0SApple OSS Distributions * Returns an OSSymbol created from an OSString, 235*5c2921b0SApple OSS Distributions * or the existing unique instance of the same value. 236*5c2921b0SApple OSS Distributions * 237*5c2921b0SApple OSS Distributions * @param aString The OSString object to look up or copy. 238*5c2921b0SApple OSS Distributions * 239*5c2921b0SApple OSS Distributions * @result 240*5c2921b0SApple OSS Distributions * An instance of OSSymbol 241*5c2921b0SApple OSS Distributions * representing the same characters as <code>aString</code>; 242*5c2921b0SApple OSS Distributions * <code>NULL</code> on failure. 243*5c2921b0SApple OSS Distributions * 244*5c2921b0SApple OSS Distributions * @discussion 245*5c2921b0SApple OSS Distributions * This function creates or returns the unique OSSymbol instance 246*5c2921b0SApple OSS Distributions * representing the string value of <code>aString</code>. 247*5c2921b0SApple OSS Distributions * You can compare it with other OSSymbols using the <code>==</code> operator. 248*5c2921b0SApple OSS Distributions * 249*5c2921b0SApple OSS Distributions * OSSymbols are reference-counted normally. 250*5c2921b0SApple OSS Distributions * This function either returns a 251*5c2921b0SApple OSS Distributions * new OSSymbol with a retain count of 1, 252*5c2921b0SApple OSS Distributions * or increments the retain count of the existing instance. 253*5c2921b0SApple OSS Distributions */ 254*5c2921b0SApple OSS Distributions static OSPtr<const OSSymbol> withString(const OSString * aString); 255*5c2921b0SApple OSS Distributions 256*5c2921b0SApple OSS Distributions 257*5c2921b0SApple OSS Distributions /*! 258*5c2921b0SApple OSS Distributions * @function withCString 259*5c2921b0SApple OSS Distributions * 260*5c2921b0SApple OSS Distributions * @abstract 261*5c2921b0SApple OSS Distributions * Returns an OSSymbol created from a C string, 262*5c2921b0SApple OSS Distributions * or the existing unique instance of the same value. 263*5c2921b0SApple OSS Distributions * 264*5c2921b0SApple OSS Distributions * @param cString The C string to look up or copy. 265*5c2921b0SApple OSS Distributions * 266*5c2921b0SApple OSS Distributions * @result 267*5c2921b0SApple OSS Distributions * An instance of OSSymbol representing 268*5c2921b0SApple OSS Distributions * the same characters as <code>cString</code>; 269*5c2921b0SApple OSS Distributions * <code>NULL</code> on failure. 270*5c2921b0SApple OSS Distributions * 271*5c2921b0SApple OSS Distributions * @discussion 272*5c2921b0SApple OSS Distributions * This function returns the unique OSSymbol instance 273*5c2921b0SApple OSS Distributions * representing the string value of <code>cString</code>. 274*5c2921b0SApple OSS Distributions * You can compare it with other OSSymbols using the <code>==</code> operator. 275*5c2921b0SApple OSS Distributions * 276*5c2921b0SApple OSS Distributions * OSSymbols are reference-counted normally. 277*5c2921b0SApple OSS Distributions * This function either returns a 278*5c2921b0SApple OSS Distributions * new OSSymbol with a retain count of 1, 279*5c2921b0SApple OSS Distributions * or increments the retain count of the existing instance. 280*5c2921b0SApple OSS Distributions */ 281*5c2921b0SApple OSS Distributions static OSPtr<const OSSymbol> withCString(const char * cString); 282*5c2921b0SApple OSS Distributions 283*5c2921b0SApple OSS Distributions 284*5c2921b0SApple OSS Distributions /*! 285*5c2921b0SApple OSS Distributions * @function withCStringNoCopy 286*5c2921b0SApple OSS Distributions * 287*5c2921b0SApple OSS Distributions * @abstract 288*5c2921b0SApple OSS Distributions * Returns an OSSymbol created from a C string, 289*5c2921b0SApple OSS Distributions * without copying that string, 290*5c2921b0SApple OSS Distributions * or the existing unique instance of the same value. 291*5c2921b0SApple OSS Distributions * 292*5c2921b0SApple OSS Distributions * @param cString The C string to look up or use. 293*5c2921b0SApple OSS Distributions * @result 294*5c2921b0SApple OSS Distributions * An instance of OSSymbol representing 295*5c2921b0SApple OSS Distributions * the same characters as <code>cString</code>; 296*5c2921b0SApple OSS Distributions * <code>NULL</code>. 297*5c2921b0SApple OSS Distributions * 298*5c2921b0SApple OSS Distributions * @discussion 299*5c2921b0SApple OSS Distributions * Avoid using this function; 300*5c2921b0SApple OSS Distributions * OSSymbols should own their internal string buffers. 301*5c2921b0SApple OSS Distributions * 302*5c2921b0SApple OSS Distributions * This function returns the unique OSSymbol instance 303*5c2921b0SApple OSS Distributions * representing the string value of <code>cString</code>. 304*5c2921b0SApple OSS Distributions * You can compare it with other OSSymbols using the <code>==</code> operator. 305*5c2921b0SApple OSS Distributions * 306*5c2921b0SApple OSS Distributions * OSSymbols are reference-counted normally. 307*5c2921b0SApple OSS Distributions * This function either returns a 308*5c2921b0SApple OSS Distributions * new OSSymbol with a retain count of 1, 309*5c2921b0SApple OSS Distributions * or increments the retain count of the existing instance. 310*5c2921b0SApple OSS Distributions */ 311*5c2921b0SApple OSS Distributions static OSPtr<const OSSymbol> withCStringNoCopy(const char * cString); 312*5c2921b0SApple OSS Distributions 313*5c2921b0SApple OSS Distributions /*! 314*5c2921b0SApple OSS Distributions * @function existingSymbolForString 315*5c2921b0SApple OSS Distributions * 316*5c2921b0SApple OSS Distributions * @abstract 317*5c2921b0SApple OSS Distributions * Returns an existing OSSymbol for the given OSString. 318*5c2921b0SApple OSS Distributions * 319*5c2921b0SApple OSS Distributions * @param aString The OSString Object to look up. 320*5c2921b0SApple OSS Distributions * 321*5c2921b0SApple OSS Distributions * @result 322*5c2921b0SApple OSS Distributions * An existing instance of OSSymbol representing 323*5c2921b0SApple OSS Distributions * the same characters as <code>aString</code>; 324*5c2921b0SApple OSS Distributions * <code>NULL</code> if none is found. 325*5c2921b0SApple OSS Distributions * 326*5c2921b0SApple OSS Distributions * @discussion 327*5c2921b0SApple OSS Distributions * The returned OSSymbol object is returned with an incremented refcount 328*5c2921b0SApple OSS Distributions * that needs to be released. 329*5c2921b0SApple OSS Distributions */ 330*5c2921b0SApple OSS Distributions static OSPtr<const OSSymbol> existingSymbolForString(const OSString *aString); 331*5c2921b0SApple OSS Distributions 332*5c2921b0SApple OSS Distributions /*! 333*5c2921b0SApple OSS Distributions * @function existingSymbolForCString 334*5c2921b0SApple OSS Distributions * 335*5c2921b0SApple OSS Distributions * @abstract 336*5c2921b0SApple OSS Distributions * Returns an existing OSSymbol for the given C string. 337*5c2921b0SApple OSS Distributions * 338*5c2921b0SApple OSS Distributions * @param aCString The C string to look up. 339*5c2921b0SApple OSS Distributions * 340*5c2921b0SApple OSS Distributions * @result 341*5c2921b0SApple OSS Distributions * An existing instance of OSSymbol representing 342*5c2921b0SApple OSS Distributions * the same characters as <code>aString</code>; 343*5c2921b0SApple OSS Distributions * <code>NULL</code> if none is found. 344*5c2921b0SApple OSS Distributions * 345*5c2921b0SApple OSS Distributions * @discussion 346*5c2921b0SApple OSS Distributions * The returned OSSymbol object is returned with an incremented refcount 347*5c2921b0SApple OSS Distributions * that needs to be released. 348*5c2921b0SApple OSS Distributions */ 349*5c2921b0SApple OSS Distributions static OSPtr<const OSSymbol> existingSymbolForCString(const char *aCString); 350*5c2921b0SApple OSS Distributions 351*5c2921b0SApple OSS Distributions /*! 352*5c2921b0SApple OSS Distributions * @function isEqualTo 353*5c2921b0SApple OSS Distributions * 354*5c2921b0SApple OSS Distributions * @abstract 355*5c2921b0SApple OSS Distributions * Tests the equality of two OSSymbol objects. 356*5c2921b0SApple OSS Distributions * 357*5c2921b0SApple OSS Distributions * @param aSymbol The OSSymbol object being compared against the receiver. 358*5c2921b0SApple OSS Distributions * 359*5c2921b0SApple OSS Distributions * @result 360*5c2921b0SApple OSS Distributions * <code>true</code> if the two OSSymbol objects are equivalent, 361*5c2921b0SApple OSS Distributions * <code>false</code> otherwise. 362*5c2921b0SApple OSS Distributions * 363*5c2921b0SApple OSS Distributions * @discussion 364*5c2921b0SApple OSS Distributions * Two OSSymbol objects are considered equal if they have the same address; 365*5c2921b0SApple OSS Distributions * that is, this function is equivalent to the <code>==</code> operator. 366*5c2921b0SApple OSS Distributions */ 367*5c2921b0SApple OSS Distributions virtual bool isEqualTo(const OSSymbol * aSymbol) const; 368*5c2921b0SApple OSS Distributions 369*5c2921b0SApple OSS Distributions 370*5c2921b0SApple OSS Distributions /*! 371*5c2921b0SApple OSS Distributions * @function isEqualTo 372*5c2921b0SApple OSS Distributions * 373*5c2921b0SApple OSS Distributions * @abstract Tests the equality of an OSSymbol object with a C string. 374*5c2921b0SApple OSS Distributions * 375*5c2921b0SApple OSS Distributions * @param cString The C string to compare against the receiver. 376*5c2921b0SApple OSS Distributions * 377*5c2921b0SApple OSS Distributions * @result 378*5c2921b0SApple OSS Distributions * <code>true</code> if the OSSymbol's characters 379*5c2921b0SApple OSS Distributions * are equivalent to the C string's, 380*5c2921b0SApple OSS Distributions * <code>false</code> otherwise. 381*5c2921b0SApple OSS Distributions */ 382*5c2921b0SApple OSS Distributions virtual bool isEqualTo(const char * cString) const APPLE_KEXT_OVERRIDE; 383*5c2921b0SApple OSS Distributions 384*5c2921b0SApple OSS Distributions 385*5c2921b0SApple OSS Distributions /*! 386*5c2921b0SApple OSS Distributions * @function isEqualTo 387*5c2921b0SApple OSS Distributions * 388*5c2921b0SApple OSS Distributions * @abstract Tests the equality of an OSSymbol object to an arbitrary object. 389*5c2921b0SApple OSS Distributions * 390*5c2921b0SApple OSS Distributions * @param anObject The object to be compared against the receiver. 391*5c2921b0SApple OSS Distributions * @result Returns <code>true</code> if the two objects are equivalent, 392*5c2921b0SApple OSS Distributions * <code>false</code> otherwise. 393*5c2921b0SApple OSS Distributions * 394*5c2921b0SApple OSS Distributions * @discussion 395*5c2921b0SApple OSS Distributions * An OSSymbol is considered equal to another object 396*5c2921b0SApple OSS Distributions * if that object is derived from 397*5c2921b0SApple OSS Distributions * @link //apple_ref/doc/class/OSMetaClassBase OSString@/link 398*5c2921b0SApple OSS Distributions * and contains the equivalent bytes of the same length. 399*5c2921b0SApple OSS Distributions */ 400*5c2921b0SApple OSS Distributions virtual bool isEqualTo(const OSMetaClassBase * anObject) const APPLE_KEXT_OVERRIDE; 401*5c2921b0SApple OSS Distributions 402*5c2921b0SApple OSS Distributions 403*5c2921b0SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE 404*5c2921b0SApple OSS Distributions /* OSRuntime only INTERNAL API - DO NOT USE */ 405*5c2921b0SApple OSS Distributions /* Not to be included in headerdoc. */ 406*5c2921b0SApple OSS Distributions // xx-review: this should be removed from the symbol set. 407*5c2921b0SApple OSS Distributions 408*5c2921b0SApple OSS Distributions static void checkForPageUnload( 409*5c2921b0SApple OSS Distributions void * startAddr, 410*5c2921b0SApple OSS Distributions void * endAddr); 411*5c2921b0SApple OSS Distributions 412*5c2921b0SApple OSS Distributions static unsigned int bsearch( 413*5c2921b0SApple OSS Distributions const void * key, 414*5c2921b0SApple OSS Distributions const void * array, 415*5c2921b0SApple OSS Distributions unsigned int arrayCount, 416*5c2921b0SApple OSS Distributions size_t memberSize); 417*5c2921b0SApple OSS Distributions #endif /* XNU_KERNEL_PRIVATE */ 418*5c2921b0SApple OSS Distributions 419*5c2921b0SApple OSS Distributions OSMetaClassDeclareReservedUnused(OSSymbol, 0); 420*5c2921b0SApple OSS Distributions OSMetaClassDeclareReservedUnused(OSSymbol, 1); 421*5c2921b0SApple OSS Distributions OSMetaClassDeclareReservedUnused(OSSymbol, 2); 422*5c2921b0SApple OSS Distributions OSMetaClassDeclareReservedUnused(OSSymbol, 3); 423*5c2921b0SApple OSS Distributions OSMetaClassDeclareReservedUnused(OSSymbol, 4); 424*5c2921b0SApple OSS Distributions OSMetaClassDeclareReservedUnused(OSSymbol, 5); 425*5c2921b0SApple OSS Distributions OSMetaClassDeclareReservedUnused(OSSymbol, 6); 426*5c2921b0SApple OSS Distributions OSMetaClassDeclareReservedUnused(OSSymbol, 7); 427*5c2921b0SApple OSS Distributions }; 428*5c2921b0SApple OSS Distributions 429*5c2921b0SApple OSS Distributions #endif /* !_OS_OSSYMBOL_H */ 430