ICU-1292 remove unirange; no longer needed due to pragma use variable range xxxx xxxx

X-SVN-Rev: 6677
This commit is contained in:
Alan Liu 2001-11-07 20:02:16 +00:00
parent f312dc5a1c
commit 1657c4c4c9
5 changed files with 1 additions and 207 deletions

View File

@ -66,7 +66,7 @@ ucal.o calendar.o gregocal.o timezone.o simpletz.o \
sortkey.o bocsu.o coleitr.o coll.o ucoleitr.o \
ucol.o ucol_bld.o ucol_cnt.o ucol_elm.o ucol_tok.o ucol_wgt.o tblcoll.o \
strmatch.o usearch.o search.o stsearch.o \
uniset.o unifltlg.o unirange.o translit.o utrans.o \
uniset.o unifltlg.o translit.o utrans.o \
cpdtrans.o hextouni.o rbt.o rbt_data.o rbt_pars.o rbt_rule.o rbt_set.o \
dbbi.o dbbi_tbl.o rbbi.o rbbi_tbl.o nultrans.o \
remtrans.o titletrn.o tolowtrn.o toupptrn.o xformtrn.o \

View File

@ -354,10 +354,6 @@ SOURCE=.\unifltlg.cpp
# End Source File
# Begin Source File
SOURCE=.\unirange.cpp
# End Source File
# Begin Source File
SOURCE=.\uniset.cpp
# End Source File
# Begin Source File
@ -1670,10 +1666,6 @@ InputPath=.\unicode\unimatch.h
# End Source File
# Begin Source File
SOURCE=.\unirange.h
# End Source File
# Begin Source File
SOURCE=.\unicode\uniset.h
!IF "$(CFG)" == "i18n - Win32 Release"

View File

@ -15,7 +15,6 @@
#include "rbt_rule.h"
#include "strmatch.h"
#include "symtable.h"
#include "unirange.h"
#include "uvector.h"
#include "unicode/parseerr.h"
#include "unicode/parsepos.h"

View File

@ -1,120 +0,0 @@
/*
**********************************************************************
* Copyright (C) 1999, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 11/17/99 aliu Creation.
**********************************************************************
*/
#include "unirange.h"
#include "uvector.h"
#include "unicode/unistr.h"
// For UVector of UnicodeRange* objects
U_CDECL_BEGIN
static void U_CALLCONV
UnicodeRange_deleter(void* e) {
delete (UnicodeRange*) e;
}
U_CDECL_END
U_NAMESPACE_BEGIN
UnicodeRange::UnicodeRange(UChar theStart, int32_t theLength) {
start = theStart;
length = theLength;
}
UnicodeRange* UnicodeRange::clone() const {
return new UnicodeRange(start, length);
}
/**
* CALLER OWNS RESULT.
*/
UBool UnicodeRange::contains(UChar c) const {
return c >= start && (c - start) < length;
}
/**
* Assume that contains(c) is true. Split this range into two new
* ranges around the character c. Make this range one of the new ranges
* (modify it in place) and return the other new range. The character
* itself is not included in either range. If the split results in an
* empty range (that is, if c == start or c == start + length - 1) then
* return null.
*
* MODIFIES THIS RANGE IN PLACE.
*
* CALLER OWNS RESULT.
*/
UnicodeRange* UnicodeRange::split(UChar c) {
if (c == start) {
++start;
--length;
return 0;
} else if (c - start == length - 1) {
--length;
return 0;
} else {
++c;
UnicodeRange* r = new UnicodeRange(c, start + length - c);
length = --c - start;
return r;
}
}
/**
* Finds the largest unused subrange by the given string. A
* subrange is unused by a string if the string contains no
* characters in that range. If the given string contains no
* characters in this range, then this range itself is
* returned.
*
* CALLER OWNS RESULT.
*/
UnicodeRange*
UnicodeRange::largestUnusedSubrange(const UnicodeString& str, UErrorCode &status) const {
int32_t n = str.length();
UVector v(status);
if (U_FAILURE(status)) {
return NULL;
}
v.setDeleter(UnicodeRange_deleter);
v.addElement(clone(), status);
for (int32_t i=0; i<n; ++i) {
UChar c = str.charAt(i);
if (contains(c)) {
for (int32_t j=0; j<v.size(); ++j) {
UnicodeRange* r = (UnicodeRange*) v.elementAt(j);
if (r->contains(c)) {
r = r->split(c);
if (r != 0) {
v.addElement(r, status);
}
break;
}
}
}
}
UnicodeRange* bestRange = 0;
int32_t ibest = -1;
for (int32_t j=0; j<v.size(); ++j) {
UnicodeRange* r = (UnicodeRange*) v.elementAt(j);
if (bestRange == 0 || r->length > bestRange->length) {
bestRange = r;
ibest = j;
}
}
v.orphanElementAt(ibest); // So bestRange doesn't get deleted
return bestRange;
}
U_NAMESPACE_END

View File

@ -1,77 +0,0 @@
/*
**********************************************************************
* Copyright (C) {1999}, International Business Machines Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 11/17/99 aliu Creation.
**********************************************************************
*/
#ifndef UNIRANGE_H
#define UNIRANGE_H
#include "unicode/utypes.h"
U_NAMESPACE_BEGIN
class UnicodeString;
/**
* %%% INTERNAL CLASS USED BY RuleBasedTransliterator %%%
*
* A range of Unicode characters. Support the operations of testing for
* inclusion (does this range contain this character?) and splitting.
* Splitting involves breaking a range into two smaller ranges around a
* character inside the original range. The split character is not included
* in either range. If the split character is at either extreme end of the
* range, one of the split products is an empty range.
*
* This class is used internally to determine the largest available private
* use character range for variable stand-ins.
*/
class UnicodeRange {
public:
UChar start;
int32_t length;
UnicodeRange(UChar start, int32_t length);
/**
* CALLER OWNS RESULT.
*/
UnicodeRange* clone() const;
UBool contains(UChar c) const;
/**
* Assume that contains(c) is true. Split this range into two new
* ranges around the character c. Make this range one of the new ranges
* (modify it in place) and return the other new range. The character
* itself is not included in either range. If the split results in an
* empty range (that is, if c == start or c == start + length - 1) then
* return null.
*
* MODIFIES THIS RANGE IN PLACE.
*
* CALLER OWNS RESULT.
*/
UnicodeRange* split(UChar c);
/**
* Finds the largest subrange of this range that is unused by the
* given string. A subrange is unused by a string if the string
* contains no characters in that range. If the given string
* contains no characters in this range, then this range itself is
* returned.
*
* CALLER OWNS RESULT.
*/
UnicodeRange* largestUnusedSubrange(const UnicodeString& str, UErrorCode &status) const;
};
U_NAMESPACE_END
#endif