1 // File: ModelAPI_AttributeDocRef.cxx
3 // Author: Mikhail PONIKAROV
5 #include "Model_AttributeDocRef.h"
6 #include "Model_Application.h"
10 void Model_AttributeDocRef::setValue(std::shared_ptr<ModelAPI_Document> theDoc)
12 myComment->Set(TCollection_ExtendedString(theDoc->id().c_str()));
15 std::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
17 if (myComment->Get().Length())
18 return Model_Application::getApplication()->getDocument(
19 TCollection_AsciiString(myComment->Get()).ToCString());
21 return std::shared_ptr<ModelAPI_Document>();
24 Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel)
26 // check the attribute could be already presented in this doc (after load document)
27 if (!theLabel.FindAttribute(TDataStd_Comment::GetID(), myComment)) {
28 // create attribute: not initialized by value yet, just empty string
29 myComment = TDataStd_Comment::Set(theLabel, "");