Version: 8.3.0
DF_Application.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, 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, or (at your option) any later version.
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 
20 #ifndef DFAPPLICATION_HXX
21 #define DFAPPLICATION_HXX
22 
23 #include "DF_definitions.hxx"
24 #include "DF_Document.hxx"
25 #include <string>
26 #include <map>
27 
28 //Class DF_Application responsible for creation and manipulation of Documents
30 public:
31  //Constructor
33 
35 
36  //Creates a new document with given type, returns a smart pointer to
37  //newly created document.
38  Standard_EXPORT DF_Document* NewDocument(const std::string& theDocumentType);
39 
40  //Closes and removes the given Document
41  Standard_EXPORT void Close(const DF_Document* theDocument);
42 
43  //Returns a Document by Document's ID
44  Standard_EXPORT DF_Document* GetDocument(int theDocumentID);
45 
46  //Returns a list of IDs of all currently opened documents
47  Standard_EXPORT std::vector<int> GetDocumentIDs();
48 
49  //Returns a number of existent documents
51 
52  //Virtual methods to be redefined if required by specific application
53 
54  //Restores a Document from the given file, returns a smart
55  //pointer to opened document.
56  Standard_EXPORT virtual DF_Document* Open(const std::string& theFileName);
57 
58  //Saves a Document in a given file with name theFileName
59  Standard_EXPORT virtual void SaveAs(const DF_Document* theDocument, const std::string& theFileName);
60 
61 private:
63  std::map<int, DF_Document*> _documents;
64 
65 };
66 #endif