Salome HOME
Remove warnings
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_SObject.cxx
index b34f8f02bcfa16a9ef0847282d70b9806711bfe0..7cf41a0f8b91955b57905e89ec7e02a4f3321023 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -19,6 +19,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
 //  File   : SALOMEDSImpl_SObject.cxx
 //  Author : Sergey RUIN
@@ -29,8 +30,6 @@
 #include "SALOMEDSImpl_SComponent.hxx"
 #include "SALOMEDSImpl_Study.hxx"
 
-using namespace std;
-
 #include <map>
 #include <string.h>
 
@@ -85,7 +84,7 @@ SALOMEDSImpl_SObject::~SALOMEDSImpl_SObject()
  *  Purpose  : 
  */
 //============================================================================
-string SALOMEDSImpl_SObject::GetID() const
+std::string SALOMEDSImpl_SObject::GetID() const
 {
   return _lab.Entry();
 }
@@ -135,7 +134,7 @@ SALOMEDSImpl_Study* SALOMEDSImpl_SObject::GetStudy() const
  */
 //============================================================================
 bool SALOMEDSImpl_SObject::FindAttribute(DF_Attribute*& theAttribute, 
-                                        const string& theTypeOfAttribute) const
+                                         const std::string& theTypeOfAttribute) const
 {
   if(_lab.IsNull()) return false;
   std::string aGUID = GetGUID(theTypeOfAttribute);
@@ -150,13 +149,13 @@ bool SALOMEDSImpl_SObject::FindAttribute(DF_Attribute*& theAttribute,
  *  Purpose  : Returns list of all attributes for this sobject
  */
 //============================================================================
-vector<DF_Attribute*> SALOMEDSImpl_SObject::GetAllAttributes() const
+std::vector<DF_Attribute*> SALOMEDSImpl_SObject::GetAllAttributes() const
 {
-  vector<DF_Attribute*> va1, va = _lab.GetAttributes();
+  std::vector<DF_Attribute*> va1, va = _lab.GetAttributes();
   for(int i = 0, len = va.size(); i<len; i++) {
     SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(va[i]); 
-    if(ga && ga->Type() != string("AttributeReference"))
-       va1.push_back(va[i]);
+    if(ga && ga->Type() != std::string("AttributeReference"))
+        va1.push_back(va[i]);
   }
 
   return va1;
@@ -199,9 +198,9 @@ bool SALOMEDSImpl_SObject::FindSubObject(int theTag, SALOMEDSImpl_SObject& theOb
  *  Purpose  : 
  */
 //============================================================================
-string SALOMEDSImpl_SObject::GetName() const
+std::string SALOMEDSImpl_SObject::GetName() const
 {
-  string aStr = "";
+  std::string aStr = "";
   SALOMEDSImpl_AttributeName* aName;
   if ((aName=(SALOMEDSImpl_AttributeName*)_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
     aStr =aName->Value();
@@ -214,9 +213,9 @@ string SALOMEDSImpl_SObject::GetName() const
  *  Purpose  : 
  */
 //============================================================================
-string SALOMEDSImpl_SObject::GetComment() const
+std::string SALOMEDSImpl_SObject::GetComment() const
 {
-  string aStr = "";
+  std::string aStr = "";
   SALOMEDSImpl_AttributeComment* aComment;
   if ((aComment=(SALOMEDSImpl_AttributeComment*)_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
     aStr = aComment->Value();
@@ -229,9 +228,9 @@ string SALOMEDSImpl_SObject::GetComment() const
  *  Purpose  : 
  */
 //============================================================================
-string SALOMEDSImpl_SObject::GetIOR() const 
+std::string SALOMEDSImpl_SObject::GetIOR() const 
 {
-  string aStr = "";
+  std::string aStr = "";
   SALOMEDSImpl_AttributeIOR* anIOR;
   if ((anIOR=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
     aStr = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(anIOR)->Value();
@@ -240,13 +239,16 @@ string SALOMEDSImpl_SObject::GetIOR() const
 }
 
 
-std::string SALOMEDSImpl_SObject::GetGUID(const string& theType) 
+std::string SALOMEDSImpl_SObject::GetGUID(const std::string& theType) 
 {
   __AttributeTypeToGUIDForSObject
 
   if (strncmp(theType.c_str(), "AttributeTreeNodeGUID",21) == 0) {
     return theType.substr(21, theType.size()); 
   }
+  if (strncmp(theType.c_str(), "AttributeUserID",15) == 0) {
+    return theType.substr(15, theType.size()); 
+  }
   return "";
 }
 
@@ -290,3 +292,10 @@ bool SALOMEDSImpl_SObject::IsComponent() const
     return SALOMEDSImpl_SComponent::IsA(_lab);
 }
 
+void SALOMEDSImpl_SObject::SetAttrString(const std::string& name, const std::string& value)
+{
+  if(name=="AttributeName")SALOMEDSImpl_AttributeName::Set(GetLabel(), value);
+  else if(name=="AttributeIOR")SALOMEDSImpl_AttributeIOR::Set(GetLabel(), value);
+  else if(name=="AttributeString")SALOMEDSImpl_AttributeString::Set(GetLabel(), value);
+  else if(name=="AttributePixMap")SALOMEDSImpl_AttributePixMap::Set(GetLabel(), value);
+}