Version: 8.3.0
DF_Attribute.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 DFATTRIBUTE_HXX
21 #define DFATTRIBUTE_HXX
22 
23 #include "DF_definitions.hxx"
24 #include <string>
25 
26 class DF_Label;
27 class DF_LabelNode;
28 
29 //Class DF_Attribute is used to store some data defined by the DF_Attribute type
30 class DF_Attribute {
31 protected:
33 
34 public:
35  //Constructor
37 
39 
40  //Returns a Label on which this Attribute is located.
42 
43  //Searches an Attribute with given ID located on the same Label as this Attribute.
44  Standard_EXPORT DF_Attribute* FindAttribute(const std::string& theID) const;
45 
46 
47  Standard_EXPORT virtual std::string Save() { return ""; }
48  Standard_EXPORT virtual void Load(const std::string&) {}
49 
50  //######## Virtual methods that must be redefined in descendants of the DF_Attribute
51 
52  //This method must be redefined in all descendents of the DF_Attribute
53  //ID is a std::string that uniquely identify the given type of Attributes within the Application.
54  Standard_EXPORT virtual const std::string& ID() const = 0;
55 
56  //Restores a content of this Attribute from another Attribute
57  Standard_EXPORT virtual void Restore(DF_Attribute* theAttribute) = 0;
58 
59  //Creates a new empty copy oà this Attribute
60  Standard_EXPORT virtual DF_Attribute* NewEmpty() const = 0;
61 
62  //Pastes a content of this Attribute into another Attribute
63  Standard_EXPORT virtual void Paste(DF_Attribute* theIntoAttribute) = 0;
64 
65 
66  //######## Callbacks
67 
68  Standard_EXPORT virtual void AfterAddition() {}
69  Standard_EXPORT virtual void BeforeForget() {}
70 
71 protected:
72  void Backup() {}
73 
74 
75 friend class DF_Label;
76 
77 };
78 
79 #endif