1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
16 #include <Standard_NoSuchObject.hxx>
17 #include <Standard_Type.hxx>
18 #include <Storage_Schema.hxx>
19 #include <Storage_TypeData.hxx>
20 #include <TCollection_AsciiString.hxx>
22 IMPLEMENT_STANDARD_RTTIEXT(Storage_TypeData,MMgt_TShared)
24 Storage_TypeData::Storage_TypeData() : myErrorStatus(Storage_VSOk)
28 Standard_Integer Storage_TypeData::NumberOfTypes() const
33 Standard_Boolean Storage_TypeData::IsType(const TCollection_AsciiString& aName) const
35 return myPt.Contains(aName);
38 Handle(TColStd_HSequenceOfAsciiString) Storage_TypeData::Types() const
40 Handle(TColStd_HSequenceOfAsciiString) r = new TColStd_HSequenceOfAsciiString;
43 for (i = 1; i <= myPt.Extent(); i++) {
44 r->Append(myPt.FindKey(i));
50 void Storage_TypeData::AddType(const TCollection_AsciiString& aName,const Standard_Integer aTypeNum)
52 myPt.Add(aName,aTypeNum);
55 TCollection_AsciiString Storage_TypeData::Type(const Standard_Integer aTypeNum) const
57 TCollection_AsciiString r;
59 if (aTypeNum <= myPt.Extent() && aTypeNum > 0) {
60 r = myPt.FindKey(aTypeNum);
63 Standard_NoSuchObject::Raise("Storage_TypeData::Type - aTypeNum not in range");
69 Standard_Integer Storage_TypeData::Type(const TCollection_AsciiString& aTypeName) const
71 Standard_Integer r = 0;
73 if (myPt.Contains(aTypeName)) {
74 r = myPt.FindFromKey(aTypeName);
77 Standard_NoSuchObject::Raise("Storage_TypeData::Type - aTypeName not found");
83 void Storage_TypeData::Clear()
88 Storage_Error Storage_TypeData::ErrorStatus() const
93 void Storage_TypeData::SetErrorStatus(const Storage_Error anError)
95 myErrorStatus = anError;
98 void Storage_TypeData::ClearErrorStatus()
100 myErrorStatus = Storage_VSOk;
101 myErrorStatusExt.Clear();
104 TCollection_AsciiString Storage_TypeData::ErrorStatusExtension() const
106 return myErrorStatusExt;
109 void Storage_TypeData::SetErrorStatusExtension(const TCollection_AsciiString& anErrorExt)
111 myErrorStatusExt = anErrorExt;