1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
5 * Copyright (C) 2009-2015, International Business Machines Corporation and *
6 * others. All Rights Reserved. *
7 *******************************************************************************
13 #if !UCONFIG_NO_FORMATTING
15 #include "unicode/utypes.h"
16 #include "unicode/fieldpos.h"
17 #include "unicode/fpositer.h"
21 // utility FieldPositionHandler
22 // base class, null implementation
24 class U_I18N_API FieldPositionHandler: public UMemory {
26 virtual ~FieldPositionHandler();
27 virtual void addAttribute(int32_t id, int32_t start, int32_t limit);
28 virtual void shiftLast(int32_t delta);
29 virtual UBool isRecording(void) const;
33 // utility subclass FieldPositionOnlyHandler
35 class FieldPositionOnlyHandler : public FieldPositionHandler {
39 FieldPositionOnlyHandler(FieldPosition& pos);
40 virtual ~FieldPositionOnlyHandler();
42 virtual void addAttribute(int32_t id, int32_t start, int32_t limit);
43 virtual void shiftLast(int32_t delta);
44 virtual UBool isRecording(void) const;
48 // utility subclass FieldPositionIteratorHandler
50 class FieldPositionIteratorHandler : public FieldPositionHandler {
51 FieldPositionIterator* iter; // can be NULL
55 // Note, we keep a reference to status, so if status is on the stack, we have
56 // to be destroyed before status goes out of scope. Easiest thing is to
57 // allocate us on the stack in the same (or narrower) scope as status has.
58 // This attempts to encourage that by blocking heap allocation.
59 void *operator new(size_t s);
60 void *operator new[](size_t s);
63 FieldPositionIteratorHandler(FieldPositionIterator* posIter, UErrorCode& status);
64 ~FieldPositionIteratorHandler();
66 virtual void addAttribute(int32_t id, int32_t start, int32_t limit);
67 virtual void shiftLast(int32_t delta);
68 virtual UBool isRecording(void) const;
73 #endif /* !UCONFIG_NO_FORMATTING */
75 #endif /* FPHDLIMP_H */