mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 12:16:40 +00:00
Some optimisation.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26783 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8beea23511
commit
c2b6a65594
6 changed files with 96 additions and 12 deletions
|
@ -216,6 +216,16 @@ typedef struct {
|
|||
#define GSEQ_S GSEQ_CS
|
||||
#include "GSeq.h"
|
||||
|
||||
/*
|
||||
* Include sequence handling code with instructions to generate search
|
||||
* and compare functions for NSString objects.
|
||||
*/
|
||||
#define GSEQ_STRCOMP strCompNsNs
|
||||
#define GSEQ_STRRANGE strRangeNsNs
|
||||
#define GSEQ_O GSEQ_NS
|
||||
#define GSEQ_S GSEQ_NS
|
||||
#include "GSeq.h"
|
||||
|
||||
static Class NSDataClass = 0;
|
||||
static Class NSStringClass = 0;
|
||||
static Class GSStringClass = 0;
|
||||
|
@ -254,6 +264,10 @@ setup(void)
|
|||
{
|
||||
beenHere = YES;
|
||||
|
||||
caiSel = @selector(characterAtIndex:);
|
||||
gcrSel = @selector(getCharacters:range:);
|
||||
ranSel = @selector(rangeOfComposedCharacterSequenceAtIndex:);
|
||||
|
||||
/*
|
||||
* Cache the default string encoding, and set the internal encoding
|
||||
* used by 8-bit character strings to match if possible.
|
||||
|
@ -2470,6 +2484,47 @@ rangeOfCharacter_u(GSStr self, NSCharacterSet *aSet, unsigned mask,
|
|||
return range;
|
||||
}
|
||||
|
||||
GSRSFunc
|
||||
GSPrivateRangeOfString(NSString *receiver, NSString *target)
|
||||
{
|
||||
Class c;
|
||||
|
||||
c = GSObjCClass(receiver);
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||
|| (c == GSMutableStringClass && ((GSStr)receiver)->_flags.wide == 1))
|
||||
{
|
||||
c = GSObjCClass(target);
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||
|| (c == GSMutableStringClass && ((GSStr)target)->_flags.wide == 1))
|
||||
return (GSRSFunc)strRangeUsUs;
|
||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||
|| c == NSConstantStringClass
|
||||
|| (c == GSMutableStringClass && ((GSStr)target)->_flags.wide == 0))
|
||||
return (GSRSFunc)strRangeUsCs;
|
||||
else
|
||||
return (GSRSFunc)strRangeUsNs;
|
||||
}
|
||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||
|| c == NSConstantStringClass
|
||||
|| (c == GSMutableStringClass && ((GSStr)target)->_flags.wide == 0))
|
||||
{
|
||||
c = GSObjCClass(target);
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES
|
||||
|| (c == GSMutableStringClass && ((GSStr)target)->_flags.wide == 1))
|
||||
return (GSRSFunc)strRangeCsUs;
|
||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES
|
||||
|| c == NSConstantStringClass
|
||||
|| (c == GSMutableStringClass && ((GSStr)target)->_flags.wide == 0))
|
||||
return (GSRSFunc)strRangeCsCs;
|
||||
else
|
||||
return (GSRSFunc)strRangeCsNs;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (GSRSFunc)strRangeNsNs;
|
||||
}
|
||||
}
|
||||
|
||||
static inline NSRange
|
||||
rangeOfString_c(GSStr self, NSString *aString, unsigned mask, NSRange aRange)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue