This is RCString.h in view mode; [Download] [Up]
#import <objc/objc.h>
#import <objc/Object.h>
#import <string.h>
#import <stdlib.h>
#import <libc.h>
//
// Reference Counting String Class
//
/*
Copyright (C) 1992. Bruce Ediger.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License.
*/
// internal string representation
struct srep {
char *s; // pointer to ASCIIZ data
int n; // reference count
int l; // string length
};
// basic object
@interface RCString : Object
{
struct srep *p;
BOOL yCaseSensitive;
}
+ new;
+ newFromString: (char *) anAsciiString;
+ newFromObject: (RCString *) aStringObject;
- newFromObject;
+ newFilledWith: (int) aCharacter size: (int) number;
- free;
- init;
// force a copy of the internal string rep
- copyReference;
// methods for obtaining info about String object
- (unsigned)length;
- (char *)data;
- (int)references;
- (struct srep *)internal;
- (BOOL) isNull;
@end
// categories - mostly for organizational convenience
@interface RCString (Misc)
- empty;
- toUpper;
- toLower;
- replaceWithAsciiString: (char *)aString;
- replaceWithObject: (RCString *)anObject;
- performArbitraryFunction:(int (*)())someFunction;
@end
@interface RCString (Comparison)
- (int)compareWithObject: (RCString *)anotherObject;
- (int)compareWithString: (char *)anAsciiString;
- caseSensitive: (BOOL)isOrNot;
@end
@interface RCString (Insertion)
- appendObject: (RCString *)anotherObject;
- prependObject: (RCString *)anotherObject;
- insertObject: (RCString *)anotherObject at:(int)index;
- replaceStringAt:(int)index extent:(int)length with:(char *)aString;
- replaceStringAt:(int)index extent:(int)length with:(char *)aString extent:(int)length;
- appendString: (char *)anAsciiString;
- prependString: (char *)anAsciiString;
- insertString: (char *)anAsciiString at:(int)index;
@end
@interface RCString (Retrieval)
- (char *)subStringAt:(int)index extent:(int)length;
- subObjectAt:(int)index extent:(int)length;
@end
@interface RCString (Characters)
- (int)retrieveCharacterAt:(int)index;
- substituteCharacter:(int)aChar at:(int)index;
- insertCharacter:(int)aChar at:(int)index;
- (int)indexOfCharacter:(int)aChar;
- (int)lastIndexOfCharacter:(int)aChar;
@end
@interface RCString (Regex)
- (char *)subStringMatching:(char *)aRegex;
- replaceSubStringMatching:(char *)aRegex with:(char *)aString;
- objectMatching:(char *)aRegex;
- (BOOL)matches:(char *)aRegex;
@end
@interface RCString (Archiving)
// From John Hassey's String class: should be compatible.
- storeOn:(int)aFD;
- readFrom:(int)aFD;
#ifdef NeXT
- read:(NXTypedStream *)aStream;
- write:(NXTypedStream *)aStream;
#endif
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.