core/vgui/internals/vgui_simple_field.cxx
Go to the documentation of this file.
00001 // This is core/vgui/internals/vgui_simple_field.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author Philip C. Pritchett, RRG, University of Oxford
00008 // \date   23 Oct 99
00009 // \brief  See vgui_simple_field.h for a description of this file.
00010 
00011 #include "vgui_simple_field.h"
00012 
00013 #include <vcl_sstream.h>
00014 
00015 
00016 template <class T>
00017 vgui_simple_field<T>::vgui_simple_field(const char *text,T &variable_to_modify)
00018   : vgui_dialog_field(text)
00019   , var(variable_to_modify)
00020 {
00021 }
00022 
00023 template <class T>
00024 vgui_simple_field<T>::~vgui_simple_field()
00025 {
00026 }
00027 
00028 template <class T>
00029 vcl_string vgui_simple_field<T>::current_value() const
00030 {
00031   vcl_stringstream ss;
00032   ss << T(var) << '\0';
00033   return ss.str();
00034 }
00035 
00036 template <class T>
00037 bool vgui_simple_field<T>::update_value(const vcl_string &s)
00038 {
00039   vcl_stringstream ss(s);
00040   ss >> var;
00041   return ss.eof();
00042 }
00043 
00044 
00045 template class vgui_simple_field<bool>;
00046 template class vgui_simple_field<int>;
00047 template class vgui_simple_field<long>;
00048 template class vgui_simple_field<float>;
00049 template class vgui_simple_field<double>;