Salome HOME
Issue #608: Usage of OCCT in interface -- Remove OCCT from *Import interfaces
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Tools.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    GeomAlgoAPI_Tools.cpp
4 // Created: May 18, 2015
5 // Author:  Sergey POKHODENKO
6
7 #include "GeomAlgoAPI_Tools.h"
8
9 #include <clocale>
10
11 #include <TCollection_AsciiString.hxx>
12 #include <OSD_Path.hxx>
13
14 using namespace GeomAlgoAPI_Tools;
15
16 Localizer::Localizer()
17 {
18   myCurLocale = std::setlocale(LC_NUMERIC, 0);
19   std::setlocale(LC_NUMERIC, "C");
20 }
21
22 Localizer::~Localizer()
23 {
24   std::setlocale(LC_NUMERIC, myCurLocale.c_str());
25 }
26
27
28 std::string File_Tools::extension(const std::string& theFileName)
29 {
30   // retrieve the file and plugin library names
31   TCollection_AsciiString aFileName(theFileName.c_str());
32   OSD_Path aPath(aFileName);
33   TCollection_AsciiString anExtension = aPath.Extension();
34   // TCollection_AsciiString are numbered from 1
35   anExtension = anExtension.SubString(2, anExtension.Length());
36   anExtension.UpperCase();
37   return anExtension.ToCString();
38 }
39
40 std::string File_Tools::name(const std::string& theFileName)
41 {
42   // retrieve the file and plugin library names
43   TCollection_AsciiString aFileName(theFileName.c_str());
44   OSD_Path aPath(aFileName);
45   return aPath.Name().ToCString();
46 }