1 // File: BinMDataStd_ExtStringListDriver.cxx
2 // Created: May 29 11:40:00 2007
3 // Author: Vlad Romashko
4 // <vladislav.romashko@opencascade.com>
5 // Copyright: Open CASCADE
7 #include <BinMDataStd_ExtStringListDriver.ixx>
8 #include <TDataStd_ExtStringList.hxx>
9 #include <TColStd_Array1OfExtendedString.hxx>
10 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
12 //=======================================================================
13 //function : BinMDataStd_ExtStringListDriver
14 //purpose : Constructor
15 //=======================================================================
16 BinMDataStd_ExtStringListDriver::BinMDataStd_ExtStringListDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
17 : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_ExtStringList)->Name())
22 //=======================================================================
25 //=======================================================================
26 Handle(TDF_Attribute) BinMDataStd_ExtStringListDriver::NewEmpty() const
28 return new TDataStd_ExtStringList();
31 //=======================================================================
33 //purpose : persistent -> transient (retrieve)
34 //=======================================================================
35 Standard_Boolean BinMDataStd_ExtStringListDriver::Paste(const BinObjMgt_Persistent& theSource,
36 const Handle(TDF_Attribute)& theTarget,
37 BinObjMgt_RRelocationTable& ) const
39 Standard_Integer aFirstInd, aLastInd;
40 if (! (theSource >> aFirstInd >> aLastInd))
41 return Standard_False;
42 const Standard_Integer aLength = aLastInd - aFirstInd + 1;
44 return Standard_False;
46 Handle(TDataStd_ExtStringList) anAtt = Handle(TDataStd_ExtStringList)::DownCast(theTarget);
47 for (Standard_Integer i = aFirstInd; i <= aLastInd; i ++)
49 TCollection_ExtendedString aStr;
50 if ( !(theSource >> aStr) )
52 return Standard_False;
60 //=======================================================================
62 //purpose : transient -> persistent (store)
63 //=======================================================================
64 void BinMDataStd_ExtStringListDriver::Paste(const Handle(TDF_Attribute)& theSource,
65 BinObjMgt_Persistent& theTarget,
66 BinObjMgt_SRelocationTable& ) const
68 Handle(TDataStd_ExtStringList) anAtt = Handle(TDataStd_ExtStringList)::DownCast(theSource);
69 const Standard_Integer aFirstInd = 1;
70 const Standard_Integer aLastInd = anAtt->Extent();
71 theTarget << aFirstInd << aLastInd;
72 TDataStd_ListIteratorOfListOfExtendedString itr(anAtt->List());
73 for (; itr.More(); itr.Next())
75 theTarget << itr.Value();