Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/XCAFDoc_NoteBinData.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_NoteBinData_HeaderFile
0015 #define _XCAFDoc_NoteBinData_HeaderFile
0016 
0017 #include <XCAFDoc_Note.hxx>
0018 #include <TColStd_HArray1OfByte.hxx>
0019 #include <TCollection_AsciiString.hxx>
0020 #include <TCollection_ExtendedString.hxx>
0021 
0022 class OSD_File;
0023 
0024 class XCAFDoc_NoteBinData : public XCAFDoc_Note
0025 {
0026 public:
0027 
0028   DEFINE_STANDARD_RTTIEXT(XCAFDoc_NoteBinData, XCAFDoc_Note)
0029 
0030   //! Returns default attribute GUID
0031   Standard_EXPORT static const Standard_GUID& GetID();
0032 
0033   //! Finds a binary data attribute on the given label and returns it, if it is found
0034   Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Get(const TDF_Label& theLabel);
0035 
0036   //! @name Set attribute functions.
0037   //! @{
0038 
0039   //! Create (if not exist) a binary note with data loaded from a binary file.
0040   //! \param [in] theLabel     - label to add the attribute.
0041   //! \param [in] theUserName  - the name of the user, who created the note.
0042   //! \param [in] theTimeStamp - creation timestamp of the note.
0043   //! \param [in] theTitle     - file title.
0044   //! \param [in] theMIMEtype  - MIME type of the file.
0045   //! \param [in] theFile      - input binary file.
0046   //! \return A handle to the attribute instance.
0047   Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Set(const TDF_Label&                  theLabel,
0048                                                          const TCollection_ExtendedString& theUserName,
0049                                                          const TCollection_ExtendedString& theTimeStamp,
0050                                                          const TCollection_ExtendedString& theTitle,
0051                                                          const TCollection_AsciiString&    theMIMEtype,
0052                                                          OSD_File&                         theFile);
0053 
0054   //! Create (if not exist) a binary note byte data array.
0055   //! \param [in] theLabel     - label to add the attribute.
0056   //! \param [in] theUserName  - the name of the user, who created the note.
0057   //! \param [in] theTimeStamp - creation timestamp of the note.
0058   //! \param [in] theTitle     - data title.
0059   //! \param [in] theMIMEtype  - MIME type of data.
0060   //! \param [in] theData      - byte data array.
0061   //! \return A handle to the attribute instance.
0062   Standard_EXPORT static Handle(XCAFDoc_NoteBinData) Set(const TDF_Label&                     theLabel,
0063                                                          const TCollection_ExtendedString&    theUserName,
0064                                                          const TCollection_ExtendedString&    theTimeStamp,
0065                                                          const TCollection_ExtendedString&    theTitle,
0066                                                          const TCollection_AsciiString&       theMIMEtype,
0067                                                          const Handle(TColStd_HArray1OfByte)& theData);
0068 
0069   //! @}
0070 
0071   //! Creates an empty binary data note.
0072   Standard_EXPORT XCAFDoc_NoteBinData();
0073 
0074   //! @name Set attribute data functions.
0075   //! @{
0076 
0077   //! Sets title, MIME type and data from a binary file.
0078   //! \param [in] theTitle     - file title.
0079   //! \param [in] theMIMEtype  - MIME type of the file.
0080   //! \param [in] theFile      - input binary file.
0081   Standard_EXPORT Standard_Boolean Set(const TCollection_ExtendedString& theTitle,
0082                                        const TCollection_AsciiString&    theMIMEtype,
0083                                        OSD_File&                         theFile);
0084 
0085   //! Sets title, MIME type and data from a byte array.
0086   //! \param [in] theTitle     - data title.
0087   //! \param [in] theMIMEtype  - MIME type of data.
0088   //! \param [in] theData      - byte data array.
0089   Standard_EXPORT void Set(const TCollection_ExtendedString&    theTitle,
0090                            const TCollection_AsciiString&       theMIMEtype,
0091                            const Handle(TColStd_HArray1OfByte)& theData);
0092 
0093   //! @}
0094 
0095   //! Returns the note title.
0096   const TCollection_ExtendedString& Title() const { return myTitle; }
0097 
0098   //! Returns data MIME type.
0099   const TCollection_AsciiString& MIMEtype() const { return myMIMEtype;  }
0100 
0101   //! Size of data in bytes.
0102   Standard_Integer Size() const { return (!myData.IsNull() ? myData->Length() : 0); }
0103 
0104   //! Returns byte data array.
0105   const Handle(TColStd_HArray1OfByte)& Data() const { return myData; }
0106 
0107 public:
0108 
0109   // Overrides TDF_Attribute virtuals
0110   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
0111   Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
0112   Standard_EXPORT void Restore(const Handle(TDF_Attribute)& theAttrFrom) Standard_OVERRIDE;
0113   Standard_EXPORT void Paste(const Handle(TDF_Attribute)&       theAttrInto,
0114                              const Handle(TDF_RelocationTable)& theRT) const Standard_OVERRIDE;
0115   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS) const Standard_OVERRIDE;
0116 
0117 protected:
0118 
0119   TCollection_ExtendedString    myTitle;    ///< Note title.
0120   TCollection_AsciiString       myMIMEtype; ///< MIME type of data.
0121   Handle(TColStd_HArray1OfByte) myData;     ///< Byte data array.
0122 
0123 };
0124 
0125 DEFINE_STANDARD_HANDLE(XCAFDoc_NoteBinData, XCAFDoc_Note)
0126 
0127 #endif // _XCAFDoc_NoteBinData_HeaderFile