2016-06-15 18:58:17 +00:00
|
|
|
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2009-12-17 22:15:20 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (C) 2009-2015, International Business Machines Corporation and *
|
|
|
|
* others. All Rights Reserved. *
|
2009-12-17 22:15:20 +00:00
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FPHDLIMP_H
|
|
|
|
#define FPHDLIMP_H
|
|
|
|
|
2010-01-26 00:55:35 +00:00
|
|
|
#if !UCONFIG_NO_FORMATTING
|
2009-12-17 22:15:20 +00:00
|
|
|
|
2010-09-27 23:52:31 +00:00
|
|
|
#include "unicode/utypes.h"
|
2009-12-17 22:15:20 +00:00
|
|
|
#include "unicode/fieldpos.h"
|
|
|
|
#include "unicode/fpositer.h"
|
|
|
|
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
// utility FieldPositionHandler
|
|
|
|
// base class, null implementation
|
|
|
|
|
2015-08-25 23:31:01 +00:00
|
|
|
class U_I18N_API FieldPositionHandler: public UMemory {
|
2009-12-17 22:15:20 +00:00
|
|
|
public:
|
|
|
|
virtual ~FieldPositionHandler();
|
|
|
|
virtual void addAttribute(int32_t id, int32_t start, int32_t limit);
|
|
|
|
virtual void shiftLast(int32_t delta);
|
2015-08-25 23:31:01 +00:00
|
|
|
virtual UBool isRecording(void) const;
|
2009-12-17 22:15:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// utility subclass FieldPositionOnlyHandler
|
|
|
|
|
|
|
|
class FieldPositionOnlyHandler : public FieldPositionHandler {
|
|
|
|
FieldPosition& pos;
|
|
|
|
|
|
|
|
public:
|
|
|
|
FieldPositionOnlyHandler(FieldPosition& pos);
|
|
|
|
virtual ~FieldPositionOnlyHandler();
|
|
|
|
|
|
|
|
virtual void addAttribute(int32_t id, int32_t start, int32_t limit);
|
|
|
|
virtual void shiftLast(int32_t delta);
|
2015-08-25 23:31:01 +00:00
|
|
|
virtual UBool isRecording(void) const;
|
2009-12-17 22:15:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// utility subclass FieldPositionIteratorHandler
|
|
|
|
|
|
|
|
class FieldPositionIteratorHandler : public FieldPositionHandler {
|
2010-01-28 19:39:24 +00:00
|
|
|
FieldPositionIterator* iter; // can be NULL
|
2009-12-17 22:15:20 +00:00
|
|
|
UVector32* vec;
|
|
|
|
UErrorCode status;
|
|
|
|
|
|
|
|
// Note, we keep a reference to status, so if status is on the stack, we have
|
|
|
|
// to be destroyed before status goes out of scope. Easiest thing is to
|
|
|
|
// allocate us on the stack in the same (or narrower) scope as status has.
|
|
|
|
// This attempts to encourage that by blocking heap allocation.
|
|
|
|
void *operator new(size_t s);
|
|
|
|
void *operator new[](size_t s);
|
|
|
|
|
|
|
|
public:
|
2010-01-28 19:39:24 +00:00
|
|
|
FieldPositionIteratorHandler(FieldPositionIterator* posIter, UErrorCode& status);
|
2009-12-17 22:15:20 +00:00
|
|
|
~FieldPositionIteratorHandler();
|
|
|
|
|
|
|
|
virtual void addAttribute(int32_t id, int32_t start, int32_t limit);
|
|
|
|
virtual void shiftLast(int32_t delta);
|
2015-08-25 23:31:01 +00:00
|
|
|
virtual UBool isRecording(void) const;
|
2009-12-17 22:15:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
2010-01-26 00:55:35 +00:00
|
|
|
#endif /* !UCONFIG_NO_FORMATTING */
|
2009-12-17 22:15:20 +00:00
|
|
|
|
|
|
|
#endif /* FPHDLIMP_H */
|