2 *******************************************************************************
3 * Copyright (C) 2009-2010, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
11 #if !UCONFIG_NO_FORMATTING
13 #include "unicode/utypes.h"
14 #include "unicode/fieldpos.h"
15 #include "unicode/fpositer.h"
19 // utility FieldPositionHandler
20 // base class, null implementation
22 class FieldPositionHandler
: public UMemory
{
24 virtual ~FieldPositionHandler();
25 virtual void addAttribute(int32_t id
, int32_t start
, int32_t limit
);
26 virtual void shiftLast(int32_t delta
);
27 virtual UBool
isRecording(void);
31 // utility subclass FieldPositionOnlyHandler
33 class FieldPositionOnlyHandler
: public FieldPositionHandler
{
37 FieldPositionOnlyHandler(FieldPosition
& pos
);
38 virtual ~FieldPositionOnlyHandler();
40 virtual void addAttribute(int32_t id
, int32_t start
, int32_t limit
);
41 virtual void shiftLast(int32_t delta
);
42 virtual UBool
isRecording(void);
46 // utility subclass FieldPositionIteratorHandler
48 class FieldPositionIteratorHandler
: public FieldPositionHandler
{
49 FieldPositionIterator
* iter
; // can be NULL
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
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.
57 void *operator new(size_t s
);
58 void *operator new[](size_t s
);
61 FieldPositionIteratorHandler(FieldPositionIterator
* posIter
, UErrorCode
& status
);
62 ~FieldPositionIteratorHandler();
64 virtual void addAttribute(int32_t id
, int32_t start
, int32_t limit
);
65 virtual void shiftLast(int32_t delta
);
66 virtual UBool
isRecording(void);
71 #endif /* !UCONFIG_NO_FORMATTING */
73 #endif /* FPHDLIMP_H */