vfs: check userland buffers before reading them.
[haiku.git] / src / apps / debugger / user_interface / gui / value / TableCellFloatEditor.cpp
blob126d7e7612e5f57ce29ab7fc1d8cddf5b4b04e21
1 /*
2 * Copyright 2015-2016, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "TableCellFloatEditor.h"
8 #include <ctype.h>
10 #include <Variant.h>
12 #include "IntegerValue.h"
13 #include "ValueFormatter.h"
16 TableCellFloatEditor::TableCellFloatEditor(::Value* initialValue,
17 ValueFormatter* formatter)
19 TableCellTextControlEditor(initialValue, formatter)
24 TableCellFloatEditor::~TableCellFloatEditor()
29 bool
30 TableCellFloatEditor::ValidateInput() const
32 BVariant variantValue;
33 if (!InitialValue()->ToVariant(variantValue))
34 return false;
36 return GetValueFormatter()->ValidateFormattedValue(Text(),
37 variantValue.Type());
41 status_t
42 TableCellFloatEditor::GetValueForInput(::Value*& _output) const
44 BVariant variantValue;
45 if (!InitialValue()->ToVariant(variantValue))
46 return B_NO_MEMORY;
48 return GetValueFormatter()->GetValueFromFormattedInput(Text(),
49 variantValue.Type(), _output);