// © 2018 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html #ifndef __FORMVAL_IMPL_H__ #define __FORMVAL_IMPL_H__ #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING // This file contains compliant implementations of FormattedValue which can be // leveraged by ICU formatters. // // Each implementation is defined in its own cpp file in order to split // dependencies more modularly. #include "unicode/formattedvalue.h" #include "capi_helper.h" #include "fphdlimp.h" #include "util.h" #include "uvectr32.h" #include "formatted_string_builder.h" /** * Represents the type of constraint for ConstrainedFieldPosition. * * Constraints are used to control the behavior of iteration in FormattedValue. * * @internal */ UCFPosConstraintType; U_NAMESPACE_BEGIN /** * Implementation of FormattedValue using FieldPositionHandler to accept fields. * * TODO(ICU-20897): This class is unused. If it is not needed when fixing ICU-20897, * it should be deleted. */ class FormattedValueFieldPositionIteratorImpl : public UMemory, public FormattedValue { … }; // Internal struct that must be exported for MSVC struct U_I18N_API SpanInfo { … }; // Export an explicit template instantiation of the MaybeStackArray that // is used as a data member of CEBuffer. // // When building DLLs for Windows this is required even though // no direct access to the MaybeStackArray leaks out of the i18n library. // // See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples. // #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN template class U_I18N_API MaybeStackArray<SpanInfo, 8>; #endif /** * Implementation of FormattedValue based on FormattedStringBuilder. * * The implementation currently revolves around numbers and number fields. * However, it can be generalized in the future when there is a need. * * @author sffc (Shane Carr) */ // Exported as U_I18N_API for tests class U_I18N_API FormattedValueStringBuilderImpl : public UMemory, public FormattedValue { … }; // C API Helpers for FormattedValue // Magic number as ASCII == "UFV" struct UFormattedValueImpl; UFormattedValueApiHelper; struct UFormattedValueImpl : public UMemory, public UFormattedValueApiHelper { … }; /** Boilerplate to check for valid status before dereferencing the fData pointer. */ #define UPRV_FORMATTED_VALUE_METHOD_GUARD(returnExpression) … \ /** Implementation of the methods from U_FORMATTED_VALUE_SUBCLASS_AUTO. */ #define UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(Name) … /** Like UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL but without impl type declarations. */ #define UPRV_FORMATTED_VALUE_CAPI_NO_IMPLTYPE_AUTO_IMPL(CType, ImplType, HelperType, Prefix) … /** * Implementation of the standard methods for a UFormattedValue "subclass" C API. * @param CPPType The public C++ type, like FormattedList * @param CType The public C type, like UFormattedList * @param ImplType A name to use for the implementation class * @param HelperType A name to use for the "mixin" typedef for C API conversion * @param Prefix The C API prefix, like ulistfmt * @param MagicNumber A unique 32-bit number to use to identify this type */ #define UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL(CPPType, CType, ImplType, HelperType, Prefix, MagicNumber) … U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ #endif // __FORMVAL_IMPL_H__