|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.0 (the 'License'). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License."
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24: /*
25: NXMutableString.m
26: Copyright 1991, NeXT, Inc.
27: Responsibility:
28: */
29: #ifndef KERNEL
30: #ifdef SHLIB
31: #import "shlib.h"
32: #endif SHLIB
33:
34: #import "NXStringPrivate.h"
35:
36: @implementation NXMutableString
37:
38: - (void)replaceCharactersInRange:(NXRange)range withString:(NXString *)string
39: {
40: [self subclassResponsibility:_cmd];
41: }
42:
43: - (void)insertString:(NXString *)string at:(unsigned)loc
44: {
45: NXRange range = {loc, 0};
46: [self replaceCharactersInRange:range withString:string];
47: }
48:
49: - (void)appendString:(NXString *)string
50: {
51: NXRange range = {[self length], 0};
52: [self replaceCharactersInRange:range withString:string];
53: }
54:
55: - (void)deleteCharactersInRange:(NXRange)range
56: {
57: [self replaceCharactersInRange:range withString:@""];
58: }
59:
60: - mutableCopyFromZone:(NXZone *)zone
61: {
62: return [self copyFromZone:zone];
63: }
64:
65: - immutableCopyFromZone:(NXZone *)zone
66: {
67: return [[NXReadOnlyString allocFromZone:zone] initFromString:self];
68: }
69:
70: #ifndef DONT_USE_OLD_NXSTRING_NAMES
71:
72: /* Compatibility stuff. These are 2.x/3.0 methods which should be preserved for 3.x but removed in 4.0.
73: */
74:
75: - (void)replaceRange:(NXStringRange)range with:(NXString *)string
76: {
77: [self replaceCharactersInRange:range withString:string];
78: }
79:
80: - (void)replaceWith:(NXString *)string
81: {
82: [self replaceCharactersInRange:(NXRange){0, [self length]} withString:string];
83: }
84:
85: - (void)insert:(NXString *)string at:(unsigned)loc
86: {
87: [self insertString:string at:loc];
88: }
89:
90: - (void)append:(NXString *)string
91: {
92: [self appendString:string];
93: }
94:
95: - (void)deleteRange:(NXStringRange)range
96: {
97: [self deleteCharactersInRange:range];
98: }
99:
100: #endif DONT_USE_OLD_NXSTRING_NAMES
101:
102: @end
103:
104: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.