]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/BaseObjects/Parameters.cxx
...
[cpPlugins.git] / lib / cpPlugins / BaseObjects / Parameters.cxx
index d55278661dc18c0c6d1b77ce2b8635607b5c8c49..88a82af798f2952b74d52c78149d198cfa1d236e 100644 (file)
@@ -174,6 +174,74 @@ ConfigureAsChoices(
   this->Modified( );
 }
 
+// -------------------------------------------------------------------------
+void cpPlugins::BaseObjects::Parameters::
+ConfigureAsRealTypesChoices( const std::string& name )
+{
+  std::vector< std::string > choices;
+#ifdef cpPlugins_CONFIG_REAL_TYPES_float
+  choices.push_back( "float" );
+#endif // cpPlugins_CONFIG_REAL_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_double
+  choices.push_back( "double" );
+#endif // cpPlugins_CONFIG_REAL_TYPES_double
+  this->ConfigureAsChoices( name, choices );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::BaseObjects::Parameters::
+ConfigureAsIntTypesChoices( const std::string& name )
+{
+  std::vector< std::string > choices;
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_char
+  choices.push_back( "char" );
+  choices.push_back( "uchar" );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_char
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_short
+  choices.push_back( "short" );
+  choices.push_back( "ushort" );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_short
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_int
+  choices.push_back( "int" );
+  choices.push_back( "uint" );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_int
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_long
+  choices.push_back( "long" );
+  choices.push_back( "ulong" );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_long
+#ifdef cpPlugins_CONFIG_REAL_TYPES_float
+  choices.push_back( "float" );
+#endif // cpPlugins_CONFIG_REAL_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_double
+  choices.push_back( "double" );
+#endif // cpPlugins_CONFIG_REAL_TYPES_double
+  this->ConfigureAsChoices( name, choices );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::BaseObjects::Parameters::
+ConfigureAsScalarTypesChoices( const std::string& name )
+{
+  std::vector< std::string > choices;
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_char
+  choices.push_back( "char" );
+  choices.push_back( "uchar" );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_char
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_short
+  choices.push_back( "short" );
+  choices.push_back( "ushort" );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_short
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_int
+  choices.push_back( "int" );
+  choices.push_back( "uint" );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_int
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_long
+  choices.push_back( "long" );
+  choices.push_back( "ulong" );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_long
+  this->ConfigureAsChoices( name, choices );
+}
+
 // -------------------------------------------------------------------------
 std::vector< std::string > cpPlugins::BaseObjects::Parameters::
 GetChoices( const std::string& name ) const
@@ -447,11 +515,11 @@ AddToOpenFileNameList(
   {
     if( i->second.first == OpenFileNameList )
     {
-      auto pos = name.find_last_of( "/\\" );
+      auto pos = v.find_last_of( "/\\" );
       if( i->second.second == "" )
-        i->second.second = name.substr( 0, pos );
+        i->second.second = v.substr( 0, pos );
       i->second.second += std::string( "#" );
-      i->second.second += name.substr( pos + 1 );
+      i->second.second += v.substr( pos + 1 );
       this->Modified( );
 
     } // fi
@@ -486,11 +554,11 @@ AddToSaveFileNameList(
   {
     if( i->second.first == SaveFileNameList )
     {
-      auto pos = name.find_last_of( "/\\" );
+      auto pos = v.find_last_of( "/\\" );
       if( i->second.second == "" )
-        i->second.second = name.substr( 0, pos );
+        i->second.second = v.substr( 0, pos );
       i->second.second += std::string( "#" );
-      i->second.second += name.substr( pos + 1 );
+      i->second.second += v.substr( pos + 1 );
       this->Modified( );
 
     } // fi