Salome HOME
[EDF30382] : Synchro mecanism to ease test of extreme situations
[modules/kernel.git] / src / DF / DF_Document.cxx
index 47b9516e7a30513116e82fb909b02640998056c1..2144aae9a449d23d2afb5a9e2aeaaad58c1094e3 100644 (file)
@@ -1,18 +1,35 @@
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 #include "DF_definitions.hxx"
 #include "DF_Document.hxx"
 #include "DF_Label.hxx"
 #include "DF_ChildIterator.hxx"
 
-using namespace std;
-
 //Class DF_Document is container for user's data stored as a tree of Labels
 //with assigned Attributes
 
-DF_Document::DF_Document(const string& theDocumentType)
+DF_Document::DF_Document(const std::string& theDocumentType)
 {
   _id = -1;
   _type = theDocumentType;
-  _modified = true;
+  _modified = false;
 }
 
 DF_Document::~DF_Document()
@@ -61,7 +78,7 @@ int DF_Document::GetDocumentID() const
 }
 
 //Returns a type of the Document
-string DF_Document::GetDocumentType()
+std::string DF_Document::GetDocumentType()
 {
   return _type;
 }
@@ -71,17 +88,18 @@ void DF_Document::Clear()
 {
   if(_root.IsNull()) return;
 
-  vector<DF_LabelNode*> vn;
+  std::vector<DF_LabelNode*> vn;
   DF_ChildIterator CI(_root, true);
   for(; CI.More(); CI.Next()) {
     DF_LabelNode* node =  CI.Value()._node; 
     if(node) vn.push_back(node);
   }
 
-  for(int i = 0, len = vn.size(); i<len; i++)
+  for(size_t i = 0, len = vn.size(); i<len; i++)
     delete vn[i];
 
   _root._node->Reset();
+  _root.Nullify();
 }
 
 //Returns true if this document is empty
@@ -112,13 +130,13 @@ void DF_Document::SetModified(bool isModified)
 
 
 //Restores a content of the Document from the std::string theData
-void DF_Document::Load(const std::string& theData)
+void DF_Document::Load(const std::string& /*theData*/)
 {
    //Not implemented
 }
 
 //Converts a content of the Document into the std::string
-string DF_Document::Save()
+std::string DF_Document::Save()
 {
    //Not implemented
    return "";