~ubuntu-branches/ubuntu/karmic/gnustep-base/karmic

« back to all changes in this revision

Viewing changes to Headers/Foundation/NSAttributedString.h

  • Committer: Bazaar Package Importer
  • Author(s): Eric Heintzmann
  • Date: 2005-04-17 00:14:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050417001438-enf0y07c9tku85z1
Tags: 1.10.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
   NSAttributedString.h
 
3
 
 
4
   String class with attributes
 
5
 
 
6
   Copyright (C) 1997,1999 Free Software Foundation, Inc.
 
7
 
 
8
   Written by: ANOQ of the sun <anoq@vip.cybercity.dk>
 
9
   Date: November 1997
 
10
   Rewrite by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
 
11
   Date: April 1999
 
12
   
 
13
   This file is part of GNUStep-base
 
14
 
 
15
   This library is free software; you can redistribute it and/or
 
16
   modify it under the terms of the GNU Library General Public
 
17
   License as published by the Free Software Foundation; either
 
18
   version 2 of the License, or (at your option) any later version.
 
19
   
 
20
   This library is distributed in the hope that it will be useful,
 
21
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
22
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
23
   Library General Public License for more details.
 
24
 
 
25
   If you are interested in a warranty or support for this source code,
 
26
   contact Scott Christley <scottc@net-community.com> for more information.
 
27
   
 
28
   You should have received a copy of the GNU Library General Public
 
29
   License along with this library; if not, write to the Free
 
30
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
 
31
*/
 
32
 
 
33
/* Warning -    [-initWithString:attributes:] is the designated initialiser,
 
34
 *              but it doesn't provide any way to perform the function of the
 
35
 *              [-initWithAttributedString:] initialiser.
 
36
 *              In order to work youd this, the string argument of the
 
37
 *              designated initialiser has been overloaded such that it
 
38
 *              is expected to accept an NSAttributedString here instead of
 
39
 *              a string.  If you create an NSAttributedString subclass, you
 
40
 *              must make sure that your implementation of the initialiser
 
41
 *              copes with either an NSString or an NSAttributedString.
 
42
 *              If it receives an NSAttributedString, it should ignore the
 
43
 *              attributes argument and use the values from the string.
 
44
 */
 
45
 
 
46
 
 
47
#ifndef _NSXKit_H_NSAttributedString
 
48
#define _NSXKit_H_NSAttributedString
 
49
 
 
50
#ifndef STRICT_OPENSTEP
 
51
#include <Foundation/NSString.h>
 
52
#include <Foundation/NSDictionary.h>
 
53
#include <Foundation/NSArray.h>
 
54
#include <Foundation/NSCoder.h>
 
55
 
 
56
@interface NSAttributedString : NSObject <NSCoding, NSCopying, NSMutableCopying>
 
57
{
 
58
}
 
59
 
 
60
//Creating an NSAttributedString
 
61
- (id) initWithString: (NSString*)aString;
 
62
- (id) initWithAttributedString: (NSAttributedString*)attributedString;
 
63
- (id) initWithString: (NSString*)aString attributes: (NSDictionary*)attributes;
 
64
 
 
65
//Retrieving character information
 
66
- (unsigned int) length;
 
67
- (NSString*) string;                                   //Primitive method!
 
68
 
 
69
//Retrieving attribute information
 
70
- (NSDictionary*) attributesAtIndex: (unsigned int)index
 
71
                     effectiveRange: (NSRange*)aRange;  //Primitive method!
 
72
- (NSDictionary*) attributesAtIndex: (unsigned int)index
 
73
              longestEffectiveRange: (NSRange*)aRange
 
74
                            inRange: (NSRange)rangeLimit;
 
75
- (id) attribute: (NSString*)attributeName
 
76
         atIndex: (unsigned int)index
 
77
  effectiveRange: (NSRange*)aRange;
 
78
- (id) attribute: (NSString*)attributeName atIndex: (unsigned int)index
 
79
  longestEffectiveRange: (NSRange*)aRange inRange: (NSRange)rangeLimit;
 
80
 
 
81
//Comparing attributed strings
 
82
- (BOOL) isEqualToAttributedString: (NSAttributedString*)otherString;
 
83
 
 
84
//Extracting a substring
 
85
- (NSAttributedString*) attributedSubstringFromRange: (NSRange)aRange;
 
86
 
 
87
#ifndef NO_GNUSTEP
 
88
/*
 
89
 * Synonym for attributedSubstringFromRange: - for consistency with NSString
 
90
 */
 
91
- (NSAttributedString*) attributedSubstringWithRange: (NSRange)aRange;
 
92
#endif
 
93
 
 
94
@end //NSAttributedString
 
95
 
 
96
 
 
97
@interface NSMutableAttributedString : NSAttributedString
 
98
{
 
99
}
 
100
 
 
101
//Retrieving character information
 
102
- (NSMutableString*) mutableString;
 
103
 
 
104
//Changing characters
 
105
- (void) deleteCharactersInRange: (NSRange)aRange;
 
106
 
 
107
//Changing attributes
 
108
- (void) setAttributes: (NSDictionary*)attributes
 
109
                 range: (NSRange)aRange;                //Primitive method!
 
110
- (void) addAttribute: (NSString*)name value: (id)value range: (NSRange)aRange;
 
111
- (void) addAttributes: (NSDictionary*)attributes range: (NSRange)aRange;
 
112
- (void) removeAttribute: (NSString*)name range: (NSRange)aRange;
 
113
 
 
114
//Changing characters and attributes
 
115
- (void) appendAttributedString: (NSAttributedString*)attributedString;
 
116
- (void) insertAttributedString: (NSAttributedString*)attributedString
 
117
                        atIndex: (unsigned int)index;
 
118
- (void) replaceCharactersInRange: (NSRange)aRange
 
119
             withAttributedString: (NSAttributedString*)attributedString;
 
120
- (void) replaceCharactersInRange: (NSRange)aRange
 
121
                       withString: (NSString*)aString;  //Primitive method!
 
122
- (void) setAttributedString: (NSAttributedString*)attributedString;
 
123
 
 
124
//Grouping changes
 
125
- (void) beginEditing;
 
126
- (void) endEditing;
 
127
 
 
128
@end //NSMutableAttributedString
 
129
 
 
130
#endif //STRICT_OPENSTEP
 
131
 
 
132
#endif //_NSXKit_H_NSAttributedString
 
133