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