]> SALOME platform Git repositories - samples/light.git/blob - src/LIGHTGUI/LIGHTGUI_DataModel.h
Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/light.git] / src / LIGHTGUI / LIGHTGUI_DataModel.h
1 //  Copyright (C) 2005-2008  OPEN CASCADE
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // LIGHT : sample (no-corba-engine) SALOME module
20 // File   : LIGHTGUI_DataModel.h
21 // Author : Julia DOROVSKIKH
22 //
23 #ifndef LIGHTGUI_DATAMODEL_H
24 #define LIGHTGUI_DATAMODEL_H
25
26 #include <LightApp_DataModel.h>
27
28 class CAM_Module;
29 class LightApp_Study;
30 class LightApp_DataObject;
31 class LIGHTGUI_DataObject;
32
33 class LIGHTGUI_DataModel : public LightApp_DataModel
34 {
35   Q_OBJECT
36
37 public:
38   LIGHTGUI_DataModel( CAM_Module* theModule );
39   virtual ~LIGHTGUI_DataModel();
40
41   virtual bool         open( const QString&, CAM_Study*, QStringList );
42   virtual bool         save( QStringList& );
43   virtual bool         saveAs( const QString&, CAM_Study*, QStringList& );
44   virtual bool         close();
45   virtual bool         create( CAM_Study* );
46
47   virtual bool         isModified() const;
48   virtual bool         isSaved() const;
49
50   virtual void         update( LightApp_DataObject* = 0, LightApp_Study* = 0 );
51
52   bool                 loadFile( const QString&, CAM_Study* = 0 );
53   bool                 dumpFile( const QString& = QString() );
54   QString              fileName() const;
55
56   QString              getLineText( const int ) const;
57   bool                 setLineText( const int, const QString& );
58   bool                 insertLineBefore( const int, const QString& );
59   bool                 deleteTextLine( const int );
60
61   void                 clearAll();
62
63   int                  generateId();
64
65   static int           id( const QString& );
66   static QString       entry( const int );
67
68   int                  lineNb( const QString& );
69   int                  lineNb( const int );
70
71   QList<int>           getIds() const;
72
73 private:
74   void                 buildTree( SUIT_DataObject*, const QStringList& );
75   LIGHTGUI_DataObject* findObject( const int ) const;
76
77 private:
78   QString              myFileName;
79   QString              myStudyURL;
80   int                  myMaxId;
81 };
82
83 #endif // LIGHTGUI_DATAMODEL_H