]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Parameters.cxx
More on graph editor
[cpPlugins.git] / lib / cpPlugins / Interface / Parameters.cxx
index c85aeee595cb123d3f1563e27d0a9f802e08dcff..e584b5e5d36cbd5d7f2719fe46f9ffb481f77302 100644 (file)
@@ -163,12 +163,12 @@ cpPlugins_Parameters_Has( Choices );
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Parameters::
 TString cpPlugins::Interface::Parameters::
-GetString( const TString& name ) const
+GetString( const TString& name, bool force ) const
 {
   TParameters::const_iterator i = this->m_Parameters.find( name );
   if( i != this->m_Parameters.end( ) )
   {
-    if( i->second.first == Self::String )
+    if( i->second.first == Self::String || !force )
       return( i->second.second.second );
 
   } // fi
@@ -229,7 +229,13 @@ GetReal( const TString& name ) const
   if( i != this->m_Parameters.end( ) )
   {
     if( i->second.first == Self::Real )
-      return( TReal( std::atof( i->second.second.second.c_str( ) ) ) );
+    {
+      std::istringstream tok_str( i->second.second.second );
+      float v;
+      tok_str >> v;
+      return( TReal( v ) );
+
+    } // fi
 
   } // fi
   return( TReal( 0 ) );
@@ -317,7 +323,13 @@ GetRealList( std::vector< TReal >& lst, const TString& name ) const
   std::istringstream str( i->second.second.second );
   std::string token;
   while( std::getline( str, token, '#' ) )
-    lst.push_back( TReal( std::atof( token.c_str( ) ) ) );
+  {
+    std::istringstream tok_str( token );
+    float v;
+    tok_str >> v;
+    lst.push_back( TReal( v ) );
+
+  } // elihw
 }
 
 // -------------------------------------------------------------------------
@@ -352,12 +364,12 @@ GetSelectedChoice( const TString& name ) const
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Parameters::
-SetString( const TString& name, const TString& v )
+SetString( const TString& name, const TString& v, bool force )
 {
   TParameters::iterator i = this->m_Parameters.find( name );
   if( i == this->m_Parameters.end( ) )
     return;
-  if( i->second.first != Self::String )
+  if( i->second.first != Self::String && force )
     return;
   i->second.second.second = v;
   this->Modified( );