Salome HOME
updated copyright message
[samples/light.git] / src / LIGHTGUI / LIGHTGUI_DataModel.h
index 410f1cddcae312964a3bb8dd9ec2102b990798a9..6328de75f409ce40c9bddd456afe9692a2f1ad64 100644 (file)
@@ -1,79 +1,81 @@
-//  LIGHT : sample (no-corba-engine) SALOME module
+// Copyright (C) 2005-2023  OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 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 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.
+// 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.
 //
-//  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
 //
-//  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
 //
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//  Author : Julia DOROVSKIKH
-//  Date   : 01/01/2005
-//  $Header$
+// File   : LIGHTGUI_DataModel.h
+// Author : Julia DOROVSKIKH
 
 #ifndef LIGHTGUI_DATAMODEL_H
 #define LIGHTGUI_DATAMODEL_H
 
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
+#include "LIGHTGUI_Exports.h"
 
 #include <LightApp_DataModel.h>
 
-class CAM_Module;
-class LightApp_Study;
-class LightApp_DataObject;
 class LIGHTGUI_DataObject;
 
-class LIGHTGUI_DataModel : public LightApp_DataModel
+class LIGHT_EXPORT LIGHTGUI_DataModel : public LightApp_DataModel
 {
   Q_OBJECT
 
 public:
-  LIGHTGUI_DataModel ( CAM_Module* theModule );
+  LIGHTGUI_DataModel( CAM_Module* theModule );
   virtual ~LIGHTGUI_DataModel();
 
-  virtual bool         open   ( const QString&, CAM_Study*, QStringList );
-  virtual bool         save   ( QStringList& );
-  virtual bool         saveAs ( const QString&, CAM_Study*, QStringList& );
-  virtual bool         close  ();
-  virtual bool         create ( CAM_Study* );
+  virtual bool         open( const QString&, CAM_Study*, QStringList );
+  virtual bool         save( QStringList& );
+  virtual bool         saveAs( const QString&, CAM_Study*, QStringList& );
+  virtual bool         close();
+  virtual bool         create( CAM_Study* );
+
+  virtual bool         isModified() const;
+  virtual bool         isSaved() const;
+
+  virtual void         update( LightApp_DataObject* = 0, LightApp_Study* = 0 );
+
+  bool                 loadFile( const QString&, CAM_Study* = 0 );
+  bool                 dumpFile( const QString& = QString() );
+  QString              fileName() const;
+
+  QString              getLineText( const int ) const;
+  bool                 setLineText( const int, const QString& );
+  bool                 insertLineBefore( const int, const QString& );
+  bool                 deleteTextLine( const int );
 
-  virtual bool         isModified () const;
-  virtual bool         isSaved    () const;
+  void                 clearAll();
 
-  virtual void         update ( LightApp_DataObject* = 0, LightApp_Study* = 0 );
+  int                  generateId();
 
-  bool                 loadFile ( const QString&, CAM_Study* study = 0 );
-  bool                 dumpFile ( const QString& = QString::null );
-  QString              fileName () const;
+  static int           id( const QString& );
+  static QString       entry( const int );
 
-  QString              getLineText      ( const int thePosition ) const;
-  bool                 setLineText      ( const int thePosition, const QString& theText );
-  bool                 insertLineBefore ( const int thePosition, const QString& theText );
-  bool                 deleteTextLine   ( const int thePosition );
+  int                  lineNb( const QString& );
+  int                  lineNb( const int );
 
-  void                 clearAll ();
+  QList<int>           getIds() const;
 
 private:
-  void                 buildTree  ( SUIT_DataObject*, const QStringList& );
-  LIGHTGUI_DataObject* findObject ( const int ) const;
+  void                 buildTree( SUIT_DataObject*, const QStringList& );
+  LIGHTGUI_DataObject* findObject( const int ) const;
 
 private:
   QString              myFileName;
   QString              myStudyURL;
+  int                  myMaxId;
 };
 
 #endif // LIGHTGUI_DATAMODEL_H