OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 2009-2010, International Business Machines Corporation and * | 3 * Copyright (C) 2009-2015, International Business Machines Corporation and * |
4 * others. All Rights Reserved. * | 4 * others. All Rights Reserved. * |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 */ | 6 */ |
7 | 7 |
8 #ifndef FPHDLIMP_H | 8 #ifndef FPHDLIMP_H |
9 #define FPHDLIMP_H | 9 #define FPHDLIMP_H |
10 | 10 |
11 #if !UCONFIG_NO_FORMATTING | 11 #if !UCONFIG_NO_FORMATTING |
12 | 12 |
13 #include "unicode/utypes.h" | 13 #include "unicode/utypes.h" |
14 #include "unicode/fieldpos.h" | 14 #include "unicode/fieldpos.h" |
15 #include "unicode/fpositer.h" | 15 #include "unicode/fpositer.h" |
16 | 16 |
17 U_NAMESPACE_BEGIN | 17 U_NAMESPACE_BEGIN |
18 | 18 |
19 // utility FieldPositionHandler | 19 // utility FieldPositionHandler |
20 // base class, null implementation | 20 // base class, null implementation |
21 | 21 |
22 class FieldPositionHandler: public UMemory { | 22 class U_I18N_API FieldPositionHandler: public UMemory { |
23 public: | 23 public: |
24 virtual ~FieldPositionHandler(); | 24 virtual ~FieldPositionHandler(); |
25 virtual void addAttribute(int32_t id, int32_t start, int32_t limit); | 25 virtual void addAttribute(int32_t id, int32_t start, int32_t limit); |
26 virtual void shiftLast(int32_t delta); | 26 virtual void shiftLast(int32_t delta); |
27 virtual UBool isRecording(void); | 27 virtual UBool isRecording(void) const; |
28 }; | 28 }; |
29 | 29 |
30 | 30 |
31 // utility subclass FieldPositionOnlyHandler | 31 // utility subclass FieldPositionOnlyHandler |
32 | 32 |
33 class FieldPositionOnlyHandler : public FieldPositionHandler { | 33 class FieldPositionOnlyHandler : public FieldPositionHandler { |
34 FieldPosition& pos; | 34 FieldPosition& pos; |
35 | 35 |
36 public: | 36 public: |
37 FieldPositionOnlyHandler(FieldPosition& pos); | 37 FieldPositionOnlyHandler(FieldPosition& pos); |
38 virtual ~FieldPositionOnlyHandler(); | 38 virtual ~FieldPositionOnlyHandler(); |
39 | 39 |
40 virtual void addAttribute(int32_t id, int32_t start, int32_t limit); | 40 virtual void addAttribute(int32_t id, int32_t start, int32_t limit); |
41 virtual void shiftLast(int32_t delta); | 41 virtual void shiftLast(int32_t delta); |
42 virtual UBool isRecording(void); | 42 virtual UBool isRecording(void) const; |
43 }; | 43 }; |
44 | 44 |
45 | 45 |
46 // utility subclass FieldPositionIteratorHandler | 46 // utility subclass FieldPositionIteratorHandler |
47 | 47 |
48 class FieldPositionIteratorHandler : public FieldPositionHandler { | 48 class FieldPositionIteratorHandler : public FieldPositionHandler { |
49 FieldPositionIterator* iter; // can be NULL | 49 FieldPositionIterator* iter; // can be NULL |
50 UVector32* vec; | 50 UVector32* vec; |
51 UErrorCode status; | 51 UErrorCode status; |
52 | 52 |
53 // Note, we keep a reference to status, so if status is on the stack, we have | 53 // Note, we keep a reference to status, so if status is on the stack, we have |
54 // to be destroyed before status goes out of scope. Easiest thing is to | 54 // to be destroyed before status goes out of scope. Easiest thing is to |
55 // allocate us on the stack in the same (or narrower) scope as status has. | 55 // allocate us on the stack in the same (or narrower) scope as status has. |
56 // This attempts to encourage that by blocking heap allocation. | 56 // This attempts to encourage that by blocking heap allocation. |
57 void *operator new(size_t s); | 57 void *operator new(size_t s); |
58 void *operator new[](size_t s); | 58 void *operator new[](size_t s); |
59 | 59 |
60 public: | 60 public: |
61 FieldPositionIteratorHandler(FieldPositionIterator* posIter, UErrorCode& statu
s); | 61 FieldPositionIteratorHandler(FieldPositionIterator* posIter, UErrorCode& statu
s); |
62 ~FieldPositionIteratorHandler(); | 62 ~FieldPositionIteratorHandler(); |
63 | 63 |
64 virtual void addAttribute(int32_t id, int32_t start, int32_t limit); | 64 virtual void addAttribute(int32_t id, int32_t start, int32_t limit); |
65 virtual void shiftLast(int32_t delta); | 65 virtual void shiftLast(int32_t delta); |
66 virtual UBool isRecording(void); | 66 virtual UBool isRecording(void) const; |
67 }; | 67 }; |
68 | 68 |
69 U_NAMESPACE_END | 69 U_NAMESPACE_END |
70 | 70 |
71 #endif /* !UCONFIG_NO_FORMATTING */ | 71 #endif /* !UCONFIG_NO_FORMATTING */ |
72 | 72 |
73 #endif /* FPHDLIMP_H */ | 73 #endif /* FPHDLIMP_H */ |
OLD | NEW |