From 5ff941b750add8f1b3424d388d53f607f8e09f62 Mon Sep 17 00:00:00 2001 From: caremoli Date: Thu, 24 Sep 2009 09:48:38 +0000 Subject: [PATCH] CCAR: add C++ method getContainerName to component class --- src/Container/Component_i.cxx | 17 +++++++++++++++++ src/Container/SALOME_Component_i.hxx | 1 + 2 files changed, 18 insertions(+) diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 75d053454..8d9582fba 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -1077,3 +1077,20 @@ Engines_Component_i::configureSalome_file(std::string service_name, // By default this method does nothing } +//============================================================================= +/*! + * C++ method: return the name of the container associated with this component + * This name does not contains the "/Containers" string and all "/" are replaced by "_" + * \return the container name (reformatted) + */ +//============================================================================= +std::string Engines_Component_i::getContainerName() +{ + CORBA::String_var containerName=_container->name(); + std::string name(containerName); + name.erase(0,12); + string::size_type slash =name.find_first_of('/'); + if(slash != std::string::npos) + name[slash]='_'; + return name; +} diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index b87f3212b..652f637a7 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -119,6 +119,7 @@ public: PortableServer::ObjectId * getId(); Engines_Container_i *GetContainerPtr(); + std::string getContainerName(); virtual bool setStudyId(CORBA::Long studyId); static bool isMultiStudy(); -- 2.39.2