0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / XCAFDoc / XCAFDoc_Note.hxx
1 // Copyright (c) 2017-2018 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _XCAFDoc_Note_HeaderFile
15 #define _XCAFDoc_Note_HeaderFile
16
17 #include <Standard.hxx>
18 #include <TCollection_ExtendedString.hxx>
19 #include <TDF_DerivedAttribute.hxx>
20 #include <TDF_LabelSequence.hxx>
21 #include <XCAFNoteObjects_NoteObject.hxx>
22
23 class TDF_RelocationTable;
24
25 //! A base note attribute.
26 //! Any note contains the name of the user created the note
27 //! and the creation timestamp.
28 class XCAFDoc_Note : public TDF_Attribute
29 {
30 public:
31
32   DEFINE_STANDARD_RTTIEXT(XCAFDoc_Note, TDF_Attribute)
33
34   //! Checks if the given label represents a note.
35   Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel);
36
37   //! Finds a reference attribute on the given label and returns it, if it is found
38   Standard_EXPORT static Handle(XCAFDoc_Note) Get(const TDF_Label& theLabel);
39
40   //! Sets the user name and the timestamp of the note.
41   //! \param [in] theUserName  - the user associated with the note.
42   //! \param [in] theTimeStamp - timestamp of the note.
43   //! \return A handle to the attribute instance.
44   Standard_EXPORT void Set(const TCollection_ExtendedString& theUserName,
45                            const TCollection_ExtendedString& theTimeStamp);
46
47   //! Returns the user name, who created the note.
48   const TCollection_ExtendedString& UserName() const { return myUserName; }
49
50   //! Returns the timestamp of the note.
51   const TCollection_ExtendedString& TimeStamp() const { return myTimeStamp; }
52
53   //! Checks if the note isn't linked to annotated items.
54   Standard_EXPORT Standard_Boolean IsOrphan() const;
55
56   //! Returns auxiliary data object
57   Standard_EXPORT Handle(XCAFNoteObjects_NoteObject) GetObject() const;
58
59   //! Updates auxiliary data
60   Standard_EXPORT void SetObject(const Handle(XCAFNoteObjects_NoteObject)& theObject);
61
62 public:
63
64   // Overrides TDF_Attribute virtuals
65   Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theAttrFrom) Standard_OVERRIDE;
66   Standard_EXPORT void Paste(const Handle(TDF_Attribute)&       theAttrInto,
67                              const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
68   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
69   
70   //! Dumps the content of me into the stream
71   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
72
73 protected:
74
75   //! Creates an empty note.
76   Standard_EXPORT XCAFDoc_Note();
77
78 private:
79
80   TCollection_ExtendedString myUserName;  ///< Name of the user, who created the note.
81   TCollection_ExtendedString myTimeStamp; ///< Timestamp, when the note was created.
82 };
83
84 DEFINE_STANDARD_HANDLE(XCAFDoc_Note, TDF_Attribute)
85
86 #endif // _XCAFDoc_Note_HeaderFile