1995-05-05 21:03:04 +00:00
|
|
|
/* Interface for NSCharacterSet for GNUStep
|
1995-07-01 19:01:11 +00:00
|
|
|
Copyright (C) 1995 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Adam Fedor <fedor@boulder.colorado.edu>
|
|
|
|
Date: 1995
|
1995-05-05 21:03:04 +00:00
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
1995-05-05 21:03:04 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
1999-09-09 02:56:20 +00:00
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
1999-09-16 07:21:34 +00:00
|
|
|
*/
|
1995-05-05 21:03:04 +00:00
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#ifndef __NSCharacterSet_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSCharacterSet_h_GNUSTEP_BASE_INCLUDE
|
1995-05-05 21:03:04 +00:00
|
|
|
|
|
|
|
#include <Foundation/NSString.h>
|
|
|
|
|
|
|
|
@class NSData;
|
|
|
|
|
2005-03-06 09:15:08 +00:00
|
|
|
/**
|
|
|
|
* Represents a set of unicode characters. Used by [NSScanner] and [NSString]
|
|
|
|
* for parsing-related methods.
|
|
|
|
*/
|
1998-07-15 12:42:26 +00:00
|
|
|
@interface NSCharacterSet : NSObject <NSCoding, NSCopying, NSMutableCopying>
|
1995-05-05 21:03:04 +00:00
|
|
|
|
2005-03-06 09:15:08 +00:00
|
|
|
/**
|
|
|
|
* Returns a character set containing letters, numbers, and diacritical
|
|
|
|
* marks. Note that "letters" includes all alphabetic as well as Chinese
|
|
|
|
* characters, etc..
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) alphanumericCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
/**
|
|
|
|
* Returns a character set containing letters in the unicode
|
|
|
|
* Titlecase category.
|
|
|
|
*/
|
|
|
|
+ (NSCharacterSet*) capitalizedLetterCharacterSet;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set containing control and format characters.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) controlCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set containing characters that represent
|
|
|
|
* the decimal digits 0 through 9.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) decimalDigitCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set containing individual charactars that
|
|
|
|
* can be represented also by a composed character sequence.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) decomposableCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set containing unassigned (illegal)
|
|
|
|
* character values.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) illegalCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set containing letters, including all alphabetic as
|
|
|
|
* well as Chinese characters, etc..
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) letterCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set that contains the lowercase characters.
|
|
|
|
* This set does not include caseless characters, only those that
|
|
|
|
* have corresponding characters in uppercase and/or titlecase.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) lowercaseLetterCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set containing characters for diacritical marks, which
|
|
|
|
* are usually only rendered in conjunction with another character.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) nonBaseCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set containing punctuation marks.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) punctuationCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set containing mathematical symbols, etc..
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) symbolAndOperatorCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set that contains the uppercase characters.
|
|
|
|
* This set does not include caseless characters, only those that
|
|
|
|
* have corresponding characters in lowercase and/or titlecase.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) uppercaseLetterCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set that contains the whitespace characters,
|
|
|
|
* plus the newline characters, values 0x000A and 0x000D and nextline
|
|
|
|
* 0x0085 character.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) whitespaceAndNewlineCharacterSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set that contains the whitespace characters.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) whitespaceCharacterSet;
|
1995-05-05 21:03:04 +00:00
|
|
|
|
2005-03-06 09:15:08 +00:00
|
|
|
/**
|
|
|
|
* Returns a character set containing characters as encoded in the
|
|
|
|
* data object (8192 bytes)
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) characterSetWithBitmapRepresentation: (NSData*)data;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns set with characters in aString, or empty set for empty string.
|
|
|
|
* Raises an exception if given a nil string.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) characterSetWithCharactersInString: (NSString*)aString;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns set containing unicode index range given by aRange.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (NSCharacterSet*) characterSetWithRange: (NSRange)aRange;
|
1995-05-05 21:03:04 +00:00
|
|
|
|
2005-03-06 09:15:08 +00:00
|
|
|
#ifndef STRICT_MACOS_X
|
|
|
|
/**
|
2005-03-06 10:21:18 +00:00
|
|
|
* Initializes from a bitmap (4096 bytes representing 65536 values).
|
|
|
|
* File must have extension "<code>.bitmap</code>".
|
|
|
|
* To get around this load the file into data yourself and use
|
2005-03-06 09:15:08 +00:00
|
|
|
* [NSCharacterSet -characterSetWithBitmapRepresentation].
|
|
|
|
*/
|
|
|
|
+ (NSCharacterSet*) characterSetWithContentsOfFile: (NSString*)aFile;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a bitmap representation of the receiver's character set
|
|
|
|
* suitable for archiving or writing to a file, in an NSData object.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (NSData*) bitmapRepresentation;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns YES if the receiver contains <em>aCharacter</em>, NO if
|
|
|
|
* it does not.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (BOOL) characterIsMember: (unichar)aCharacter;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a character set containing only characters that the
|
|
|
|
* receiver does not contain.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (NSCharacterSet*) invertedSet;
|
1995-05-05 21:03:04 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2005-03-06 09:15:08 +00:00
|
|
|
/**
|
|
|
|
* An [NSCharacterSet] that can be modified.
|
|
|
|
*/
|
1998-07-15 12:42:26 +00:00
|
|
|
@interface NSMutableCharacterSet : NSCharacterSet
|
1995-05-05 21:03:04 +00:00
|
|
|
|
2005-03-06 09:15:08 +00:00
|
|
|
/**
|
|
|
|
* Adds characters specified by unicode indices in aRange to set.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) addCharactersInRange: (NSRange)aRange;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds characters in aString to set.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) addCharactersInString: (NSString*)aString;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set union of character sets.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) formUnionWithCharacterSet: (NSCharacterSet*)otherSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set intersection of character sets.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) formIntersectionWithCharacterSet: (NSCharacterSet*)otherSet;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Drop given range of characters. No error for characters not currently in
|
|
|
|
* set.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) removeCharactersInRange: (NSRange)aRange;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Drop characters in aString. No error for characters not currently in
|
|
|
|
* set.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) removeCharactersInString: (NSString*)aString;
|
2005-03-06 09:15:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove all characters currently in set and add all other characters.
|
|
|
|
*/
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) invert;
|
1995-05-05 21:03:04 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
1999-09-16 07:21:34 +00:00
|
|
|
#endif /* __NSCharacterSet_h_GNUSTEP_BASE_INCLUDE*/
|