libs-base/Documentation/gsdoc/NSScanner.gsdoc
CaS 8f6392e943 Fixed typo in last mod
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9280 72102866-910b-0410-8b05-ffd578937521
2001-03-03 09:58:53 +00:00

320 lines
12 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
<gsdoc base="NSScanner" prev="NSRunLoop" next="NSSerializer" up="Base">
<head>
<title>NSScanner</title>
<author name="Richard Frith-Macdonald">
<email address="rfm@gnu.org"/>
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
</author>
<version>$Revision$</version>
<date>$Date$</date>
</head>
<body>
<chapter>
<heading>The NSScanner class documentation</heading>
<class name="NSScanner" super="NSObject">
<declared>Foundation/NSScanner.h</declared>
<conform>NSCopying</conform>
<desc>
<p>
The NSScanner class cluster (currently a single class in GNUstep)
provides a mechanism to parse the contents of a string into number
and string values by making a sequence of scan operations to
step through the string retrieving successive items.
</p>
<p>
You can tell the scanner whether its scanning is supposed to be
case sensitive or not, and you can specify a set of characters
to be skipped before each scanning operation (by default,
whitespace and newlines).
</p>
</desc>
<method type="id" factory="yes">
<sel>localizedScannerWithString:</sel>
<arg type="NSString*">aString</arg>
<desc>
Returns an NSScanner instance set up to scan aString
(using <ref id="initWithString:">initWithString:</ref>)
and with a locale set the default locale
(using <ref id="setLocale:">setLocale:</ref>).
</desc>
</method>
<method type="id" factory="yes">
<sel>scannerWithString:</sel>
<arg type="NSString*">aString</arg>
<desc>
Returns an NSScanner instance set up to scan aString
(using <ref id="initWithString:">initWithString:</ref>)
and with no locale set.
</desc>
</method>
<method type="BOOL">
<sel>caseSensitive</sel>
<desc>
If the scanner is set to be case-sensitive in its scanning of
the string (other than characters to be skipped), this method
returns YES, otherwise it returns NO.
<br/>
The default is for a scanner to <em>not</em> be case sensitive.
</desc>
</method>
<method type="NSCharacterSet*">
<sel>charactersToBeSkipped</sel>
<desc>
Returns a set of characters containing those characters that the
scanner ignores when starting any scan operation. Once a character
not in this set has been encountered during an operation, skipping
is finished, and any further characters from this set that are
found are scanned normally.
<br/>
The default for this is the whitespaceAndNewlineCharacterSet.
</desc>
</method>
<method init="yes" type="id" id="initWithString:">
<sel>initWithString:</sel>
<arg type="NSString*">aString</arg>
<desc>
Initialises the scanner to scan aString. The GNUstep
implementation may make an internal copy of the original
string - so it is not safe to assume that if you modify a
mutable string that you initialised a scanner with, the changes
will be visible to the scanner.
<br/>
Returns the scanner object.
</desc>
</method>
<method type="BOOL">
<sel>isAtEnd</sel>
<desc>
Returns YES if there are no characters left to be scanned in the
string (or if all the characters that are left are in the set of
characters to be skipped). Returns NO otherwise.
</desc>
</method>
<method type="NSDictionary*">
<sel>locale</sel>
<desc>
Returns the locale set for the scanner, or nil if no locale has
been set. A scanner uses it's locale to alter the way it handles
scanning - it uses the NSDecimalSeparator value for scanning
numbers.
</desc>
</method>
<method type="BOOL">
<sel>scanCharactersFromSet:</sel>
<arg type="NSCharacterSet*">set</arg>
<sel>intoString:</sel>
<arg type="NSString**">stringValue</arg>
<desc>
After initial skipping (if any), this method scans any characters
from <em>set</em>, terminating when a character not in the set
is found.
Returns YES if any character is scanned, NO otherwise.
If <em>stringValue</em> is not null, any character scanned are
stored in a string returned in this value.
</desc>
</method>
<method type="BOOL">
<sel>scanDecimal:</sel>
<arg type="NSDecimal*">decimalValue</arg>
<desc>
Not implemented.
</desc>
<standards><MacOS-X/><NotOpenStep/></standards>
</method>
<method type="BOOL">
<sel>scanDouble:</sel>
<arg type="double*">doubleValue</arg>
<desc>
After initial skipping (if any), this method scans a double value,
placing it in <em>doubleValue</em> if that is not null.
Returns YES if anything is scanned, NO otherwise.
<br/>
On overflow, HUGE_VAL or -HUGE_VAL is put into <em>doubleValue</em>
<br/>
On underflow, 0.0 is put into <em>doubleValue</em>
<br/>
Scans past any excess digits
</desc>
</method>
<method type="BOOL">
<sel>scanFloat:</sel>
<arg type="float*">floatValue</arg>
<desc>
After initial skipping (if any), this method scans a float value,
placing it in <em>floatValue</em> if that is not null.
Returns YES if anything is scanned, NO otherwise.
<br/>
On overflow, HUGE_VAL or -HUGE_VAL is put into <em>floatValue</em>
<br/>
On underflow, 0.0 is put into <em>floatValue</em>
<br/>
Scans past any excess digits
</desc>
</method>
<method type="BOOL">
<sel>scanHexInt:</sel>
<arg type="unsigned int*">intValue</arg>
<desc>
After initial skipping (if any), this method scans a hexadecimal
integer value (optionally prefixed by "0x" or "0X"),
placing it in <em>intValue</em> if that is not null.
<br/>
Returns YES if anything is scanned, NO otherwise.
<br/>
On overflow, INT_MAX or INT_MIN is put into <em>intValue</em>
<br/>
Scans past any excess digits
</desc>
</method>
<method type="BOOL">
<sel>scanInt:</sel>
<arg type="int*">intValue</arg>
<desc>
After initial skipping (if any), this method scans a integer value,
placing it in <em>intValue</em> if that is not null.
<br/>
Returns YES if anything is scanned, NO otherwise.
<br/>
On overflow, INT_MAX or INT_MIN is put into <em>intValue</em>
<br/>
Scans past any excess digits
</desc>
</method>
<method type="unsigned int">
<sel>scanLocation</sel>
<desc>
Returns the current position that the scanner has reached in
scanning the string. This is the position at which the next scan
operation will begin.
</desc>
</method>
<method type="BOOL">
<sel>scanLongLong:</sel>
<arg type="longlong*">longLongValue</arg>
<desc>
After initial skipping (if any), this method scans a long
decimal integer value placing it in <em>longLongValue</em> if that
is not null.
<br/>
Returns YES if anything is scanned, NO otherwise.
<br/>
On overflow, LONG_LONG_MAX or LONG_LONG_MIN is put into
<em>longLongValue</em>
<br/>
Scans past any excess digits
</desc>
</method>
<method type="BOOL">
<sel>scanRadixUnsignedInt:</sel>
<arg type="unsigned int*">intValue</arg>
<desc>
After initial skipping (if any), this method scans an unsigned
integer value placing it in <em>intValue</em> if that is not null.
If the number begins with "0x" or "0X" it is treated as hexadecimal,
otherwise if the number begins with "0" it is treated as octal,
otherwise the number is treated as decimal.
<br/>
Returns YES if anything is scanned, NO otherwise.
<br/>
On overflow, INT_MAX or INT_MIN is put into <em>intValue</em>
<br/>
Scans past any excess digits
</desc>
<standards><GNUstep/><NotOpenStep/><NotMacOS-X/></standards>
</method>
<method type="BOOL">
<sel>scanString:</sel>
<arg type="NSString*">aString</arg>
<sel>intoString:</sel>
<arg type="NSString**">stringValue</arg>
<desc>
After initial skipping (if any), this method scans for
<em>aString</em> and places the string ound in <em>stringValue</em>
if that is not null.
<br/>
Returns YES if anything is scanned, NO otherwise.
</desc>
</method>
<method type="BOOL">
<sel>scanUpToCharactersFromSet:</sel>
<arg type="NSCharacterSet*">set</arg>
<sel>intoString:</sel>
<arg type="NSString**">stringValue</arg>
<desc>
After initial skipping (if any), this method scans characters until
it finds one in <em>set</em>. The scanned characters are placed in
<em>stringValue</em> if that is not null.
<br/>
Returns YES if anything is scanned, NO otherwise.
</desc>
</method>
<method type="BOOL">
<sel>scanUpToString:</sel>
<arg type="NSString*">aString</arg>
<sel>intoString:</sel>
<arg type="NSString**">stringValue</arg>
<desc>
After initial skipping (if any), this method scans characters until
it finds <em>aString</em>. The scanned characters are placed in
<em>stringValue</em> if that is not null. If <em>aString</em> is
not found, all the characters up to the end of the scanned string
will be returned.
<br/>
Returns YES if anything is scanned, NO otherwise.
</desc>
</method>
<method type="void">
<sel>setCaseSensitive:</sel>
<arg type="BOOL">flag</arg>
<desc>
Sets the case sensitivity of the scanner.
<br/>
Case sensitivity governs matrching of characters being scanned,
but does not effect the characters in the set to be skipped.
<br/>
The default is for a scanner to <em>not</em> be case sensitive.
</desc>
</method>
<method type="void">
<sel>setCharactersToBeSkipped:</sel>
<arg type="NSCharacterSet*">skipSet</arg>
<desc>
Sets the set of characters that the scanner will skip over at the
start of each scanning operation to be <em>skipSet</em>.
Skipping is performed by literal character matchins - the case
sensitivity of the scanner does not effect it.
If this is set to nil, no skipping is done.
<br/>
The default for this is the whitespaceAndNewlineCharacterSet.
</desc>
</method>
<method type="void" id="setLocale:">
<sel>setLocale:</sel>
<arg type="NSDictionary*">aLocale</arg>
<desc>
This method sets the locale used by the scanner to <em>aLocale</em>.
The locale may be set to nil.
</desc>
</method>
<method type="void">
<sel>setScanLocation:</sel>
<arg type="unsigned int">index</arg>
<desc>
This method sets the location in the scanned string at which the
next scan operation begins.
Raises an NSRangeException if index is beyond the end of the
scanned string.
</desc>
</method>
<method type="NSString*">
<sel>string</sel>
<desc>
Returns the string used by the scanner.
</desc>
</method>
</class>
</chapter>
</body>
</gsdoc>