0029352: Adding support of GBK and Big5 code pages
[occt.git] / src / XmlMDF / XmlMDF_ADriver.cxx
CommitLineData
b311480e 1// Created on: 2001-07-09
2// Created by: Julia DOROVSKIKH
973c2be1 3// Copyright (c) 2001-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
42cf5bc1 16
17#include <CDM_MessageDriver.hxx>
18#include <Standard_Type.hxx>
19#include <TCollection_AsciiString.hxx>
20#include <TCollection_ExtendedString.hxx>
21#include <TDF_Attribute.hxx>
22#include <XmlMDF_ADriver.hxx>
23#include <XmlObjMgt_Persistent.hxx>
7fd59977 24
25e59720 25IMPLEMENT_STANDARD_RTTIEXT(XmlMDF_ADriver,Standard_Transient)
92efcf78 26
7fd59977 27//=======================================================================
28//function : XmlMDF_ADriver
29//purpose : Constructor
30//=======================================================================
7fd59977 31XmlMDF_ADriver::XmlMDF_ADriver (const Handle(CDM_MessageDriver)& theMsgDriver,
32 const Standard_CString theNS,
33 const Standard_CString theName)
34 : myMessageDriver (theMsgDriver)
35{
36 if (theNS != NULL)
37 if (theNS[0] != '\0') {
38 myTypeName = theNS;
39 myTypeName += ':';
40 }
41 if (theName != NULL)
42 myTypeName += theName;
43}
44
45//=======================================================================
46//function : VersionNumber
47//purpose : default version number from which the driver is available
48//=======================================================================
49
50Standard_Integer XmlMDF_ADriver::VersionNumber () const
51{
52 return 0;
53}
54
55//=======================================================================
56//function : SourceType
57//purpose :
58//=======================================================================
59
60Handle(Standard_Type) XmlMDF_ADriver::SourceType () const
61{
62 return NewEmpty() -> DynamicType();
63}
64
65//=======================================================================
66//function : TypeName
67//purpose :
68//=======================================================================
69
70const TCollection_AsciiString& XmlMDF_ADriver::TypeName () const
71{
72 const Standard_CString aString = myTypeName.ToCString();
73 if (myTypeName.Length() == 0 || aString [myTypeName.Length() - 1] == ':')
74 (TCollection_AsciiString&)myTypeName += SourceType() -> Name();
75 return myTypeName;
76}
77
78//=======================================================================
79//function : WriteMessage
80//purpose :
81//=======================================================================
82
83void XmlMDF_ADriver::WriteMessage
84 (const TCollection_ExtendedString& aMessage) const
85{
86 myMessageDriver -> Write (aMessage.ToExtString());
87}