mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-21 00:29:40 +05:00
Kernel_Utils::Localizer - common interface to solve problems with non-"C" locales
This commit is contained in:
parent
5878f0928c
commit
625eaaf497
@ -28,6 +28,8 @@
|
||||
|
||||
#include <GEOMImpl_IMeasureOperations.hxx>
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
// OCCT Includes
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
@ -79,15 +81,11 @@ Standard_Integer GEOMImpl_SketcherDriver::Execute(TFunction_Logbook& log) const
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
// Set "C" numeric locale to save numbers correctly
|
||||
std::string aCurLocale = setlocale(LC_NUMERIC, 0);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
Kernel_Utils::Localizer loc;
|
||||
|
||||
// create sketcher
|
||||
Sketcher_Profile aProfile (aCommand.ToCString());
|
||||
|
||||
// Return previous locale
|
||||
setlocale(LC_NUMERIC, aCurLocale.data());
|
||||
|
||||
if (!aProfile.IsDone()) {
|
||||
Standard_ConstructionError::Raise("Sketcher creation failed");
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
//
|
||||
#include "utilities.h"
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
#include <IGESControl_Controller.hxx>
|
||||
#include <IGESControl_Writer.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
@ -74,8 +76,7 @@ IGESEXPORT_EXPORT
|
||||
aBrepMode = 1;
|
||||
|
||||
// Set "C" numeric locale to save numbers correctly
|
||||
std::string aCurLocale = setlocale(LC_NUMERIC, 0);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
Kernel_Utils::Localizer loc;
|
||||
|
||||
// initialize writer
|
||||
IGESControl_Controller::Init();
|
||||
@ -90,7 +91,6 @@ IGESEXPORT_EXPORT
|
||||
bool ok = ICW.Write( theFileName.ToCString() );
|
||||
|
||||
// Return previous locale
|
||||
setlocale(LC_NUMERIC, aCurLocale.data());
|
||||
if ( ok )
|
||||
return 1;
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
//
|
||||
#include "utilities.h"
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
#include <IGESControl_Reader.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
@ -72,8 +74,7 @@ IGESIMPORT_EXPORT
|
||||
const TDF_Label&)
|
||||
{
|
||||
// Set "C" numeric locale to save numbers correctly
|
||||
std::string aCurLocale = setlocale(LC_NUMERIC, 0);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
Kernel_Utils::Localizer loc;
|
||||
|
||||
IGESControl_Reader aReader;
|
||||
TopoDS_Shape aResShape;
|
||||
@ -103,8 +104,6 @@ IGESIMPORT_EXPORT
|
||||
TopoDS_Vertex V;
|
||||
B.MakeVertex(V,P,1.e-7);
|
||||
aResShape = V;
|
||||
// Return previous locale before return from import
|
||||
setlocale(LC_NUMERIC, aCurLocale.data());
|
||||
return aResShape;
|
||||
}
|
||||
if( theFormatName == "IGES_SCALE" ) {
|
||||
@ -155,8 +154,6 @@ IGESIMPORT_EXPORT
|
||||
theError = aFail->GetMessageString();
|
||||
aResShape.Nullify();
|
||||
}
|
||||
// Return previous locale
|
||||
setlocale(LC_NUMERIC, aCurLocale.data());
|
||||
return aResShape;
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
//
|
||||
#include "utilities.h"
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
|
||||
#include <STEPControl_Writer.hxx>
|
||||
@ -68,8 +70,7 @@ STEPEXPORT_EXPORT
|
||||
try
|
||||
{
|
||||
// Set "C" numeric locale to save numbers correctly
|
||||
std::string aCurLocale = setlocale(LC_NUMERIC, 0);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
Kernel_Utils::Localizer loc;
|
||||
|
||||
IFSelect_ReturnStatus status ;
|
||||
//VRV: OCC 4.0 migration
|
||||
@ -83,7 +84,6 @@ STEPEXPORT_EXPORT
|
||||
status = aWriter.Write( theFileName.ToCString() );
|
||||
|
||||
// Return previous locale
|
||||
setlocale(LC_NUMERIC, aCurLocale.data());
|
||||
if ( status == IFSelect_RetDone )
|
||||
return 1;
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
//
|
||||
#include "utilities.h"
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
@ -75,8 +77,7 @@ STEPIMPORT_EXPORT
|
||||
{
|
||||
MESSAGE("Import STEP model from file " << theFileName.ToCString());
|
||||
// Set "C" numeric locale to save numbers correctly
|
||||
std::string aCurLocale = setlocale(LC_NUMERIC, 0);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
Kernel_Utils::Localizer loc;
|
||||
TopoDS_Shape aResShape;
|
||||
//VRV: OCC 4.0 migration
|
||||
STEPControl_Reader aReader;
|
||||
@ -156,7 +157,6 @@ STEPIMPORT_EXPORT
|
||||
aResShape.Nullify();
|
||||
}
|
||||
// Return previous locale
|
||||
setlocale(LC_NUMERIC, aCurLocale.data());
|
||||
return aResShape;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user