Commit 17b5abdb authored by hyatt's avatar hyatt

JavaScriptCore:

        Land the new ICU abstraction layer.  Patch by Lars.

        Reviewed by me

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * wtf/Platform.h:
        * wtf/unicode/UnicodeCategory.h: Removed.
        * wtf/unicode/UnicodeDecomposition.h: Removed.
        * wtf/unicode/UnicodeDirection.h: Removed.
        * wtf/unicode/icu/UnicodeIcu.h:
        (WTF::Unicode::):
        (WTF::Unicode::foldCase):
        (WTF::Unicode::toLower):
        (WTF::Unicode::toUpper):
        (WTF::Unicode::toTitleCase):
        (WTF::Unicode::isDigit):
        (WTF::Unicode::isSpace):
        (WTF::Unicode::isPunct):
        (WTF::Unicode::mirroredChar):
        (WTF::Unicode::category):
        (WTF::Unicode::direction):
        (WTF::Unicode::isLower):
        (WTF::Unicode::isUpper):
        (WTF::Unicode::digitValue):
        (WTF::Unicode::combiningClass):
        (WTF::Unicode::decompositionType):
        (WTF::Unicode::strcasecmp):
        (WTF::Unicode::memset):
        * wtf/unicode/qt4/UnicodeQt4.cpp: Removed.
        * wtf/unicode/qt4/UnicodeQt4.h:
        (WTF::Unicode::):
        (WTF::Unicode::toLower):
        (WTF::Unicode::toUpper):
        (WTF::Unicode::toTitleCase):
        (WTF::Unicode::foldCase):
        (WTF::Unicode::isPrintableChar):
        (WTF::Unicode::isLower):
        (WTF::Unicode::isUpper):
        (WTF::Unicode::digitValue):
        (WTF::Unicode::combiningClass):
        (WTF::Unicode::decompositionType):
        (WTF::Unicode::strcasecmp):
        (WTF::Unicode::memset):
        (WTF::Unicode::direction):
        (WTF::Unicode::category):

WebCore:

        Land the new ICU abstraction layer (WTF::Unicode).  Patch
        by Lars with a couple of fixes thrown in by me.

        Reviewed by hyatt

        * ForwardingHeaders/wtf/icu/UnicodeIcu.h: Added.
        * ForwardingHeaders/wtf/unicode/Unicode.h: Added.
        * WebCore.xcodeproj/project.pbxproj:
        * css/cssparser.cpp:
        (WebCore::ParseString::lower):
        * dom/Document.cpp:
        (WebCore::isValidNameStart):
        (WebCore::isValidNamePart):
        * editing/TextIterator.cpp:
        (WebCore::CircularSearchBuffer::append):
        * html/HTMLFontElement.cpp:
        (WebCore::parseFontSizeNumber):
        * html/HTMLInputElement.cpp:
        (WebCore::numGraphemeClusters):
        (WebCore::numCharactersInGraphemeClusters):
        * html/HTMLSelectElement.cpp:
        (WebCore::stripLeadingWhiteSpace):
        * page/Frame.h:
        * platform/DeprecatedString.h:
        (WebCore::DeprecatedChar::isSpace):
        (WebCore::DeprecatedChar::lower):
        (WebCore::DeprecatedChar::upper):
        * platform/Font.cpp:
        (WebCore::WidthIterator::advance):
        (WebCore::WidthIterator::normalizeVoicingMarks):
        * platform/FontCache.h:
        * platform/FontData.h:
        * platform/GlyphMap.cpp:
        * platform/GlyphMap.h:
        * platform/GlyphWidthMap.h:
        * platform/KURL.cpp:
        (WebCore::encodeHostname):
        * platform/StringHash.h:
        (WTF::):
        * platform/StringImpl.cpp:
        (WebCore::isSpace):
        (WebCore::parseLength):
        (WebCore::StringImpl::isLower):
        (WebCore::StringImpl::lower):
        (WebCore::StringImpl::upper):
        (WebCore::StringImpl::secure):
        (WebCore::StringImpl::foldCase):
        (WebCore::StringImpl::capitalize):
        (WebCore::StringImpl::toInt):
        (WebCore::equalIgnoringCase):
        (WebCore::StringImpl::find):
        * platform/StringImpl.h:
        * platform/TextBoundaries.h:
        * platform/TextBreakIterator.h: Added.
        (WebCore::):
        * platform/TextBreakIteratorICU.cpp: Added.
        (WebCore::wordBreakIterator):
        (WebCore::characterBreakIterator):
        (WebCore::textBreakFirst):
        (WebCore::textBreakNext):
        (WebCore::textBreakPreceding):
        (WebCore::textBreakFollowing):
        (WebCore::textBreakCurrent):
        * platform/TextCodec.h:
        * platform/TextCodecLatin1.cpp:
        * platform/TextEncoding.cpp:
        (WebCore::TextEncoding::encode):
        * platform/TextEncoding.h:
        * platform/TextEncodingRegistry.cpp:
        (WebCore::buildTextEncodingNameMap):
        (WebCore::buildTextCodecMap):
        * platform/TextEncodingRegistry.h:
        * platform/UChar.h: Removed.
        * platform/graphics/GraphicsContext.h:
        * platform/qt/GlyphMapQt.cpp:
        * platform/qt/TextBreakIteratorQt.cpp: Added.
        (WebCore::TextBreakIterator::following):
        (WebCore::TextBreakIterator::preceding):
        (WebCore::WordBreakIteratorQt::first):
        (WebCore::WordBreakIteratorQt::next):
        (WebCore::WordBreakIteratorQt::previous):
        (WebCore::CharBreakIteratorQt::first):
        (WebCore::CharBreakIteratorQt::next):
        (WebCore::CharBreakIteratorQt::previous):
        (WebCore::wordBreakIterator):
        (WebCore::characterBreakIterator):
        (WebCore::textBreakFirst):
        (WebCore::textBreakNext):
        (WebCore::textBreakPreceding):
        (WebCore::textBreakFollowing):
        (WebCore::textBreakCurrent):
        * platform/qt/TextCodecQt.cpp: Added.
        (WebCore::getAtomicName):
        (WebCore::TextCodecQt::registerEncodingNames):
        (WebCore::newTextCodecQt):
        (WebCore::TextCodecQt::registerCodecs):
        (WebCore::TextCodecQt::TextCodecQt):
        (WebCore::TextCodecQt::~TextCodecQt):
        (WebCore::TextCodecQt::decode):
        (WebCore::TextCodecQt::encode):
        * platform/qt/TextCodecQt.h: Added.
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::updateFirstLetter):
        * rendering/RenderText.cpp:
        (WebCore::RenderText::previousOffset):
        (WebCore::RenderText::nextOffset):
        (WebCore::RenderText::widthFromCache):
        * rendering/RenderText.h:
        * rendering/bidi.cpp:
        (WebCore::BidiState::BidiState):
        (WebCore::BidiContext::BidiContext):
        (WebCore::bidiNext):
        (WebCore::bidiFirst):
        (WebCore::BidiIterator::direction):
        (WebCore::appendRun):
        (WebCore::embed):
        (WebCore::RenderBlock::computeHorizontalPositionsForLine):
        (WebCore::RenderBlock::bidiReorderLine):
        (WebCore::RenderBlock::layoutInlineChildren):
        * rendering/bidi.h:
        (WebCore::BidiStatus::BidiStatus):
        (WebCore::BidiContext::dir):
        (WebCore::BidiContext::basicDir):
        (WebCore::BidiRun::BidiRun):
        * rendering/break_lines.h:

WebKit:

        Land new ICU abstraction layer.  Patch by Lars.

        Reviewed by me

        * ForwardingHeaders/wtf/icu/UnicodeIcu.h: Added.
        * ForwardingHeaders/wtf/unicode/Unicode.h: Added.
        * WebKit.xcodeproj/project.pbxproj:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@18098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f83818d4
2006-12-08 David Hyatt <hyatt@apple.com>
Land the new ICU abstraction layer. Patch by Lars.
Reviewed by me
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/Platform.h:
* wtf/unicode/UnicodeCategory.h: Removed.
* wtf/unicode/UnicodeDecomposition.h: Removed.
* wtf/unicode/UnicodeDirection.h: Removed.
* wtf/unicode/icu/UnicodeIcu.h:
(WTF::Unicode::):
(WTF::Unicode::foldCase):
(WTF::Unicode::toLower):
(WTF::Unicode::toUpper):
(WTF::Unicode::toTitleCase):
(WTF::Unicode::isDigit):
(WTF::Unicode::isSpace):
(WTF::Unicode::isPunct):
(WTF::Unicode::mirroredChar):
(WTF::Unicode::category):
(WTF::Unicode::direction):
(WTF::Unicode::isLower):
(WTF::Unicode::isUpper):
(WTF::Unicode::digitValue):
(WTF::Unicode::combiningClass):
(WTF::Unicode::decompositionType):
(WTF::Unicode::strcasecmp):
(WTF::Unicode::memset):
* wtf/unicode/qt4/UnicodeQt4.cpp: Removed.
* wtf/unicode/qt4/UnicodeQt4.h:
(WTF::Unicode::):
(WTF::Unicode::toLower):
(WTF::Unicode::toUpper):
(WTF::Unicode::toTitleCase):
(WTF::Unicode::foldCase):
(WTF::Unicode::isPrintableChar):
(WTF::Unicode::isLower):
(WTF::Unicode::isUpper):
(WTF::Unicode::digitValue):
(WTF::Unicode::combiningClass):
(WTF::Unicode::decompositionType):
(WTF::Unicode::strcasecmp):
(WTF::Unicode::memset):
(WTF::Unicode::direction):
(WTF::Unicode::category):
=== Safari-521.32 ===
2006-12-08 Adam Roben <aroben@apple.com>
......
......@@ -262,9 +262,8 @@
BCF655590A2049710038A194 /* MathExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF6553B0A2048DE0038A194 /* MathExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
D212022A0AD4310D00ED79B6 /* DateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D21202280AD4310C00ED79B6 /* DateMath.cpp */; };
D212022B0AD4310D00ED79B6 /* DateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = D21202290AD4310C00ED79B6 /* DateMath.h */; };
E195679609E7CF1200B89D13 /* UnicodeIcu.h in Headers */ = {isa = PBXBuildFile; fileRef = E195678F09E7CF1200B89D13 /* UnicodeIcu.h */; };
E195679809E7CF1200B89D13 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679409E7CF1200B89D13 /* Unicode.h */; };
E195679909E7CF1200B89D13 /* UnicodeCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679509E7CF1200B89D13 /* UnicodeCategory.h */; };
E195679609E7CF1200B89D13 /* UnicodeIcu.h in Headers */ = {isa = PBXBuildFile; fileRef = E195678F09E7CF1200B89D13 /* UnicodeIcu.h */; settings = {ATTRIBUTES = (Private, ); }; };
E195679809E7CF1200B89D13 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679409E7CF1200B89D13 /* Unicode.h */; settings = {ATTRIBUTES = (Private, ); }; };
/* End PBXBuildFile section */
/* Begin PBXBuildRule section */
......@@ -286,6 +285,23 @@
};
/* End PBXBuildRule section */
/* Begin PBXBuildStyle section */
BC4C649B0B2A359400E57352 /* Development */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = NO;
};
name = Development;
};
BC4C649C0B2A359400E57352 /* Deployment */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = YES;
};
name = Deployment;
};
/* End PBXBuildStyle section */
/* Begin PBXContainerItemProxy section */
141211350A48796100480255 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
......@@ -540,7 +556,6 @@
D21202290AD4310C00ED79B6 /* DateMath.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DateMath.h; sourceTree = "<group>"; };
E195678F09E7CF1200B89D13 /* UnicodeIcu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeIcu.h; sourceTree = "<group>"; };
E195679409E7CF1200B89D13 /* Unicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unicode.h; sourceTree = "<group>"; };
E195679509E7CF1200B89D13 /* UnicodeCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeCategory.h; sourceTree = "<group>"; };
F5BB2BC5030F772101FCFE1D /* completion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = completion.h; sourceTree = "<group>"; tabWidth = 8; };
F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = JavaScriptCorePrefix.h; path = ../JavaScriptCorePrefix.h; sourceTree = "<group>"; tabWidth = 8; };
F5FFE656026B47A6018635CA /* nodes2string.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = nodes2string.cpp; sourceTree = "<group>"; tabWidth = 8; };
......@@ -992,7 +1007,6 @@
children = (
E195678E09E7CF1200B89D13 /* icu */,
E195679409E7CF1200B89D13 /* Unicode.h */,
E195679509E7CF1200B89D13 /* UnicodeCategory.h */,
);
path = unicode;
sourceTree = "<group>";
......@@ -1125,7 +1139,6 @@
65FB3F5409D11B2400F49DEB /* regexp_object.lut.h in Headers */,
E195679609E7CF1200B89D13 /* UnicodeIcu.h in Headers */,
E195679809E7CF1200B89D13 /* Unicode.h in Headers */,
E195679909E7CF1200B89D13 /* UnicodeCategory.h in Headers */,
935AF46C09E9D9DB00ACD1D8 /* Forward.h in Headers */,
935AF46E09E9D9DB00ACD1D8 /* UnusedParam.h in Headers */,
BCF655590A2049710038A194 /* MathExtras.h in Headers */,
......@@ -1254,13 +1267,16 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */;
compatibilityVersion = "Xcode 2.4";
buildSettings = {
};
buildStyles = (
BC4C649B0B2A359400E57352 /* Development */,
BC4C649C0B2A359400E57352 /* Deployment */,
);
hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* JavaScriptCore */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
shouldCheckCompatibility = 1;
targets = (
932F5B3E0822A1C700736975 /* JavaScriptCore */,
935F69F508244FEA003D1A45 /* dftables */,
......
......@@ -176,9 +176,8 @@
#endif
/* for Unicode, KDE uses Qt, everything else uses ICU */
#if PLATFORM(KDE)
/* FIXME: Not using Qt4 unicode for now! */
#define WTF_USE_ICU_UNICODE 1
#if PLATFORM(KDE) || PLATFORM(QT)
#define WTF_USE_QT4_UNICODE 1
#elif PLATFORM(SYMBIAN)
#define WTF_USE_SYMBIAN_UNICODE 1
#else
......
// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2006 George Staikos <staikos@kde.org>
*
* 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; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef KJS_UNICODE_CATEGORY_H
#define KJS_UNICODE_CATEGORY_H
namespace WTF {
namespace Unicode {
enum CharCategory {
NoCategory = 0,
Mark_NonSpacing = 0x00000001, // Unicode class name Mn
Mark_SpacingCombining = 0x00000002, // Unicode class name Mc
Mark_Enclosing = 0x00000004, // Unicode class name Me
Number_DecimalDigit = 0x00000008, // Unicode class name Nd
Number_Letter = 0x00000010, // Unicode class name Nl
Number_Other = 0x00000020, // Unicode class name No
Separator_Space = 0x00000040, // Unicode class name Zs
Separator_Line = 0x00000080, // Unicode class name Zl
Separator_Paragraph = 0x00000100, // Unicode class name Zp
Other_Control = 0x00000200, // Unicode class name Cc
Other_Format = 0x00000400, // Unicode class name Cf
Other_Surrogate = 0x00000800, // Unicode class name Cs
Other_PrivateUse = 0x00001000, // Unicode class name Co
Other_NotAssigned = 0x00002000, // Unicode class name Cn
Letter_Uppercase = 0x00004000, // Unicode class name Lu
Letter_Lowercase = 0x00008000, // Unicode class name Ll
Letter_Titlecase = 0x00010000, // Unicode class name Lt
Letter_Modifier = 0x00020000, // Unicode class name Lm
Letter_Other = 0x00040000, // Unicode class name Lo
Punctuation_Connector = 0x00080000, // Unicode class name Pc
Punctuation_Dash = 0x00100000, // Unicode class name Pd
Punctuation_Open = 0x00200000, // Unicode class name Ps
Punctuation_Close = 0x00400000, // Unicode class name Pe
Punctuation_InitialQuote = 0x00800000, // Unicode class name Pi
Punctuation_FinalQuote = 0x01000000, // Unicode class name Pf
Punctuation_Other = 0x02000000, // Unicode class name Po
Symbol_Math = 0x04000000, // Unicode class name Sm
Symbol_Currency = 0x08000000, // Unicode class name Sc
Symbol_Modifier = 0x10000000, // Unicode class name Sk
Symbol_Other = 0x20000000 // Unicode class name So
};
}
}
#endif
// vim: ts=2 sw=2 et
// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2006 George Staikos <staikos@kde.org>
*
* 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; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef KJS_UNICODE_DECOMPOSITION_H
#define KJS_UNICODE_DECOMPOSITION_H
namespace WTF {
namespace Unicode {
enum Decomposition {
None = 0,
Canonical = 0x00000001,
Font = 0x00000002,
NoBreak = 0x00000004,
Initial = 0x00000008,
Medial = 0x00000010,
Final = 0x00000020,
Isolated = 0x00000040,
Circle = 0x00000080,
Super = 0x00000100,
Sub = 0x00000200,
Vertical = 0x00000400,
Wide = 0x00000800,
Narrow = 0x00001000,
Small = 0x00002000,
Square = 0x00004000,
Compat = 0x00008000,
Fraction = 0x00010000
};
}
}
#endif
// vim: ts=2 sw=2 et
// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2006 George Staikos <staikos@kde.org>
*
* 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; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef KJS_UNICODE_DIRECTION_H
#define KJS_UNICODE_DIRECTION_H
namespace WTF {
namespace Unicode {
enum Direction {
LeftToRight = 0,
RightToLeft = 0x00000001,
EuropeanNumber = 0x00000002,
EuropeanNumberSeparator = 0x00000004,
EuropeanNumberTerminator = 0x00000008,
ArabicNumber = 0x00000010,
CommonNumberSeparator = 0x00000020,
BlockSeparator = 0x00000040,
SegmentSeparator = 0x00000080,
WhiteSpaceNeutral = 0x00000100,
OtherNeutral = 0x00000200,
LeftToRightEmbedding = 0x00000400,
LeftToRightOverride = 0x00000800,
RightToLeftArabic = 0x00001000,
RightToLeftEmbedding = 0x00002000,
RightToLeftOverride = 0x00004000,
PopDirectionalFormat = 0x00008000,
NonSpacingMark = 0x00010000,
BoundaryNeutral = 0x00020000
};
}
}
#endif
// vim: ts=2 sw=2 et
......@@ -26,12 +26,110 @@
#include <unicode/uchar.h>
#include <unicode/ustring.h>
#include <unicode/utf16.h>
#include "../UnicodeCategory.h"
#include <stdlib.h>
namespace WTF {
namespace Unicode {
enum Direction {
LeftToRight = U_LEFT_TO_RIGHT,
RightToLeft = U_RIGHT_TO_LEFT,
EuropeanNumber = U_EUROPEAN_NUMBER,
EuropeanNumberSeparator = U_EUROPEAN_NUMBER_SEPARATOR,
EuropeanNumberTerminator = U_EUROPEAN_NUMBER_TERMINATOR,
ArabicNumber = U_ARABIC_NUMBER,
CommonNumberSeparator = U_COMMON_NUMBER_SEPARATOR,
BlockSeparator = U_BLOCK_SEPARATOR,
SegmentSeparator = U_SEGMENT_SEPARATOR,
WhiteSpaceNeutral = U_WHITE_SPACE_NEUTRAL,
OtherNeutral = U_OTHER_NEUTRAL,
LeftToRightEmbedding = U_LEFT_TO_RIGHT_EMBEDDING,
LeftToRightOverride = U_LEFT_TO_RIGHT_OVERRIDE,
RightToLeftArabic = U_RIGHT_TO_LEFT_ARABIC,
RightToLeftEmbedding = U_RIGHT_TO_LEFT_EMBEDDING,
RightToLeftOverride = U_RIGHT_TO_LEFT_OVERRIDE,
PopDirectionalFormat = U_POP_DIRECTIONAL_FORMAT,
NonSpacingMark = U_DIR_NON_SPACING_MARK,
BoundaryNeutral = U_BOUNDARY_NEUTRAL
};
enum DecompositionType {
DecompositionNone = U_DT_NONE,
DecompositionCanonical = U_DT_CANONICAL,
DecompositionCompat = U_DT_COMPAT,
DecompositionCircle = U_DT_CIRCLE,
DecompositionFinal = U_DT_FINAL,
DecompositionFont = U_DT_FONT,
DecompositionFraction = U_DT_FRACTION,
DecompositionInitial = U_DT_INITIAL,
DecompositionIsolated = U_DT_ISOLATED,
DecompositionMedial = U_DT_MEDIAL,
DecompositionNarrow = U_DT_NARROW,
DecompositionNoBreak = U_DT_NOBREAK,
DecompositionSmall = U_DT_SMALL,
DecompositionSquare = U_DT_SQUARE,
DecompositionSub = U_DT_SUB,
DecompositionSuper = U_DT_SUPER,
DecompositionVertical = U_DT_VERTICAL,
DecompositionWide = U_DT_WIDE,
};
enum CharCategory {
NoCategory = 0,
Other_NotAssigned = U_MASK(U_GENERAL_OTHER_TYPES),
Letter_Uppercase = U_MASK(U_UPPERCASE_LETTER),
Letter_Lowercase = U_MASK(U_LOWERCASE_LETTER),
Letter_Titlecase = U_MASK(U_TITLECASE_LETTER),
Letter_Modifier = U_MASK(U_MODIFIER_LETTER),
Letter_Other = U_MASK(U_OTHER_LETTER),
Mark_NonSpacing = U_MASK(U_NON_SPACING_MARK),
Mark_Enclosing = U_MASK(U_ENCLOSING_MARK),
Mark_SpacingCombining = U_MASK(U_COMBINING_SPACING_MARK),
Number_DecimalDigit = U_MASK(U_DECIMAL_DIGIT_NUMBER),
Number_Letter = U_MASK(U_LETTER_NUMBER),
Number_Other = U_MASK(U_OTHER_NUMBER),
Separator_Space = U_MASK(U_SPACE_SEPARATOR),
Separator_Line = U_MASK(U_LINE_SEPARATOR),
Separator_Paragraph = U_MASK(U_PARAGRAPH_SEPARATOR),
Other_Control = U_MASK(U_CONTROL_CHAR),
Other_Format = U_MASK(U_FORMAT_CHAR),
Other_PrivateUse = U_MASK(U_PRIVATE_USE_CHAR),
Other_Surrogate = U_MASK(U_SURROGATE),
Punctuation_Dash = U_MASK(U_DASH_PUNCTUATION),
Punctuation_Open = U_MASK(U_START_PUNCTUATION),
Punctuation_Close = U_MASK(U_END_PUNCTUATION),
Punctuation_Connector = U_MASK(U_CONNECTOR_PUNCTUATION),
Punctuation_Other = U_MASK(U_OTHER_PUNCTUATION),
Symbol_Math = U_MASK(U_MATH_SYMBOL),
Symbol_Currency = U_MASK(U_CURRENCY_SYMBOL),
Symbol_Modifier = U_MASK(U_MODIFIER_SYMBOL),
Symbol_Other = U_MASK(U_OTHER_SYMBOL),
Punctuation_InitialQuote = U_MASK(U_INITIAL_PUNCTUATION),
Punctuation_FinalQuote = U_MASK(U_FINAL_PUNCTUATION)
};
inline uint32_t foldCase(uint32_t c)
{
return u_foldCase(c, U_FOLD_CASE_DEFAULT);
}
inline int foldCase(UChar* result, int resultLength, UChar* src, int srcLength, bool* error)
{
UErrorCode status = U_ZERO_ERROR;
int32_t realLength = u_strFoldCase(result, resultLength, src, srcLength, U_FOLD_CASE_DEFAULT, &status);
*error = !(U_SUCCESS(status) && realLength < resultLength);
return realLength;
}
inline int toLower(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
{
UErrorCode err = U_ZERO_ERROR;
......@@ -52,6 +150,24 @@ namespace WTF {
return U_FAILURE(err) ? -1 : resultLength;
}
inline int toLower(UChar* result, int resultLength, UChar* src, int srcLength, bool* error)
{
UErrorCode status = U_ZERO_ERROR;
int32_t realLength = u_strToLower(result, resultLength, src, srcLength, "", &status);
*error = U_FAILURE(status);
return realLength;
}
inline int32_t toLower(int32_t c)
{
return u_tolower(c);
}
inline int32_t toUpper(int32_t c)
{
return u_toupper(c);
}
inline int toUpper(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
{
UErrorCode err = U_ZERO_ERROR;
......@@ -72,6 +188,19 @@ namespace WTF {
return U_FAILURE(err) ? -1 : resultLength;
}
inline int toUpper(UChar* result, int resultLength, UChar* src, int srcLength, bool* error)
{
UErrorCode status = U_ZERO_ERROR;
int32_t realLength = u_strToUpper(result, resultLength, src, srcLength, "", &status);
*error = U_FAILURE(status);
return realLength;
}
inline int toTitleCase (uint32_t c)
{
return u_totitle(c);
}
inline bool isFormatChar(int32_t c)
{
return u_charType(c) == U_FORMAT_CHAR;
......@@ -87,72 +216,68 @@ namespace WTF {
return !!u_isprint(c);
}
inline bool isDigit(int32_t c)
{
return u_isdigit(c);
}
inline bool isSpace(int32_t c)
{
return u_isspace(c);
}
inline bool isPunct(int32_t c)
{
return u_ispunct(c);
}
inline int32_t mirroredChar(int32_t c)
{
return u_charMirror(c);
}
inline CharCategory category(int32_t c)
{
switch (u_charType(c)) {
case U_NON_SPACING_MARK:
return Mark_NonSpacing;
case U_COMBINING_SPACING_MARK:
return Mark_SpacingCombining;
case U_ENCLOSING_MARK:
return Mark_Enclosing;
case U_DECIMAL_DIGIT_NUMBER:
return Number_DecimalDigit;
case U_LETTER_NUMBER:
return Number_Letter;
case U_OTHER_NUMBER:
return Number_Other;
case U_SPACE_SEPARATOR:
return Separator_Space;
case U_LINE_SEPARATOR:
return Separator_Line;
case U_PARAGRAPH_SEPARATOR:
return Separator_Paragraph;
case U_CONTROL_CHAR:
return Other_Control;
case U_FORMAT_CHAR:
return Other_Format;
case U_SURROGATE:
return Other_Surrogate;
case U_PRIVATE_USE_CHAR:
return Other_PrivateUse;
case U_GENERAL_OTHER_TYPES:
return Other_NotAssigned;
case U_UPPERCASE_LETTER:
return Letter_Uppercase;
case U_LOWERCASE_LETTER:
return Letter_Lowercase;
case U_TITLECASE_LETTER:
return Letter_Titlecase;
case U_MODIFIER_LETTER:
return Letter_Modifier;
case U_OTHER_LETTER:
return Letter_Other;
case U_CONNECTOR_PUNCTUATION:
return Punctuation_Connector;
case U_DASH_PUNCTUATION:
return Punctuation_Dash;
case U_START_PUNCTUATION:
return Punctuation_Open;
case U_END_PUNCTUATION:
return Punctuation_Close;
case U_INITIAL_PUNCTUATION:
return Punctuation_InitialQuote;
case U_FINAL_PUNCTUATION:
return Punctuation_FinalQuote;
case U_OTHER_PUNCTUATION:
return Punctuation_Other;
case U_MATH_SYMBOL:
return Symbol_Math;
case U_CURRENCY_SYMBOL:
return Symbol_Currency;
case U_MODIFIER_SYMBOL:
return Symbol_Modifier;
case U_OTHER_SYMBOL:
return Symbol_Other;
default:
return NoCategory;
return static_cast<CharCategory>(U_GET_GC_MASK(c));
}
inline Direction direction(int c) {
return (Direction)u_charDirection(c);
}
inline bool isLower(int32_t c)
{
return u_islower(c);
}
inline bool isUpper(int32_t c)
{
return u_isUUppercase(c);
}
inline int digitValue(int32_t c)
{
return u_charDigitValue(c);
}
inline uint8_t combiningClass(UChar32 c)
{
return u_getCombiningClass(c);
}
inline DecompositionType decompositionType(UChar32 c)
{
return static_cast<DecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));
}
inline int strcasecmp(const UChar *a, const UChar *b, int len)
{
return u_memcasecmp(a, b, len, U_FOLD_CASE_DEFAULT);
}
inline void memset(UChar* dest, UChar ch, int32_t count)
{