1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAlgoAPI_Tools.cpp
4 // Created: May 18, 2015
5 // Author: Sergey POKHODENKO
7 #include "GeomAlgoAPI_Tools.h"
11 #include <TCollection_AsciiString.hxx>
12 #include <OSD_Path.hxx>
14 using namespace GeomAlgoAPI_Tools;
16 Localizer::Localizer()
18 myCurLocale = std::setlocale(LC_NUMERIC, 0);
19 std::setlocale(LC_NUMERIC, "C");
22 Localizer::~Localizer()
24 std::setlocale(LC_NUMERIC, myCurLocale.c_str());
28 std::string File_Tools::extension(const std::string& theFileName)
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();
40 std::string File_Tools::name(const std::string& theFileName)
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();