//
#include "SALOMEDSImpl_ScalarVariable.hxx"
#include "SALOMEDSImpl_GenericVariable.hxx"
+#include "Basics_Utils.hxx"
#include <iostream>
#include <cstdlib>
#include <cstdio>
+#define OLDSTUDY_COMPATIBILITY
+
//============================================================================
/*! Function : SALOMEDSImpl_ScalarVariable
* Purpose :
*/
//============================================================================
std::string SALOMEDSImpl_ScalarVariable::Save() const{
+ Kernel_Utils::Localizer loc;
+
char buffer[255];
switch(Type())
{
//============================================================================
std::string SALOMEDSImpl_ScalarVariable::SaveToScript() const
{
+ Kernel_Utils::Localizer loc;
+
char buffer[255];
switch(Type())
{
}
case SALOMEDSImpl_GenericVariable::BOOLEAN_VAR:
{
- if((bool)myValue)
- sprintf(buffer, "%s", "True");
- else
- sprintf(buffer, "%s", "False");
+ sprintf(buffer, "%s", ((bool)myValue) ? "True" : "False");
break;
}
case SALOMEDSImpl_GenericVariable::STRING_VAR:
//============================================================================
void SALOMEDSImpl_ScalarVariable::Load(const std::string& theStrValue)
{
- double aValue = atof(theStrValue.c_str());
- setValue(aValue);
+ Kernel_Utils::Localizer loc;
+
+ if ( Type() == SALOMEDSImpl_GenericVariable::STRING_VAR ) {
+ setStringValue( theStrValue );
+ }
+ else {
+ std::string strCopy = theStrValue;
+#ifdef OLDSTUDY_COMPATIBILITY
+ int dotpos = strCopy.find(',');
+ if (dotpos != std::string::npos)
+ strCopy.replace(dotpos, 1, ".");
+#endif // OLDSTUDY_COMPATIBILITY
+ double aValue = atof(strCopy.c_str());
+ setValue(aValue);
+ }
}
//std::cerr << "I'm here newComponent " << std::endl;
_errorCode = "";
CheckLocked();
-
+
SALOMEDSImpl_SComponent sco;
if(DataType.size() == 0) return sco;
char aMultifileState[2];
char ASCIIfileState[2];
+ bool hasModuleData = false;
try {
std::string scoid = anSCO.GetID();
hdf_file->OpenOnDisk(HDF_RDONLY);
hdf_group->OpenOnDisk();
HDFgroup *hdf_sco_group = new HDFgroup((char*)scoid.c_str(), hdf_group);
hdf_sco_group->OpenOnDisk();
+ hasModuleData = true;
unsigned char* aStreamFile = NULL;
int aStreamSize = 0;
}
if (aLocked) _study->GetProperties()->SetLocked(true);
+
+ if (!hasModuleData)
+ return true;
+
_errorCode = "No persistent file";
return false;
}
} else {
_errorCode = "No persistent file";
}
-
+
return true;
}