1 /* 2 * Copyright 2015, Rene Gollent, rene@gollent.com. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef VALUE_FORMATTER_H 6 #define VALUE_FORMATTER_H 7 8 9 #include <Referenceable.h> 10 11 class BString; 12 class Settings; 13 class Value; 14 15 16 class ValueFormatter : public BReferenceable { 17 public: 18 virtual ~ValueFormatter(); 19 20 virtual Settings* GetSettings() const = 0; 21 // returns NULL, if no settings 22 23 virtual status_t FormatValue(Value* value, BString& _output) 24 = 0; 25 26 virtual bool SupportsValidation() const; 27 virtual bool ValidateFormattedValue( 28 const BString& input, 29 type_code type) const; 30 // checks if the passed in string 31 // would be considered a valid value 32 // according to the current format 33 // configuration and the size constraints 34 // imposed by the passed in type. 35 virtual status_t GetValueFromFormattedInput( 36 const BString& input, type_code type, 37 Value*& _output) const; 38 // returns reference 39 }; 40 41 42 #endif // VALUE_FORMATTER_H 43