]> OCCT Git - occt.git/commitdiff
0028039: Coding rules, TObj - pass file name by reference
authorkgv <kgv@opencascade.com>
Wed, 2 Nov 2016 09:50:02 +0000 (12:50 +0300)
committerapn <apn@opencascade.com>
Tue, 8 Nov 2016 12:15:20 +0000 (15:15 +0300)
src/TObj/TObj_Application.cxx
src/TObj/TObj_Application.hxx
src/TObj/TObj_Model.cxx
src/TObj/TObj_Model.hxx

index 7b0fd7322513755bb28feefe34912f30061166ad..514aaf4be4607eac830a9431e79e7f54739bcb10 100644 (file)
@@ -80,8 +80,8 @@ Standard_CString TObj_Application::ResourcesName()
 //=======================================================================
 
 Standard_Boolean TObj_Application::SaveDocument
-                        (const Handle(TDocStd_Document)&  theSourceDoc,
-                         const TCollection_ExtendedString theTargetFile)
+                        (const Handle(TDocStd_Document)&   theSourceDoc,
+                         const TCollection_ExtendedString& theTargetFile)
 {
   myIsError = Standard_False;
   PCDM_StoreStatus aStatus = SaveAs (theSourceDoc, theTargetFile);
@@ -125,8 +125,8 @@ Standard_Boolean TObj_Application::SaveDocument
 //=======================================================================
 
 Standard_Boolean TObj_Application::LoadDocument
-                        (const TCollection_ExtendedString theSourceFile,
-                         Handle(TDocStd_Document)&        theTargetDoc)
+                        (const TCollection_ExtendedString& theSourceFile,
+                         Handle(TDocStd_Document)&         theTargetDoc)
 {
   myIsError = Standard_False;
   PCDM_ReaderStatus aStatus = PCDM_RS_ReaderException;
index 91fc01e0bd3d6ef57b79dab6326d9976d37b49a3..d0a34beafe0ad55b818c4b2202b12db97c67d981 100644 (file)
 #include <Message_Messenger.hxx>
 #include <TColStd_SequenceOfExtendedString.hxx>
 
-
 //!
 //! This is a base class for OCAF based TObj models
 //!  with declared virtual methods
 //!
-
 class TObj_Application : public TDocStd_Application
 {
 public:
@@ -45,14 +43,14 @@ public:
   */
 
   //! Saving the OCAF document to a file
-  virtual Standard_EXPORT Standard_Boolean SaveDocument
-                         (const Handle(TDocStd_Document)&  theSourceDoc,
-                          const TCollection_ExtendedString theTargetFile);
+  Standard_EXPORT virtual Standard_Boolean SaveDocument
+                         (const Handle(TDocStd_Document)&   theSourceDoc,
+                          const TCollection_ExtendedString& theTargetFile);
 
   //! Loading the OCAF document from a file
-  virtual Standard_EXPORT Standard_Boolean LoadDocument
-                         (const TCollection_ExtendedString theSourceFile,
-                          Handle(TDocStd_Document)&        theTargetDoc);
+  Standard_EXPORT virtual Standard_Boolean LoadDocument
+                         (const TCollection_ExtendedString& theSourceFile,
+                          Handle(TDocStd_Document)&         theTargetDoc);
 
   //! Create the OCAF document from scratch
   virtual Standard_EXPORT Standard_Boolean CreateNewDocument
@@ -117,7 +115,3 @@ public:
 DEFINE_STANDARD_HANDLE(TObj_Application,TDocStd_Application)
 
 #endif
-
-#ifdef _MSC_VER
-#pragma once
-#endif
index e6312699994cade8ace3bbb6ef2ec2e44cfa7e04..e7466fc33d56de8f7320930321d2f8efc21cab31 100644 (file)
@@ -21,7 +21,6 @@
 #include <Precision.hxx>
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_GUID.hxx>
-#include <TCollection_ExtendedString.hxx>
 #include <TCollection_HAsciiString.hxx>
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_Real.hxx>
@@ -108,7 +107,7 @@ void TObj_Model::CloseDocument (const Handle(TDocStd_Document)& theDoc)
 //purpose  : Loads the model from the file
 //=======================================================================
 
-Standard_Boolean TObj_Model::Load (const TCollection_ExtendedString theFile)
+Standard_Boolean TObj_Model::Load (const TCollection_ExtendedString& theFile)
 {
   // Return status
   Standard_Boolean aStatus = Standard_True;
@@ -257,7 +256,7 @@ Standard_Boolean TObj_Model::Save ()
 //purpose  : Save the model to a file
 //=======================================================================
 
-Standard_Boolean TObj_Model::SaveAs (const TCollection_ExtendedString theFile)
+Standard_Boolean TObj_Model::SaveAs (const TCollection_ExtendedString& theFile)
 {
   TObj_Assistant::ClearTypeMap();
   // OCAF document
@@ -744,7 +743,7 @@ void TObj_Model::SetModified (const Standard_Boolean theModified)
 //purpose  : Check whether the document contains the Ocaf data
 //=======================================================================
 
-Standard_Boolean TObj_Model::checkDocumentEmpty (const TCollection_ExtendedString theFile)
+Standard_Boolean TObj_Model::checkDocumentEmpty (const TCollection_ExtendedString& theFile)
 {
   if (theFile.IsEmpty())
     return Standard_True;
index bff5aece501716cea223088dd8145e6df57ee380..68f3ccf6acf8f7eb3ed854b0bc6b3d1097ce0114 100644 (file)
 #ifndef TObj_Model_HeaderFile
 #define TObj_Model_HeaderFile
 
+#include <Message_Messenger.hxx>
 #include <TDF_Label.hxx>
 #include <TObj_Partition.hxx>
-#include <Message_Messenger.hxx>
+#include <TCollection_ExtendedString.hxx>
 
 class TObj_TNameContainer;
 class TObj_Partition;
@@ -64,8 +65,7 @@ class TObj_Model : public MMgt_TShared
   Standard_EXPORT ~TObj_Model ();
 
   //! Check whether the document contains the OCAF data.
-  Standard_EXPORT virtual Standard_Boolean 
-    checkDocumentEmpty(const TCollection_ExtendedString theFile);
+  Standard_EXPORT virtual Standard_Boolean checkDocumentEmpty(const TCollection_ExtendedString& theFile);
 
  public:
   /**
@@ -86,10 +86,10 @@ class TObj_Model : public MMgt_TShared
   
   //! Load the OCAF model from a file. If the filename is empty or file does
   //! not exists, it just initializes model by empty data.
-  virtual Standard_EXPORT Standard_Boolean Load (const TCollection_ExtendedString theFile);
+  Standard_EXPORT virtual Standard_Boolean Load (const TCollection_ExtendedString& theFile);
 
   //! Save the model to a file
-  virtual Standard_EXPORT Standard_Boolean SaveAs (const TCollection_ExtendedString theFile);
+  Standard_EXPORT virtual Standard_Boolean SaveAs (const TCollection_ExtendedString& theFile);
 
   //! Save the model to the same file
   Standard_EXPORT Standard_Boolean Save ();