@@ -172,56 +172,67 @@ namespace message2 {
172172 };
173173
174174 // See https://github.com/unicode-org/message-format-wg/blob/main/test/README.md
175- class TestFormatFactory : public FormatterFactory {
175+ class TestFormat : public Function {
176176 public:
177- Formatter* createFormatter (const Locale& locale, UErrorCode& status) override ;
178- TestFormatFactory () {}
179- virtual ~TestFormatFactory ();
177+ LocalPointer<FunctionValue> call (const FunctionContext& context,
178+ const FunctionValue& operand,
179+ const FunctionOptions& options,
180+ UErrorCode& errorCode) override ;
181+ virtual ~TestFormat ();
180182 };
181183
182- class TestSelect ;
183-
184- class TestFormat : public Formatter {
184+ class TestFormatValue : public FunctionValue {
185185 public:
186- FormattedPlaceholder format (FormattedPlaceholder&& toFormat, FunctionOptions&& options, UErrorCode& status) const override ;
187- virtual ~TestFormat ();
188-
189- private:
190- friend class TestFormatFactory ;
191- friend class TestSelect ;
192- TestFormat () {}
193- static void testFunctionParameters (const FormattedPlaceholder& arg,
194- const FunctionOptions& options,
195- int32_t & decimalPlaces,
196- bool & failsFormat,
197- bool & failsSelect,
198- double & input,
199- UErrorCode& status);
186+ UnicodeString formatToString (UErrorCode&) const override ;
187+ TestFormatValue ();
188+ virtual ~TestFormatValue ();
189+ };
200190
191+ class TestSelect : public Function {
192+ public:
193+ LocalPointer<FunctionValue> call (const FunctionContext& context,
194+ const FunctionValue& operand,
195+ const FunctionOptions& options,
196+ UErrorCode& errorCode) override ;
197+ virtual ~TestSelect ();
201198 };
202199
203- // See https://github.com/unicode-org/message-format-wg/blob/main/test/README.md
204- class TestSelectFactory : public SelectorFactory {
200+ class TestSelectValue : public FunctionValue {
205201 public:
206- Selector* createSelector (const Locale& locale, UErrorCode& status) const override ;
207- TestSelectFactory () {}
208- virtual ~TestSelectFactory ();
202+ void selectKeys (const UnicodeString* keys,
203+ int32_t keysLen,
204+ int32_t * prefs,
205+ int32_t & prefsLen,
206+ UErrorCode& status) const override ;
207+ UBool isSelectable () const override { return true ; }
208+ TestSelectValue ();
209+ virtual ~TestSelectValue ();
209210 };
210211
211- class TestSelect : public Selector {
212+ class TestFunction : public Function {
212213 public:
213- void selectKey (FormattedPlaceholder&& val,
214- FunctionOptions&& options,
215- const UnicodeString* keys,
216- int32_t keysLen,
217- UnicodeString* prefs,
218- int32_t & prefsLen,
219- UErrorCode& status) const override ;
220- virtual ~TestSelect ();
214+ static TestFunction* testFunction (UErrorCode&);
215+ static TestFunction* testFormat (UErrorCode&);
216+ static TestFunction* testSelect (UErrorCode&);
221217
222- private:
223- friend class TestSelectFactory ;
224- TestSelect () {}
218+ LocalPointer<FunctionValue> call (const FunctionContext& context,
219+ const FunctionValue& operand,
220+ const FunctionOptions& options,
221+ UErrorCode& errorCode) override ;
222+ virtual ~TestFunction ();
223+ };
224+
225+ class TestFunctionValue : public FunctionValue {
226+ public:
227+ UnicodeString formatToString (UErrorCode&) const override ;
228+ void selectKeys (const UnicodeString* keys,
229+ int32_t keysLen,
230+ int32_t * prefs,
231+ int32_t & prefsLen,
232+ UErrorCode& status) const override ;
233+ UBool isSelectable () const override { return true ; }
234+ TestFunctionValue ();
235+ virtual ~TestFunctionValue ();
225236 };
226237
227238 class StringValue : public FunctionValue {
0 commit comments