1 // Copyright (c) 2020 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 _TDataStd_GenericExtString_HeaderFile 15 #define _TDataStd_GenericExtString_HeaderFile 16 17 #include <TDF_DerivedAttribute.hxx> 18 #include <TCollection_ExtendedString.hxx> 19 #include <Standard_GUID.hxx> 20 21 class Standard_GUID; 22 class TDF_Label; 23 class TDF_RelocationTable; 24 25 class TDataStd_GenericExtString; 26 DEFINE_STANDARD_HANDLE(TDataStd_GenericExtString, TDF_Attribute) 27 28 //! An ancestor attribute for all attributes which have TCollection_ExtendedString field. 29 //! If an attribute inherits this one it should not have drivers for persistence. 30 //! Also this attribute provides functionality to have on the same label same attributes with different IDs. 31 class TDataStd_GenericExtString : public TDF_Attribute 32 { 33 34 public: 35 36 //! Sets <S> as name. Raises if <S> is not a valid name. 37 Standard_EXPORT virtual void Set (const TCollection_ExtendedString& S); 38 39 //! Sets the explicit user defined GUID to the attribute. 40 Standard_EXPORT void SetID (const Standard_GUID& guid) Standard_OVERRIDE; 41 42 //! Returns the name contained in this name attribute. 43 Standard_EXPORT virtual const TCollection_ExtendedString& Get() const; 44 45 //! Returns the ID of the attribute. 46 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; 47 48 Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE; 49 50 Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE; 51 52 //! Dumps the content of me into the stream 53 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; 54 55 DEFINE_STANDARD_RTTIEXT(TDataStd_GenericExtString,TDF_Attribute) 56 57 protected: 58 //! A string field of the attribute, participated in persistence. 59 TCollection_ExtendedString myString; 60 //! A private GUID of the attribute. 61 Standard_GUID myID; 62 63 }; 64 65 #endif // _TDataStd_GenericExtString_HeaderFile 66