![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/share/doc/gnustep-base-doc/Base/Reference/ |
Upload File : |
<?xml version="1.0"?> <!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.4//EN" "http://www.gnustep.org/gsdoc-1_0_4.dtd"> <gsdoc base="NSValue" up="Base"> <head> <title>NSValue class reference</title> <author name="Adam Fedor"> <email address="fedor@boulder.colorado.edu"> fedor@boulder.colorado.edu </email> </author> <author name="Richard Frith-Macdonald"> <email address="rfm@gnu.org"> rfm@gnu.org </email> </author> <copy> 1993, 1994, 1996, 1999 Free Software Foundation, Inc. </copy> </head> <body> <front><contents /></front> <chapter> <heading> Software documentation for the NSNumber class </heading> <class name="NSNumber" super="NSValue" ovadd="1.0.0"> <declared>Foundation/NSValue.h</declared> <conform>NSCopying</conform> <conform>NSCoding</conform> <desc> Subclass of <ref type="class" id="NSValue">NSValue</ref> offering convenience methods for initializing from and accessing as any C primitive numeric type. On access, the value will be type-converted if necessary, using standard C conversion rules. </desc> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithBool:</sel> <arg type="BOOL">value</arg> <desc> New instance from boolean <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithChar:</sel> <arg type="signed char">value</arg> <desc> New instance from <strong>signed</strong> <strong>char</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithDouble:</sel> <arg type="double">value</arg> <desc> New instance from <strong>double</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithFloat:</sel> <arg type="float">value</arg> <desc> New instance from <strong>float</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithInt:</sel> <arg type="signed int">value</arg> <desc> New instance from (<strong>signed</strong>) <strong>int</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="10.5.0"> <sel>numberWithInteger:</sel> <arg type="NSInteger">value</arg> <desc> Return a number intialised with NSInteger. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithLong:</sel> <arg type="signed long">value</arg> <desc> New instance from (<strong>signed</strong>) <strong>long</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithLongLong:</sel> <arg type="signed long long">value</arg> <desc> New instance from (<strong>signed</strong>) <strong>long</strong> <strong>long</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithShort:</sel> <arg type="signed short">value</arg> <desc> New instance from (<strong>signed</strong>) <strong>short</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithUnsignedChar:</sel> <arg type="unsigned char">value</arg> <desc> New instance from <strong>unsigned</strong> <strong>char</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithUnsignedInt:</sel> <arg type="unsigned int">value</arg> <desc> New instance from <strong>unsigned</strong> <strong>int</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="10.5.0"> <sel>numberWithUnsignedInteger:</sel> <arg type="NSUInteger">value</arg> <desc> Return a number intialised with NSUInteger. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithUnsignedLong:</sel> <arg type="unsigned long">value</arg> <desc> New instance from <strong>unsigned</strong> <strong>long</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithUnsignedLongLong:</sel> <arg type="unsigned long long">value</arg> <desc> New instance from <strong>unsigned</strong> <strong>long</strong> <strong>long</strong> <var>value</var>. </desc> </method> <method type="NSNumber*" factory="yes" ovadd="1.0.0"> <sel>numberWithUnsignedShort:</sel> <arg type="unsigned short">value</arg> <desc> New instance from <strong>unsigned</strong> <strong>short</strong> <var>value</var>. </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>boolValue</sel> <desc> Return value as a BOOL; this will in fact be a <strong>char</strong> value converted if necessary from type initialized with; if you wish to consider anything nonzero TRUE do not compare directly to <code>YES</code>, but use <code>'!= NO'</code>. </desc> </method> <method type="signed char" ovadd="1.0.0"> <sel>charValue</sel> <desc> Returns value as a <strong>signed</strong> <strong>char</strong>, converting if necessary. </desc> </method> <method type="NSComparisonResult" ovadd="1.0.0"> <sel>compare:</sel> <arg type="NSNumber*">otherNumber</arg> <desc> Compares receiver with <var>otherNumber</var>, using C type conversion if necessary, and returns <code>NSOrderedAscending</code>, <code>NSOrderedDescending</code>, or <code>NSOrderedSame</code> depending on whether it is less than, greater than, or equal to <var>otherNumber</var>. </desc> </method> <method type="NSString*" ovadd="1.0.0"> <sel>description</sel> <desc> Returns the string representation of this number using a non-localised conversion (decimal point is '.' irrespective of the locale). </desc> </method> <method type="NSString*" ovadd="1.0.0"> <sel>descriptionWithLocale:</sel> <arg type="id">locale</arg> <desc> <p> Produces a string representation of the number. For a boolean this will be either 'true' or 'false'. For other numbers the format is produced using the initWithFormat:locale:... method of NSString, and the format depends on the type of number as follows - </p> <deflist> <term><strong>char</strong></term> <desc>%i</desc> <term><strong>short</strong></term> <desc>%hi</desc> <term><strong>int</strong></term> <desc>%i</desc> <term><strong>long</strong></term> <desc>%li</desc> <term> <strong>long</strong> <strong>long</strong> </term> <desc>%lli</desc> <term> <strong>unsigned</strong> <strong>char</strong> </term> <desc>%u</desc> <term> <strong>unsigned</strong> <strong>short</strong> </term> <desc>%hu</desc> <term> <strong>unsigned</strong> <strong>int</strong> </term> <desc>%u</desc> <term> <strong>unsigned</strong> <strong>long</strong> </term> <desc>%lu</desc> <term> <strong>unsigned</strong> <strong>long</strong> <strong>long</strong> </term> <desc>%llu</desc> <term><strong>float</strong></term> <desc>%0.7g</desc> <term><strong>double</strong></term> <desc>%0.16g</desc> </deflist> </desc> </method> <method type="double" ovadd="1.0.0"> <sel>doubleValue</sel> <desc> Returns value as a <strong>double</strong>, converting if necessary. </desc> </method> <method type="float" ovadd="1.0.0"> <sel>floatValue</sel> <desc> Returns value as a <strong>float</strong>, converting if necessary. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithBool:</sel> <arg type="BOOL">value</arg> <desc> Initialize from boolean <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithChar:</sel> <arg type="signed char">value</arg> <desc> Initialize from <strong>signed</strong> <strong>char</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithDouble:</sel> <arg type="double">value</arg> <desc> Initialize from <strong>double</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithFloat:</sel> <arg type="float">value</arg> <desc> Initialize from <strong>float</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithInt:</sel> <arg type="signed int">value</arg> <desc> Initialize from (<strong>signed</strong>) <strong>int</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="10.5.0"> <sel>initWithInteger:</sel> <arg type="NSInteger">value</arg> <desc> Initialise the receiver with NSInteger content. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithLong:</sel> <arg type="signed long">value</arg> <desc> Initialize from (<strong>signed</strong>) <strong>long</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithLongLong:</sel> <arg type="signed long long">value</arg> <desc> Initialize from (<strong>signed</strong>) <strong>long</strong> <strong>long</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithShort:</sel> <arg type="signed short">value</arg> <desc> Initialize from (<strong>signed</strong>) <strong>short</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithUnsignedChar:</sel> <arg type="unsigned char">value</arg> <desc> Initialize from <strong>unsigned</strong> <strong>char</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithUnsignedInt:</sel> <arg type="unsigned int">value</arg> <desc> Initialize from <strong>unsigned</strong> <strong>int</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="10.5.0"> <sel>initWithUnsignedInteger:</sel> <arg type="NSUInteger">value</arg> <desc> Initialise the receiver with NSUInteger content. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithUnsignedLong:</sel> <arg type="unsigned long">value</arg> <desc> Initialize from <strong>unsigned</strong> <strong>long</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithUnsignedLongLong:</sel> <arg type="unsigned long long">value</arg> <desc> Initialize from <strong>unsigned</strong> <strong>long</strong> <strong>long</strong> <var>value</var>. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithUnsignedShort:</sel> <arg type="unsigned short">value</arg> <desc> Initialize from <strong>unsigned</strong> <strong>short</strong> <var>value</var>. </desc> </method> <method type="signed int" ovadd="1.0.0"> <sel>intValue</sel> <desc> Returns value as a (<strong>signed</strong>) <strong>int</strong>, converting if necessary. </desc> </method> <method type="NSInteger" ovadd="10.5.0"> <sel>integerValue</sel> <desc> Return the contents of the receiver as NSInteger. </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>isEqualToNumber:</sel> <arg type="NSNumber*">otherNumber</arg> <desc> Returns whether receiver and <var>otherNumber</var> represent the same numerical value. </desc> </method> <method type="signed long long" ovadd="1.0.0"> <sel>longLongValue</sel> <desc> Returns value as a (<strong>signed</strong>) <strong>long</strong> <strong>long</strong>, converting if necessary. </desc> </method> <method type="signed long" ovadd="1.0.0"> <sel>longValue</sel> <desc> Returns value as a (<strong>signed</strong>) <strong>long</strong>, converting if necessary. </desc> </method> <method type="signed short" ovadd="1.0.0"> <sel>shortValue</sel> <desc> Returns value as a (<strong>signed</strong>) <strong>short</strong>, converting if necessary. </desc> </method> <method type="NSString*" ovadd="1.0.0"> <sel>stringValue</sel> <desc> Returns <ref type="method" id="-description"> -description </ref> . </desc> </method> <method type="unsigned char" ovadd="1.0.0"> <sel>unsignedCharValue</sel> <desc> Returns value as an <strong>unsigned</strong> <strong>char</strong>, converting if necessary. </desc> </method> <method type="unsigned int" ovadd="1.0.0"> <sel>unsignedIntValue</sel> <desc> Returns value as an <strong>unsigned</strong> <strong>int</strong>, converting if necessary. </desc> </method> <method type="NSUInteger" ovadd="10.5.0"> <sel>unsignedIntegerValue</sel> <desc> Return the contents of the receiver as NSUInteger. </desc> </method> <method type="unsigned long long" ovadd="1.0.0"> <sel>unsignedLongLongValue</sel> <desc> Returns value as an <strong>unsigned</strong> <strong>long</strong> <strong>long</strong>, converting if necessary. </desc> </method> <method type="unsigned long" ovadd="1.0.0"> <sel>unsignedLongValue</sel> <desc> Returns value as an <strong>unsigned</strong> <strong>long</strong>, converting if necessary. </desc> </method> <method type="unsigned short" ovadd="1.0.0"> <sel>unsignedShortValue</sel> <desc> Returns value as an <strong>unsigned</strong> <strong>short</strong>, converting if necessary. </desc> </method> </class> </chapter> <chapter> <heading> Software documentation for the NSValue class </heading> <class name="NSValue" super="NSObject" ovadd="1.0.0"> <declared>Foundation/NSValue.h</declared> <conform>NSCopying</conform> <conform>NSCoding</conform> <desc> The <code>NSValue</code> class can wrap a single primitive value as an object so it can be used in the containers and other places where an object reference is needed. Once initialized, an <code>NSValue</code> is immutable, and there is no <code>NSMutableValue</code> class. You initialize it by giving it a pointer to the primitive value, and you should be careful this does not get freed until after the <code>NSValue</code> is no longer used. </desc> <method type="NSValue*" factory="yes" ovadd="1.0.0"> <sel>value:</sel> <arg type="const void*">value</arg> <sel>withObjCType:</sel> <arg type="const char*">type</arg> <desc> Create new instance with specified <var>value</var> (a pointer) of given <var>type</var>, which is a string code obtainable through the compile-time operator <code>@encode(...)</code>. For example: <example> NSValue *theValue = [NSValue value: &n withObjCType: @encode(int)]; </example> </desc> </method> <method type="NSValue*" factory="yes" ovadd="10.0.0"> <sel>valueWithBytes:</sel> <arg type="const void*">value</arg> <sel>objCType:</sel> <arg type="const char*">type</arg> <desc> Synonym for value:withObjCType:. </desc> </method> <method type="NSValue*" factory="yes" ovadd="1.0.0"> <sel>valueWithNonretainedObject:</sel> <arg type="id">anObject</arg> <desc> Create new instance holding <var>anObject</var>. This is useful if you want to add <var>anObject</var> to a collection such as <ref type="class" id="NSArray">NSArray</ref> but don't want it to be retained (a weak reference). </desc> </method> <method type="NSValue*" factory="yes" ovadd="1.0.0"> <sel>valueWithPoint:</sel> <arg type="NSPoint">point</arg> <desc> Convenience method to create instance holding an <code>NSPoint</code> structure. </desc> </method> <method type="NSValue*" factory="yes" ovadd="1.0.0"> <sel>valueWithPointer:</sel> <arg type="const void*">pointer</arg> <desc> Convenience method to create instance holding a <var>pointer</var>. Same as using <code>@encode(<strong>void</strong> *)</code> in <ref type="method" id="+value:withObjCType:"> +value:withObjCType: </ref> . </desc> </method> <method type="NSValue*" factory="yes" ovadd="1.0.0"> <sel>valueWithRange:</sel> <arg type="NSRange">range</arg> <desc> Convenience method to create instance holding an <code>NSRange</code> structure. </desc> </method> <method type="NSValue*" factory="yes" ovadd="1.0.0"> <sel>valueWithRect:</sel> <arg type="NSRect">rect</arg> <desc> Convenience method to create instance holding an <code>NSRect</code> structure. </desc> </method> <method type="NSValue*" factory="yes" ovadd="1.0.0"> <sel>valueWithSize:</sel> <arg type="NSSize">size</arg> <desc> Convenience method to create instance holding an <code>NSSize</code> structure. </desc> </method> <method type="void" ovadd="1.0.0"> <sel>getValue:</sel> <arg type="void*">value</arg> <desc> Copies bytes from the pointer receiver was initialized with into buffer pointed to by <var>value</var>. Number of bytes copied is determined by the type. If type was a <strong>void</strong> * pointer or object <strong>id</strong>, the memory address itself is copied. </desc> </method> <method type="id" init="yes" ovadd="10.0.0"> <sel>initWithBytes:</sel> <arg type="const void*">data</arg> <sel>objCType:</sel> <arg type="const char*">type</arg> <desc> Initialize with value of <var>type</var>, parallel to value:withObjCType:. </desc> </method> <method type="BOOL" ovadd="10.0.0"> <sel>isEqualToValue:</sel> <arg type="NSValue*">other</arg> <desc> Compares this instance to another <code>NSValue</code>. For equality, both contents and declared type of the two values must match. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>nonretainedObjectValue</sel> <desc> If receiver was initialized with an object ID, return it, else raises <code>NSInternalInconsistencyException</code>. </desc> </method> <method type="const char*" ovadd="1.0.0"> <sel>objCType</sel> <desc> Returns the string <code>@encode(...)</code> compatible type the receiver was initialized with. </desc> </method> <method type="NSPoint" ovadd="1.0.0"> <sel>pointValue</sel> <desc> If receiver was initialized with an <code>NSPoint</code> value, return it, else raises <code>NSInternalInconsistencyException</code>. </desc> </method> <method type="void*" ovadd="1.0.0"> <sel>pointerValue</sel> <desc> If receiver was initialized with a <strong>void</strong> * pointer, return it, else raises <code>NSInternalInconsistencyException</code>. </desc> </method> <method type="NSRange" ovadd="1.0.0"> <sel>rangeValue</sel> <desc> If receiver was initialized with an <code>NSRange</code> value, return it, else raises <code>NSInternalInconsistencyException</code>. </desc> </method> <method type="NSRect" ovadd="1.0.0"> <sel>rectValue</sel> <desc> If receiver was initialized with an <code>NSRect</code> value, return it, else raises <code>NSInternalInconsistencyException</code>. </desc> </method> <method type="NSSize" ovadd="1.0.0"> <sel>sizeValue</sel> <desc> If receiver was initialized with an <code>NSSize</code> value, return it, else raises <code>NSInternalInconsistencyException</code>. </desc> </method> </class> </chapter> <chapter> <heading> Software documentation for the NSValue(Subclassing) category </heading> <category name="Subclassing" class="NSValue" ovadd="0.0.0" ovrem="0.0.0"> <declared>Foundation/NSValue.h</declared> <desc> Note: Defines a method that is not in the OpenStep spec, but makes subclassing easier. </desc> <method type="Class" factory="yes" ovadd="0.0.0" ovrem="0.0.0"> <sel>valueClassWithObjCType:</sel> <arg type="const char*">type</arg> <desc> Used by value: withObjCType: to determine the concrete subclass to alloc. </desc> </method> </category> </chapter> </body> </gsdoc>