]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSSymbol.h
d5db609a98109fc9c8c8f6a3e5f92c7e78915583
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 /* IOSymbol.h created by gvdl on Fri 1998-10-30 */
26 /* IOSymbol must be created through the factory methods and thus is not subclassable. */
28 #ifndef _OS_OSSYMBOL_H
29 #define _OS_OSSYMBOL_H
31 #include <libkern/c++/OSString.h>
35 @abstract A container class whose instances represent unique string values.
37 An OSSymbol object represents a unique string value. When creating an OSSymbol, a string is given and an OSSymbol representing this string is created if none exist for this string. If a symbol for this string already exists, then a reference to an existing symbol is returned.
39 class OSSymbol
: public OSString
41 friend class OSSymbolPool
;
43 OSDeclareAbstractStructors ( OSSymbol
)
46 struct ExpansionData
{ };
49 Reserved for future use. (Internal use only) */
50 ExpansionData
* reserved
;
52 static void initialize ();
54 friend void checkModuleForSymbols ( void ); /* in catalogue? */
56 // The string init methods have to be removed from the inheritance.
57 virtual bool initWithString ( const OSString
* aString
);
58 virtual bool initWithCString ( const char * cString
);
59 virtual bool initWithCStringNoCopy ( const char * cString
);
64 @abstract A member function to release all resources created or used by the OSString object.
65 @discussion This function should not be called directly, use release() instead.
72 @abstract A static constructor function to create an OSSymbol instance from an OSString object or returns an existing OSSymbol object based on the OSString object given.
73 @param aString An OSString object.
74 @result Returns a unique OSSymbol object for the string given.
76 static const OSSymbol
* withString ( const OSString
* aString
);
79 @abstract A static constructor function to create an OSSymbol instance from a simple c-string returns an existing OSSymbol object based on the string object given.
80 @param cString A c-string.
81 @result Returns a unique OSSymbol object for the string given.
83 static const OSSymbol
* withCString ( const char * cString
);
85 @function withCStringNoCopy
86 @abstract A static constructor function to create an OSSymbol instance from a simple c-string, but does not copy the string to the container.
87 @param cString A c-string.
88 @result Returns a unique OSSymbol object for the string given.
90 static const OSSymbol
* withCStringNoCopy ( const char * cString
);
94 @abstract A member function which tests the equality between two OSSymbol objects. Two OSSymbol objects are only equivalent when their references are identical
95 @param aSymbol The OSSymbol object to be compared against the receiver.
96 @result Returns true if the two objects are equivalent, false otherwise.
98 virtual bool isEqualTo ( const OSSymbol
* aSymbol
) const ;
101 @abstract A member function which tests the equality between an OSSymbol object and a simple c-string.
102 @param aCString The c-string to be compared against the receiver.
103 @result Returns true if the OSSymbol's internal string representation is equivalent to the c-string it is being compared against, false otherwise.
105 virtual bool isEqualTo ( const char * aCString
) const ;
108 @abstract A member function which tests the equality between an OSSymbol object and and arbitrary OSObject derived object.
109 @param obj The OSObject derived object to be compared against the receiver.
110 @result Returns true if the OSSymbol and the OSObject objects are equivalent.
112 virtual bool isEqualTo ( const OSMetaClassBase
* obj
) const ;
114 /* OSRuntime only INTERNAL API - DO NOT USE */
115 static void checkForPageUnload ( void * startAddr
, void * endAddr
);
118 OSMetaClassDeclareReservedUnused ( OSSymbol
, 0 );
119 OSMetaClassDeclareReservedUnused ( OSSymbol
, 1 );
120 OSMetaClassDeclareReservedUnused ( OSSymbol
, 2 );
121 OSMetaClassDeclareReservedUnused ( OSSymbol
, 3 );
122 OSMetaClassDeclareReservedUnused ( OSSymbol
, 4 );
123 OSMetaClassDeclareReservedUnused ( OSSymbol
, 5 );
124 OSMetaClassDeclareReservedUnused ( OSSymbol
, 6 );
125 OSMetaClassDeclareReservedUnused ( OSSymbol
, 7 );
128 #endif /* !_OS_OSSYMBOL_H */