]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSSymbol.h
83143678d0b8ff148e2486377fee2f675d6b18a6
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* IOSymbol.h created by gvdl on Fri 1998-10-30 */
23 /* IOSymbol must be created through the factory methods and thus is not subclassable. */
25 #ifndef _OS_OSSYMBOL_H
26 #define _OS_OSSYMBOL_H
28 #include <libkern/c++/OSString.h>
32 @abstract A container class whose instances represent unique string values.
34 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.
36 class OSSymbol
: public OSString
38 friend class OSSymbolPool
;
40 OSDeclareAbstractStructors ( OSSymbol
)
43 struct ExpansionData
{ };
46 Reserved for future use. (Internal use only) */
47 ExpansionData
* reserved
;
49 static void initialize ();
51 friend void checkModuleForSymbols ( void ); /* in catalogue? */
53 // The string init methods have to be removed from the inheritance.
54 virtual bool initWithString ( const OSString
* aString
);
55 virtual bool initWithCString ( const char * cString
);
56 virtual bool initWithCStringNoCopy ( const char * cString
);
61 @abstract A member function to release all resources created or used by the OSString object.
62 @discussion This function should not be called directly, use release() instead.
69 @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.
70 @param aString An OSString object.
71 @result Returns a unique OSSymbol object for the string given.
73 static const OSSymbol
* withString ( const OSString
* aString
);
76 @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.
77 @param cString A c-string.
78 @result Returns a unique OSSymbol object for the string given.
80 static const OSSymbol
* withCString ( const char * cString
);
82 @function withCStringNoCopy
83 @abstract A static constructor function to create an OSSymbol instance from a simple c-string, but does not copy the string to the container.
84 @param cString A c-string.
85 @result Returns a unique OSSymbol object for the string given.
87 static const OSSymbol
* withCStringNoCopy ( const char * cString
);
91 @abstract A member function which tests the equality between two OSSymbol objects. Two OSSymbol objects are only equivalent when their references are identical
92 @param aSymbol The OSSymbol object to be compared against the receiver.
93 @result Returns true if the two objects are equivalent, false otherwise.
95 virtual bool isEqualTo ( const OSSymbol
* aSymbol
) const ;
98 @abstract A member function which tests the equality between an OSSymbol object and a simple c-string.
99 @param aCString The c-string to be compared against the receiver.
100 @result Returns true if the OSSymbol's internal string representation is equivalent to the c-string it is being compared against, false otherwise.
102 virtual bool isEqualTo ( const char * aCString
) const ;
105 @abstract A member function which tests the equality between an OSSymbol object and and arbitrary OSObject derived object.
106 @param obj The OSObject derived object to be compared against the receiver.
107 @result Returns true if the OSSymbol and the OSObject objects are equivalent.
109 virtual bool isEqualTo ( const OSMetaClassBase
* obj
) const ;
111 /* OSRuntime only INTERNAL API - DO NOT USE */
112 static void checkForPageUnload ( void * startAddr
, void * endAddr
);
115 OSMetaClassDeclareReservedUnused ( OSSymbol
, 0 );
116 OSMetaClassDeclareReservedUnused ( OSSymbol
, 1 );
117 OSMetaClassDeclareReservedUnused ( OSSymbol
, 2 );
118 OSMetaClassDeclareReservedUnused ( OSSymbol
, 3 );
119 OSMetaClassDeclareReservedUnused ( OSSymbol
, 4 );
120 OSMetaClassDeclareReservedUnused ( OSSymbol
, 5 );
121 OSMetaClassDeclareReservedUnused ( OSSymbol
, 6 );
122 OSMetaClassDeclareReservedUnused ( OSSymbol
, 7 );
125 #endif /* !_OS_OSSYMBOL_H */