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