Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/XCAFDoc_Note.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (c) 2017-2018 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _XCAFDoc_Note_HeaderFile
0015 #define _XCAFDoc_Note_HeaderFile
0016 
0017 #include <Standard.hxx>
0018 #include <TCollection_ExtendedString.hxx>
0019 #include <TDF_DerivedAttribute.hxx>
0020 #include <TDF_LabelSequence.hxx>
0021 #include <XCAFNoteObjects_NoteObject.hxx>
0022 
0023 class TDF_RelocationTable;
0024 
0025 //! A base note attribute.
0026 //! Any note contains the name of the user created the note
0027 //! and the creation timestamp.
0028 class XCAFDoc_Note : public TDF_Attribute
0029 {
0030 public:
0031   DEFINE_STANDARD_RTTIEXT(XCAFDoc_Note, TDF_Attribute)
0032 
0033   //! Checks if the given label represents a note.
0034   Standard_EXPORT static Standard_Boolean IsMine(const TDF_Label& theLabel);
0035 
0036   //! Finds a reference attribute on the given label and returns it, if it is found
0037   Standard_EXPORT static Handle(XCAFDoc_Note) Get(const TDF_Label& theLabel);
0038 
0039   //! Sets the user name and the timestamp of the note.
0040   //! \param[in]  theUserName  - the user associated with the note.
0041   //! \param[in]  theTimeStamp - timestamp of the note.
0042   //! \return A handle to the attribute instance.
0043   Standard_EXPORT void Set(const TCollection_ExtendedString& theUserName,
0044                            const TCollection_ExtendedString& theTimeStamp);
0045 
0046   //! Returns the user name, who created the note.
0047   const TCollection_ExtendedString& UserName() const { return myUserName; }
0048 
0049   //! Returns the timestamp of the note.
0050   const TCollection_ExtendedString& TimeStamp() const { return myTimeStamp; }
0051 
0052   //! Checks if the note isn't linked to annotated items.
0053   Standard_EXPORT Standard_Boolean IsOrphan() const;
0054 
0055   //! Returns auxiliary data object
0056   Standard_EXPORT Handle(XCAFNoteObjects_NoteObject) GetObject() const;
0057 
0058   //! Updates auxiliary data
0059   Standard_EXPORT void SetObject(const Handle(XCAFNoteObjects_NoteObject)& theObject);
0060 
0061 public:
0062   // Overrides TDF_Attribute virtuals
0063   Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theAttrFrom) Standard_OVERRIDE;
0064   Standard_EXPORT void Paste(const Handle(TDF_Attribute)&       theAttrInto,
0065                              const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
0066   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
0067 
0068   //! Dumps the content of me into the stream
0069   Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
0070                                         Standard_Integer  theDepth = -1) const Standard_OVERRIDE;
0071 
0072 protected:
0073   //! Creates an empty note.
0074   Standard_EXPORT XCAFDoc_Note();
0075 
0076 private:
0077   TCollection_ExtendedString myUserName;  ///< Name of the user, who created the note.
0078   TCollection_ExtendedString myTimeStamp; ///< Timestamp, when the note was created.
0079 };
0080 
0081 DEFINE_STANDARD_HANDLE(XCAFDoc_Note, TDF_Attribute)
0082 
0083 #endif // _XCAFDoc_Note_HeaderFile