~ubuntu-branches/ubuntu/gutsy/icu/gutsy-updates

« back to all changes in this revision

Viewing changes to source/extra/scrptrun/scrptrun.h

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *******************************************************************************
3
 
 *
4
 
 *   Copyright (C) 1999-2001, International Business Machines
5
 
 *   Corporation and others.  All Rights Reserved.
6
 
 *
7
 
 *******************************************************************************
8
 
 *   file name:  scrptrun.h
9
 
 *
10
 
 *   created on: 10/17/2001
11
 
 *   created by: Eric R. Mader
12
 
 */
13
 
 
14
 
#ifndef __SCRPTRUN_H
15
 
#define __SCRPTRUN_H
16
 
 
17
 
#include "unicode/utypes.h"
18
 
#include "unicode/uscript.h"
19
 
 
20
 
struct ScriptRecord
21
 
{
22
 
    UChar32 startChar;
23
 
    UChar32 endChar;
24
 
    UScriptCode scriptCode;
25
 
};
26
 
 
27
 
struct ParenStackEntry
28
 
{
29
 
    int32_t pairIndex;
30
 
    UScriptCode scriptCode;
31
 
};
32
 
 
33
 
class ScriptRun
34
 
{
35
 
public:
36
 
    ScriptRun();
37
 
 
38
 
    ScriptRun(const UChar chars[], int32_t length);
39
 
 
40
 
    ScriptRun(const UChar chars[], int32_t start, int32_t length);
41
 
 
42
 
    void reset();
43
 
 
44
 
    void reset(int32_t start, int32_t count);
45
 
 
46
 
    void reset(const UChar chars[], int32_t start, int32_t length);
47
 
 
48
 
    int32_t getScriptStart();
49
 
 
50
 
    int32_t getScriptEnd();
51
 
 
52
 
    UScriptCode getScriptCode();
53
 
 
54
 
    UBool next();
55
 
 
56
 
private:
57
 
 
58
 
    static UBool sameScript(int32_t scriptOne, int32_t scriptTwo);
59
 
 
60
 
    int32_t charStart;
61
 
    int32_t charLimit;
62
 
    const UChar *charArray;
63
 
 
64
 
    int32_t scriptStart;
65
 
    int32_t scriptEnd;
66
 
    UScriptCode scriptCode;
67
 
 
68
 
    ParenStackEntry parenStack[128];
69
 
    int32_t parenSP;
70
 
 
71
 
    static int8_t highBit(int32_t value);
72
 
    static int32_t getPairIndex(UChar32 ch);
73
 
 
74
 
    static UChar32 pairedChars[];
75
 
    static const int32_t pairedCharCount;
76
 
    static const int32_t pairedCharPower;
77
 
    static const int32_t pairedCharExtra;
78
 
};
79
 
 
80
 
inline ScriptRun::ScriptRun()
81
 
{
82
 
    reset(NULL, 0, 0);
83
 
}
84
 
 
85
 
inline ScriptRun::ScriptRun(const UChar chars[], int32_t length)
86
 
{
87
 
    reset(chars, 0, length);
88
 
}
89
 
 
90
 
inline ScriptRun::ScriptRun(const UChar chars[], int32_t start, int32_t length)
91
 
{
92
 
    reset(chars, start, length);
93
 
}
94
 
 
95
 
inline int32_t ScriptRun::getScriptStart()
96
 
{
97
 
    return scriptStart;
98
 
}
99
 
 
100
 
inline int32_t ScriptRun::getScriptEnd()
101
 
{
102
 
    return scriptEnd;
103
 
}
104
 
 
105
 
inline UScriptCode ScriptRun::getScriptCode()
106
 
{
107
 
    return scriptCode;
108
 
}
109
 
 
110
 
inline void ScriptRun::reset()
111
 
{
112
 
    scriptStart = charStart;
113
 
    scriptEnd   = charStart;
114
 
    scriptCode  = USCRIPT_INVALID_CODE;
115
 
    parenSP     = -1;
116
 
}
117
 
 
118
 
inline void ScriptRun::reset(int32_t start, int32_t length)
119
 
{
120
 
    charStart = start;
121
 
    charLimit = start + length;
122
 
 
123
 
    reset();
124
 
}
125
 
 
126
 
inline void ScriptRun::reset(const UChar chars[], int32_t start, int32_t length)
127
 
{
128
 
    charArray = chars;
129
 
 
130
 
    reset(start, length);
131
 
}
132
 
 
133
 
 
134
 
#endif