1 // Created on: 1997-07-31
2 // Created by: Denis PASCAL
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <TDataStd_Name.hxx>
18 #include <TDF_Label.hxx>
20 IMPLEMENT_DERIVED_ATTRIBUTE(TDataStd_Name,TDataStd_GenericExtString)
22 //=======================================================================
25 //=======================================================================
26 const Standard_GUID& TDataStd_Name::GetID ()
28 static Standard_GUID TDataStd_NameID("2a96b608-ec8b-11d0-bee7-080009dc3333");
29 return TDataStd_NameID;
32 //=======================================================================
34 //purpose : Implements Set functionality
35 //=======================================================================
36 static Handle(TDataStd_Name) SetAttr(const TDF_Label& label,
37 const TCollection_ExtendedString& theString,
38 const Standard_GUID& theGuid)
40 Handle(TDataStd_Name) N;
41 if (!label.FindAttribute(theGuid, N)) {
42 N = new TDataStd_Name ();
44 label.AddAttribute(N);
50 //=======================================================================
53 //=======================================================================
54 Handle(TDataStd_Name) TDataStd_Name::Set
55 (const TDF_Label& label,
56 const TCollection_ExtendedString& theString)
58 return SetAttr(label, theString, GetID());
61 //=======================================================================
63 //purpose : Set user defined attribute
64 //=======================================================================
66 Handle(TDataStd_Name) TDataStd_Name::Set (const TDF_Label& label,
67 const Standard_GUID& theGuid,
68 const TCollection_ExtendedString& theString)
70 return SetAttr(label, theString, theGuid);
73 //=======================================================================
74 //function : TDataStd_Name
76 //=======================================================================
77 TDataStd_Name::TDataStd_Name()
82 //=======================================================================
85 //=======================================================================
86 void TDataStd_Name::Set (const TCollection_ExtendedString& S)
88 if(myString == S) return;
94 //=======================================================================
97 //=======================================================================
98 void TDataStd_Name::SetID( const Standard_GUID& theGuid)
100 if(myID == theGuid) return;
106 //=======================================================================
108 //purpose : sets default ID
109 //=======================================================================
111 void TDataStd_Name::SetID()
117 // TDF_Attribute methods
118 //=======================================================================
121 //=======================================================================
123 Standard_OStream& TDataStd_Name::Dump (Standard_OStream& anOS) const
125 TDF_Attribute::Dump(anOS);
126 anOS << " Name=|"<<myString<<"|";
127 Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
128 myID.ToCString(sguid);
129 anOS << sguid << std::endl;