mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Tidyup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8533 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f47f73cb11
commit
ede24b003d
7 changed files with 82 additions and 162 deletions
|
@ -1,3 +1,12 @@
|
|||
2001-01-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSGAttributedString.h: removed
|
||||
* Source/NSGAttributedString.m: renamed to GSAttributedString.m
|
||||
concrete classes renamed for consistency with other gstep libs.
|
||||
* Source/NSAttributedString.m: classes renamed
|
||||
* Source/GNUmakefile: replace NSGAttrinbutedString with GS.
|
||||
Don't try to install old header.
|
||||
|
||||
2001-01-08 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* configure.in: Enable ffcall by default (unless the libraries
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/* Interface to concrete implementation of NSArray based on GNU Array
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: March 1995
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
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
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSGArray_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSGArray_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
|
||||
@interface NSGArray : NSArray
|
||||
{
|
||||
id *_contents_array;
|
||||
unsigned int _count;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NSGMutableArray : NSMutableArray
|
||||
{
|
||||
id *_contents_array;
|
||||
unsigned int _count;
|
||||
unsigned int _capacity;
|
||||
int _grow_factor;
|
||||
}
|
||||
@end
|
||||
|
||||
#endif /* __NSGArray_h_GNUSTEP_BASE_INCLUDE */
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
NSGAttributedString.h
|
||||
|
||||
Concrete subclass of a string class with attributes
|
||||
|
||||
Copyright (C) 1997,1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by: ANOQ of the sun <anoq@vip.cybercity.dk>
|
||||
Date: November 1997
|
||||
Rewrite by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: April 1999
|
||||
|
||||
This file is part of GNUStep-base
|
||||
|
||||
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.
|
||||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
|
||||
/* Warning - [-initWithString:attributes:] is the designated initialiser,
|
||||
* but it doesn't provide any way to perform the function of the
|
||||
* [-initWithAttributedString:] initialiser.
|
||||
* In order to work youd this, the string argument of the
|
||||
* designated initialiser has been overloaded such that it
|
||||
* is expected to accept an NSAttributedString here instead of
|
||||
* a string. If you create an NSAttributedString subclass, you
|
||||
* must make sure that your implementation of the initialiser
|
||||
* copes with either an NSString or an NSAttributedString.
|
||||
* If it receives an NSAttributedString, it should ignore the
|
||||
* attributes argument and use the values from the string.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NSGAttributedString_h_INCLUDE
|
||||
#define _NSGAttributedString_h_INCLUDE
|
||||
|
||||
#include "Foundation/NSAttributedString.h"
|
||||
|
||||
@interface NSGAttributedString : NSAttributedString
|
||||
{
|
||||
NSString *_textChars;
|
||||
NSMutableArray *_infoArray;
|
||||
}
|
||||
|
||||
- (id) initWithString: (NSString*)aString
|
||||
attributes: (NSDictionary*)attributes;
|
||||
- (NSString*) string;
|
||||
- (NSDictionary*) attributesAtIndex: (unsigned)index
|
||||
effectiveRange: (NSRange*)aRange;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSGMutableAttributedString : NSMutableAttributedString
|
||||
{
|
||||
NSMutableString *_textChars;
|
||||
NSMutableArray *_infoArray;
|
||||
}
|
||||
|
||||
- (id) initWithString: (NSString*)aString
|
||||
attributes: (NSDictionary*)attributes;
|
||||
- (NSString*) string;
|
||||
- (NSDictionary*) attributesAtIndex: (unsigned)index
|
||||
effectiveRange: (NSRange*)aRange;
|
||||
- (void) setAttributes: (NSDictionary*) attributes
|
||||
range: (NSRange)range;
|
||||
- (void) replaceCharactersInRange: (NSRange)range
|
||||
withString: (NSString*)aString;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* _NSGAttributedString_h_INCLUDE */
|
|
@ -145,6 +145,7 @@ preface.h
|
|||
|
||||
BASE_MFILES = \
|
||||
GSArray.m \
|
||||
GSAttributedString.m \
|
||||
GSCountedSet.m \
|
||||
GSHTTPURLHandle.m \
|
||||
GSMime.m \
|
||||
|
@ -182,7 +183,6 @@ NSFileHandle.m \
|
|||
NSFileManager.m \
|
||||
NSFormatter.m \
|
||||
NSGeometry.m \
|
||||
NSGAttributedString.m \
|
||||
NSGDictionary.m \
|
||||
NSHashTable.m \
|
||||
NSHost.m \
|
||||
|
@ -296,7 +296,6 @@ NSFileHandle.h \
|
|||
NSFileManager.h \
|
||||
NSFormatter.h \
|
||||
NSGeometry.h \
|
||||
NSGAttributedString.h \
|
||||
NSHashTable.h \
|
||||
NSHost.h \
|
||||
NSInvocation.h \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
NSGAttributedString.m
|
||||
GSAttributedString.m
|
||||
|
||||
Implementation of concrete subclass of a string class with attributes
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include <base/preface.h>
|
||||
#include <Foundation/NSGAttributedString.h>
|
||||
#include <Foundation/NSAttributedString.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSRange.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
|
@ -57,6 +57,40 @@
|
|||
|
||||
#define SANITY_CHECKS 0
|
||||
|
||||
@interface GSAttributedString : NSAttributedString
|
||||
{
|
||||
NSString *_textChars;
|
||||
NSMutableArray *_infoArray;
|
||||
}
|
||||
|
||||
- (id) initWithString: (NSString*)aString
|
||||
attributes: (NSDictionary*)attributes;
|
||||
- (NSString*) string;
|
||||
- (NSDictionary*) attributesAtIndex: (unsigned)index
|
||||
effectiveRange: (NSRange*)aRange;
|
||||
|
||||
@end
|
||||
|
||||
@interface GSMutableAttributedString : NSMutableAttributedString
|
||||
{
|
||||
NSMutableString *_textChars;
|
||||
NSMutableArray *_infoArray;
|
||||
}
|
||||
|
||||
- (id) initWithString: (NSString*)aString
|
||||
attributes: (NSDictionary*)attributes;
|
||||
- (NSString*) string;
|
||||
- (NSDictionary*) attributesAtIndex: (unsigned)index
|
||||
effectiveRange: (NSRange*)aRange;
|
||||
- (void) setAttributes: (NSDictionary*) attributes
|
||||
range: (NSRange)range;
|
||||
- (void) replaceCharactersInRange: (NSRange)range
|
||||
withString: (NSString*)aString;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#define GSI_MAP_RETAIN_KEY(X)
|
||||
#define GSI_MAP_RELEASE_KEY(X)
|
||||
#define GSI_MAP_RETAIN_VAL(X)
|
||||
|
@ -199,7 +233,7 @@ unCacheAttributes(NSDictionary *attrs)
|
|||
|
||||
|
||||
|
||||
@implementation NSGAttributedString
|
||||
@implementation GSAttributedString
|
||||
|
||||
static Class infCls = 0;
|
||||
|
||||
|
@ -459,7 +493,7 @@ _attributesAtIndexEffectiveRange(
|
|||
@end
|
||||
|
||||
|
||||
@implementation NSGMutableAttributedString
|
||||
@implementation GSMutableAttributedString
|
||||
|
||||
#if SANITY_CHECKS
|
||||
|
||||
|
@ -490,7 +524,7 @@ _attributesAtIndexEffectiveRange(
|
|||
|
||||
+ (void) initialize
|
||||
{
|
||||
[NSGAttributedString class]; // Ensure immutable class is initialised
|
||||
[GSAttributedString class]; // Ensure immutable class is initialised
|
||||
}
|
||||
|
||||
- (id) initWithString: (NSString*)aString
|
|
@ -48,12 +48,13 @@
|
|||
#include <base/Unicode.h>
|
||||
|
||||
#include <Foundation/NSAttributedString.h>
|
||||
#include <Foundation/NSGAttributedString.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSPortCoder.h>
|
||||
#include <Foundation/NSRange.h>
|
||||
|
||||
@class GSAttributedString;
|
||||
@class GSMutableAttributedString;
|
||||
@class NSGMutableDictionary;
|
||||
static Class dictionaryClass = 0;
|
||||
|
||||
|
@ -84,21 +85,21 @@ static IMP remDictImp;
|
|||
|
||||
@implementation NSAttributedString
|
||||
|
||||
static Class NSAttributedString_abstract_class;
|
||||
static Class NSAttributedString_concrete_class;
|
||||
static Class NSMutableAttributedString_abstract_class;
|
||||
static Class NSMutableAttributedString_concrete_class;
|
||||
static Class NSAttributedStringClass;
|
||||
static Class GSAttributedStringClass;
|
||||
static Class NSMutableAttributedStringClass;
|
||||
static Class GSMutableAttributedStringClass;
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSAttributedString class])
|
||||
{
|
||||
NSAttributedString_abstract_class = self;
|
||||
NSAttributedString_concrete_class = [NSGAttributedString class];
|
||||
NSMutableAttributedString_abstract_class
|
||||
NSAttributedStringClass = self;
|
||||
GSAttributedStringClass = [GSAttributedString class];
|
||||
NSMutableAttributedStringClass
|
||||
= [NSMutableAttributedString class];
|
||||
NSMutableAttributedString_concrete_class
|
||||
= [NSGMutableAttributedString class];
|
||||
GSMutableAttributedStringClass
|
||||
= [GSMutableAttributedString class];
|
||||
dictionaryClass = [NSGMutableDictionary class];
|
||||
|
||||
eqSel = @selector(isEqual:);
|
||||
|
@ -122,15 +123,15 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
if (self == NSAttributedString_abstract_class)
|
||||
return NSAllocateObject(NSAttributedString_concrete_class, 0, z);
|
||||
if (self == NSAttributedStringClass)
|
||||
return NSAllocateObject(GSAttributedStringClass, 0, z);
|
||||
else
|
||||
return NSAllocateObject(self, 0, z);
|
||||
}
|
||||
|
||||
- (Class) classForCoder
|
||||
{
|
||||
return NSAttributedString_abstract_class;
|
||||
return NSAttributedStringClass;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
|
@ -209,7 +210,7 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
{
|
||||
if ([self isKindOfClass: [NSMutableAttributedString class]]
|
||||
|| NSShouldRetainWithZone(self, zone) == NO)
|
||||
return [[NSAttributedString_concrete_class allocWithZone: zone]
|
||||
return [[GSAttributedStringClass allocWithZone: zone]
|
||||
initWithAttributedString: self];
|
||||
else
|
||||
return RETAIN(self);
|
||||
|
@ -218,7 +219,7 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
//NSMutableCopying protocol
|
||||
- (id) mutableCopyWithZone: (NSZone*)zone
|
||||
{
|
||||
return [[NSMutableAttributedString_concrete_class allocWithZone: zone]
|
||||
return [[GSMutableAttributedStringClass allocWithZone: zone]
|
||||
initWithAttributedString: self];
|
||||
}
|
||||
|
||||
|
@ -481,7 +482,7 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
{
|
||||
if (anObject == self)
|
||||
return YES;
|
||||
if ([anObject isKindOfClass: NSAttributedString_abstract_class])
|
||||
if ([anObject isKindOfClass: NSAttributedStringClass])
|
||||
return [self isEqualToAttributedString: anObject];
|
||||
return NO;
|
||||
}
|
||||
|
@ -504,7 +505,7 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
range = NSIntersectionRange(range, aRange);
|
||||
if (NSEqualRanges(range, aRange) == YES)
|
||||
{
|
||||
newAttrString = [NSAttributedString_concrete_class alloc];
|
||||
newAttrString = [GSAttributedStringClass alloc];
|
||||
newAttrString = [newAttrString initWithString: newSubstring
|
||||
attributes: attrs];
|
||||
}
|
||||
|
@ -513,7 +514,7 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
NSMutableAttributedString *m;
|
||||
NSRange rangeToSet = range;
|
||||
|
||||
m = [NSMutableAttributedString_concrete_class alloc];
|
||||
m = [GSMutableAttributedStringClass alloc];
|
||||
m = [m initWithString: newSubstring attributes: nil];
|
||||
rangeToSet.location = 0;
|
||||
[m setAttributes: attrs range: rangeToSet];
|
||||
|
@ -544,15 +545,15 @@ static Class NSMutableAttributedString_concrete_class;
|
|||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
if (self == NSMutableAttributedString_abstract_class)
|
||||
return NSAllocateObject(NSMutableAttributedString_concrete_class, 0, z);
|
||||
if (self == NSMutableAttributedStringClass)
|
||||
return NSAllocateObject(GSMutableAttributedStringClass, 0, z);
|
||||
else
|
||||
return NSAllocateObject(self, 0, z);
|
||||
}
|
||||
|
||||
- (Class) classForCoder
|
||||
{
|
||||
return NSMutableAttributedString_abstract_class;
|
||||
return NSMutableAttributedStringClass;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
|
|
@ -995,7 +995,9 @@ static NSString *indentStrings[] = {
|
|||
[self initWithCapacity: count];
|
||||
setObj = [self methodForSelector: setSel];
|
||||
while (count--)
|
||||
(*setObj)(self, setSel, objects[count], keys[count]);
|
||||
{
|
||||
(*setObj)(self, setSel, objects[count], keys[count]);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -1007,7 +1009,9 @@ static NSString *indentStrings[] = {
|
|||
IMP remObj = [self methodForSelector: remSel];
|
||||
|
||||
while ((k = (*nxtObj)(e, nxtSel)) != nil)
|
||||
(*remObj)(self, remSel, k);
|
||||
{
|
||||
(*remObj)(self, remSel, k);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) removeObjectsForKeys: (NSArray*)keyArray
|
||||
|
@ -1029,15 +1033,18 @@ static NSString *indentStrings[] = {
|
|||
|
||||
- (void) addEntriesFromDictionary: (NSDictionary*)other
|
||||
{
|
||||
if (other != nil)
|
||||
if (other != nil && other != self)
|
||||
{
|
||||
id k;
|
||||
NSEnumerator *e = [other keyEnumerator];
|
||||
IMP nxtObj = [e methodForSelector: nxtSel];
|
||||
IMP getObj = [other methodForSelector: objSel];
|
||||
IMP setObj = [self methodForSelector: setSel];
|
||||
|
||||
while ((k = (*nxtObj)(e, nxtSel)) != nil)
|
||||
(*setObj)(self, setSel, [other objectForKey: k], k);
|
||||
{
|
||||
(*setObj)(self, setSel, (*getObj)(other, objSel, k), k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue