164339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert// Copyright (C) 2016 and later: Unicode, Inc. and others.
264339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert// License & terms of use: http://www.unicode.org/copyright.html
3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru************************************************************************
527f654740f2a26ad62a5c155af9199af9e69b889claireho* Copyright (c) 2007-2010, International Business Machines
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Corporation and others.  All Rights Reserved.
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru************************************************************************
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef FLDSET_H_
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define FLDSET_H_
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h"
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/calendar.h"
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/ucal.h"
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/udat.h"
1827f654740f2a26ad62a5c155af9199af9e69b889claireho#include "udbgutil.h"
1927f654740f2a26ad62a5c155af9199af9e69b889claireho#include "dbgutil.h"
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/unistr.h"
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define U_FIELDS_SET_MAX  64
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho/**
2585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * This class represents a collection of integer values (fields), each designated by
2685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * one of a particular set of enum values.  Each integer value (int32_t) is optional and
2785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * may or may not be set.
2885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *
2985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @internal ICU 3.8
3085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass FieldsSet {
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    protected:
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        /**
3485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho         * subclass interface - construct the FieldsSet to reference one of the standard
3585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho         * enumerations.
3685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho         * @param whichEnum which enumaration value goes with this set. Will be used to calculate string
3785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho         * values and also enum size.
3885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho         * @see UDebugEnumType
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru         */
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        FieldsSet(UDebugEnumType whichEnum);
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        /**
4385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho         * subclass interface - construct the FieldsSet without using a standard enum type.
4485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho         * @param fieldCount how many fields this object can hold.
45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru         */
46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        FieldsSet(int32_t fieldsCount);
47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    public:
4985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru      /**
5185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * Compare two sets. In typical test usage, 'this' is the resul of
5285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * a tested operation, and 'other' is the predefined expected value.
5385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       *
5485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @param other the set to compare against.
5585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @param status will return U_ILLEGAL_ARGUMENT_ERROR if sets are not the same size
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @return a formatted string listing which fields are set in
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       *   this, with the comparison made agaainst those fields in other.
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       */
5927f654740f2a26ad62a5c155af9199af9e69b889claireho      U_NAMESPACE_QUALIFIER UnicodeString diffFrom(const FieldsSet& other, UErrorCode &status) const;
6027f654740f2a26ad62a5c155af9199af9e69b889claireho
61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    public:
62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru      /**
6385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * Fill-in fields from a specified string, such as "NAME1=VALUE1,NAME2=VALUE2", etc.
64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @param str string to parse
6585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @param status status of parse
6685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @return the number of valid parsed fields on success, or a negative number on failure.
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       */
6827f654740f2a26ad62a5c155af9199af9e69b889claireho      int32_t parseFrom(const U_NAMESPACE_QUALIFIER UnicodeString& str, UErrorCode& status) {
6927f654740f2a26ad62a5c155af9199af9e69b889claireho          return parseFrom(str,NULL,status);
7027f654740f2a26ad62a5c155af9199af9e69b889claireho      }
7127f654740f2a26ad62a5c155af9199af9e69b889claireho
7285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho      /**
7385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * Fill-in fields from a specified string, such as "NAME1=VALUE1,NAME2=VALUE2", etc.
7485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @param inheritFrom if a field's value is given as 0-length, such as NAME1 in "NAME1=,NAME2=VALUE2",
7585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * the specified FieldsSet's value for NAME1 will be copied into this.
7685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @param str string to parse
7785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @param status status of parse
7885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @return the number of valid parsed fields on success, or a negative number on failure.
7985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       */
8027f654740f2a26ad62a5c155af9199af9e69b889claireho      int32_t parseFrom(const U_NAMESPACE_QUALIFIER UnicodeString& str,
8127f654740f2a26ad62a5c155af9199af9e69b889claireho                        const FieldsSet& inheritFrom,
8227f654740f2a26ad62a5c155af9199af9e69b889claireho                        UErrorCode& status) {
8327f654740f2a26ad62a5c155af9199af9e69b889claireho          return parseFrom(str, &inheritFrom, status);
8427f654740f2a26ad62a5c155af9199af9e69b889claireho      }
8527f654740f2a26ad62a5c155af9199af9e69b889claireho
8685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho      /**
8785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * Fill-in fields from a specified string, such as "NAME1=VALUE1,NAME2=VALUE2", etc.
8885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @param inheritFrom if a field's value is given as 0-length, such as NAME1 in "NAME1=,NAME2=VALUE2",
8985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * the specified FieldsSet's value for NAME1 will be copied into this.
9085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @param str string to parse
9185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @param status status of parse
9285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @return the number of valid parsed fields on success, or a negative number on failure.
9385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       */
9427f654740f2a26ad62a5c155af9199af9e69b889claireho      int32_t parseFrom(const U_NAMESPACE_QUALIFIER UnicodeString& str,
9527f654740f2a26ad62a5c155af9199af9e69b889claireho                        const FieldsSet* inheritFrom,
9627f654740f2a26ad62a5c155af9199af9e69b889claireho                        UErrorCode& status);
9727f654740f2a26ad62a5c155af9199af9e69b889claireho
98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    protected:
99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru      /**
100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * Callback interface for subclass.
101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * This function is called when parsing a field name, such as "MONTH"  in "MONTH=4".
102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * Base implementation is to lookup the enum value using udbg_* utilities, or else as an integer if
103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * enum is not available.
104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       *
105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * If there is a special directive, the implementer can catch it here and return -1 after special processing completes.
106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       *
107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @param inheritFrom the set inheriting from - may be null.
108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @param name the field name (key side)
109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @param substr the string in question (value side)
110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @param status error status - set to error for failure.
111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @return field number, or negative if field should be skipped.
112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       */
11327f654740f2a26ad62a5c155af9199af9e69b889claireho      virtual int32_t handleParseName(const FieldsSet* inheritFrom,
11427f654740f2a26ad62a5c155af9199af9e69b889claireho                                      const U_NAMESPACE_QUALIFIER UnicodeString& name,
11527f654740f2a26ad62a5c155af9199af9e69b889claireho                                      const U_NAMESPACE_QUALIFIER UnicodeString& substr,
11627f654740f2a26ad62a5c155af9199af9e69b889claireho                                      UErrorCode& status);
117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru      /**
119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * Callback interface for subclass.
120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * Base implementation is to call parseValueDefault(...)
121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @param inheritFrom the set inheriting from - may be null.
122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @param field which field is being parsed
123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @param substr the string in question (value side)
124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @param status error status - set to error for failure.
125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @see parseValueDefault
126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       */
12727f654740f2a26ad62a5c155af9199af9e69b889claireho      virtual void handleParseValue(const FieldsSet* inheritFrom,
12827f654740f2a26ad62a5c155af9199af9e69b889claireho                                    int32_t field,
12927f654740f2a26ad62a5c155af9199af9e69b889claireho                                    const U_NAMESPACE_QUALIFIER UnicodeString& substr,
13027f654740f2a26ad62a5c155af9199af9e69b889claireho                                    UErrorCode& status);
13127f654740f2a26ad62a5c155af9199af9e69b889claireho
132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru      /**
133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * the default implementation for handleParseValue.
134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * Base implementation is to parse a decimal integer value, or inherit from inheritFrom if the string is 0-length.
135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * Implementations of this function should call set(field,...) on successful parse.
136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @see handleParseValue
137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       */
13827f654740f2a26ad62a5c155af9199af9e69b889claireho      void parseValueDefault(const FieldsSet* inheritFrom,
13927f654740f2a26ad62a5c155af9199af9e69b889claireho                             int32_t field,
14027f654740f2a26ad62a5c155af9199af9e69b889claireho                             const U_NAMESPACE_QUALIFIER UnicodeString& substr,
14127f654740f2a26ad62a5c155af9199af9e69b889claireho                             UErrorCode& status);
142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru      /**
145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * convenience implementation for handleParseValue
146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * attempt to load a value from an enum value using udbg_enumByString()
147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * if fails, will call parseValueDefault()
148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       * @see handleParseValue
149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       */
15027f654740f2a26ad62a5c155af9199af9e69b889claireho      void parseValueEnum(UDebugEnumType type,
15127f654740f2a26ad62a5c155af9199af9e69b889claireho                          const FieldsSet* inheritFrom,
15227f654740f2a26ad62a5c155af9199af9e69b889claireho                          int32_t field,
15327f654740f2a26ad62a5c155af9199af9e69b889claireho                          const U_NAMESPACE_QUALIFIER UnicodeString& substr,
15427f654740f2a26ad62a5c155af9199af9e69b889claireho                          UErrorCode& status);
155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    private:
15785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho      /**
15885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * Not callable - construct a default FieldsSet
15985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @internal
16085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       */
161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru      FieldsSet();
162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
16385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho      /**
16485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * construct the object.
16585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       * @internal
16685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho       */
167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru      void construct(UDebugEnumType whichEnum, int32_t fieldCount);
168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    public:
17085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
17185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * destructor
17285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     virtual ~FieldsSet();
17485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
17585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
17685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Mark all fields as unset
17785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void clear();
17985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
18085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
18185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Mark a specific field as unset
18285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param field the field to unset
18385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void clear(int32_t field);
18585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
18685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
18785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Set a specific field
18885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param field the field to set (i.e. enum value)
18985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param value the field's value
19085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
19185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void set(int32_t field, int32_t value);
19285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool isSet(int32_t field) const;
19485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
19585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
19685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Return the field's value
19785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param field which field
19885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @return field's value, or -1 if unset.
19985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t get(int32_t field) const;
201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
20285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
20385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Return true if both FieldsSet objects either are based on the same enum, or have the same number of fields.
20485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool isSameType(const FieldsSet& other) const;
20685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
20785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
20885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @return the number of fields
20985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fieldCount() const;
211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    protected:
213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       int32_t fValue[U_FIELDS_SET_MAX];
214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       UBool fIsSet[U_FIELDS_SET_MAX];
215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    protected:
216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       int32_t fFieldCount;
217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru       UDebugEnumType fEnum;
218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
22085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho/**
22185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * A subclass of FieldsSet representing the fields in a Calendar
22285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @see Calendar
22385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */
224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass CalendarFieldsSet : public FieldsSet {
22585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hopublic:
22685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    CalendarFieldsSet();
22785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    virtual ~CalendarFieldsSet();
228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//        void clear(UCalendarDateFields field) { clear((int32_t)field); }
230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//        void set(UCalendarDateFields field, int32_t amount) { set ((int32_t)field, amount); }
231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//        UBool isSet(UCalendarDateFields field) const { return isSet((int32_t)field); }
233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//        int32_t get(UCalendarDateFields field) const { return get((int32_t)field); }
234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
23585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
23685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param matches fillin to hold any fields different. Will have the calendar's value set on them.
23785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @return true if the calendar matches in these fields.
23885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
23927f654740f2a26ad62a5c155af9199af9e69b889claireho    UBool matches(U_NAMESPACE_QUALIFIER Calendar *cal,
24027f654740f2a26ad62a5c155af9199af9e69b889claireho                  CalendarFieldsSet &diffSet,
24127f654740f2a26ad62a5c155af9199af9e69b889claireho                  UErrorCode& status) const;
242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
24385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
24485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * For each set field, set the same field on this Calendar.
24585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Doesn't clear the Calendar first.
24685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param cal Calendar to modify
24785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param status Contains any errors propagated by the Calendar.
24885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
24927f654740f2a26ad62a5c155af9199af9e69b889claireho    void setOnCalendar(U_NAMESPACE_QUALIFIER Calendar *cal, UErrorCode& status) const;
250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
25185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoprotected:
25285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
25385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * subclass override
25485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
25527f654740f2a26ad62a5c155af9199af9e69b889claireho    void handleParseValue(const FieldsSet* inheritFrom,
25627f654740f2a26ad62a5c155af9199af9e69b889claireho                          int32_t field,
25727f654740f2a26ad62a5c155af9199af9e69b889claireho                          const U_NAMESPACE_QUALIFIER UnicodeString& substr,
25827f654740f2a26ad62a5c155af9199af9e69b889claireho                          UErrorCode& status);
259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This class simply implements a set of date and time styles
26385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * such as DATE=SHORT  or TIME=SHORT,DATE=LONG, such as would be passed
26485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * to DateFormat::createInstance()
26585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @see DateFormat
266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass DateTimeStyleSet : public FieldsSet {
268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    public:
269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        DateTimeStyleSet();
270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        virtual ~DateTimeStyleSet();
271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        /**
273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru         * @return the date style, or UDAT_NONE if not set
274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru         */
275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UDateFormatStyle getDateStyle() const;
276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        /**
278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru         * @return the time style, or UDAT_NONE if not set
279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru         */
280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UDateFormatStyle getTimeStyle() const;
281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    protected:
28227f654740f2a26ad62a5c155af9199af9e69b889claireho        void handleParseValue(const FieldsSet* inheritFrom,
28327f654740f2a26ad62a5c155af9199af9e69b889claireho                              int32_t field,
28427f654740f2a26ad62a5c155af9199af9e69b889claireho                              const U_NAMESPACE_QUALIFIER UnicodeString& substr,
28527f654740f2a26ad62a5c155af9199af9e69b889claireho                              UErrorCode& status);
28627f654740f2a26ad62a5c155af9199af9e69b889claireho        int32_t handleParseName(const FieldsSet* inheritFrom,
28727f654740f2a26ad62a5c155af9199af9e69b889claireho                                const U_NAMESPACE_QUALIFIER UnicodeString& name,
28827f654740f2a26ad62a5c155af9199af9e69b889claireho                                const U_NAMESPACE_QUALIFIER UnicodeString& substr,
28927f654740f2a26ad62a5c155af9199af9e69b889claireho                                UErrorCode& status);
290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /*!UCONFIG_NO_FORMAT*/
294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /*FLDSET_H_*/
295