From 277a199f308e2173b3a35eabdee0a7cf3ba1c983 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 29 Jan 2008 13:43:39 +0000 Subject: [PATCH] PAL18696 SMESH : version of MED export + static std::string GetVersionString(const MED::EVersion theVersion, int theNbDigits=2); --- src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx | 18 ++++++++++++++++++ src/DriverMED/DriverMED_W_SMESHDS_Mesh.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index cf9381ce9..c0315233d 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -66,6 +66,24 @@ void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName) return SetFile(theFileName,MED::eV2_2); } +string DriverMED_W_SMESHDS_Mesh::GetVersionString(const MED::EVersion theVersion, int theNbDigits) +{ + TInt majeur, mineur, release; + majeur = mineur = release = 0; + if ( theVersion == eV2_1 ) + MED::GetVersionRelease(majeur, mineur, release); + else + MED::GetVersionRelease(majeur, mineur, release); + ostringstream name; + if ( theNbDigits > 0 ) + name << majeur; + if ( theNbDigits > 1 ) + name << "." << mineur; + if ( theNbDigits > 2 ) + name << "." << release; + return name.str(); +} + void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName) { myMeshName = theMeshName; diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.h b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.h index 80f792298..899c4375b 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.h +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.h @@ -48,6 +48,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh virtual void SetFile(const std::string& theFileName); void SetFile(const std::string& theFileName, MED::EVersion theId); + static std::string GetVersionString(const MED::EVersion theVersion, int theNbDigits=2); /*! sets file name; only for usage with Add(), not Write() */ -- 2.39.2