Salome HOME
Partition naming
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Tools.cpp
index 50a3907eb6067d327193f0947b73be880e651bfe..5632155e953e3565fc9f7de2db8f5b41b00bd97a 100644 (file)
@@ -1,14 +1,16 @@
-/*
- * GeomAlgoAPI_Tools.cpp
- *
- *  Created on: May 18, 2015
- *      Author: spo
- */
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:    GeomAlgoAPI_Tools.cpp
+// Created: May 18, 2015
+// Author:  Sergey POKHODENKO
 
 #include "GeomAlgoAPI_Tools.h"
 
 #include <clocale>
 
+#include <TCollection_AsciiString.hxx>
+#include <OSD_Path.hxx>
+
 using namespace GeomAlgoAPI_Tools;
 
 Localizer::Localizer()
@@ -21,3 +23,24 @@ Localizer::~Localizer()
 {
   std::setlocale(LC_NUMERIC, myCurLocale.c_str());
 }
+
+
+std::string File_Tools::extension(const std::string& theFileName)
+{
+  // retrieve the file and plugin library names
+  TCollection_AsciiString aFileName(theFileName.c_str());
+  OSD_Path aPath(aFileName);
+  TCollection_AsciiString anExtension = aPath.Extension();
+  // TCollection_AsciiString are numbered from 1
+  anExtension = anExtension.SubString(2, anExtension.Length());
+  anExtension.UpperCase();
+  return anExtension.ToCString();
+}
+
+std::string File_Tools::name(const std::string& theFileName)
+{
+  // retrieve the file and plugin library names
+  TCollection_AsciiString aFileName(theFileName.c_str());
+  OSD_Path aPath(aFileName);
+  return aPath.Name().ToCString();
+}