Salome HOME
Kernel_Utils::Localizer - common interface to solve problems with non-"C" locales
authorouv <ouv@opencascade.com>
Mon, 2 Nov 2009 12:21:39 +0000 (12:21 +0000)
committerouv <ouv@opencascade.com>
Mon, 2 Nov 2009 12:21:39 +0000 (12:21 +0000)
src/Basics/Basics_Utils.cxx
src/Basics/Basics_Utils.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx

index 10a12b74a66c82c3e42e64f5e573d0fb86ddc921..3be1e68c2721427a229add1cfe8f6cf43dc08021 100644 (file)
@@ -82,4 +82,14 @@ namespace Kernel_Utils
     return p;
   }
   
+  Localizer::Localizer()
+  {
+    myCurLocale = setlocale(LC_NUMERIC, 0);
+    setlocale(LC_NUMERIC, "C");
+  }
+
+  Localizer::~Localizer()
+  {
+    setlocale(LC_NUMERIC, myCurLocale.c_str());
+  }
 }
index ed99361c7036da6fc63ce6488364b290fd46c620..fe6736562af026f0bf45f5903d293b68887fc1bc 100644 (file)
 namespace Kernel_Utils
 {
   BASICS_EXPORT std::string GetHostname();
+
+  class Localizer
+  {
+  public:
+    Localizer();
+    ~Localizer();
+  private:
+    std::string myCurLocale;
+  };
 }
 
 #endif //_Basics_UTILS_HXX_
index ccde0d3efdfc6e044ca8635dbb39619c9e4d108d..2b24641addadc8c02385029e1e06ccd4373eaeeb 100644 (file)
@@ -28,6 +28,8 @@
 
 using namespace std;
 
+#include <Basics_Utils.hxx>
+
 #include "DF_Application.hxx"
 #include "DF_ChildIterator.hxx"
 
@@ -48,23 +50,6 @@ using namespace std;
 #define VARIABLE_SEPARATOR  ':'
 #define OPERATION_SEPARATOR '|'
 
-// auxilary class intended to fix problems with locales
-class Localizer
-{
-public:
-  Localizer()
-  {
-    myCurLocale = setlocale(LC_NUMERIC, 0);
-    setlocale(LC_NUMERIC, "C");
-  }
-  ~Localizer()
-  {
-    setlocale(LC_NUMERIC, myCurLocale.c_str());
-  }
-private:
-  std::string myCurLocale;
-};
-
 //============================================================================
 /*! Function : SALOMEDSImpl_Study
  *  Purpose  : SALOMEDSImpl_Study constructor
@@ -922,7 +907,7 @@ string SALOMEDSImpl_Study::_GetStudyVariablesScript()
   if(myNoteBookVars.empty())
     return dump;
 
-  Localizer loc;
+  Kernel_Utils::Localizer loc;
   
   dump += "####################################################\n";
   dump += "##       Begin of NoteBook variables section      ##\n";