42cf5bc1 |
1 | // Created on: 1993-07-23 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _StepData_HeaderTool_HeaderFile |
18 | #define _StepData_HeaderTool_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TColStd_SequenceOfAsciiString.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <Standard_OStream.hxx> |
28 | class StepData_StepReaderData; |
29 | class TCollection_AsciiString; |
30 | class StepData_Protocol; |
31 | class StepData_FileProtocol; |
32 | |
33 | |
34 | //! HeaderTool exploits data from Header to build a Protocol : |
35 | //! it uses the Header Entity FileSchema to do this. |
36 | //! It builds a Protocol from the Global List of Protocols |
37 | //! stored in the Library ReaderLib |
38 | class StepData_HeaderTool |
39 | { |
40 | public: |
41 | |
42 | DEFINE_STANDARD_ALLOC |
43 | |
44 | |
45 | //! Creates a HeaderTool from data read from a File. Computes the |
46 | //! list of Schema Names. The Protocol will be computed later |
47 | //! (because there are several options) |
48 | Standard_EXPORT StepData_HeaderTool(const Handle(StepData_StepReaderData)& data); |
49 | |
50 | //! Creates a HeaderTool directly from a list of Schema Names |
51 | Standard_EXPORT StepData_HeaderTool(const TColStd_SequenceOfAsciiString& names); |
52 | |
53 | //! Returns the count of SchemaNames |
54 | Standard_EXPORT Standard_Integer NbSchemaNames() const; |
55 | |
56 | //! Returns a SchemaName, given its rank |
57 | Standard_EXPORT const TCollection_AsciiString& SchemaName (const Standard_Integer num) const; |
58 | |
59 | //! Returns the Protocol which corresponds to a Schema Name |
60 | //! Returns a Null Handle if this Schema Name is attached to no |
61 | //! Protocol recorded in the Global List of ReaderLib |
62 | Standard_EXPORT Handle(StepData_Protocol) NamedProtocol (const TCollection_AsciiString& name) const; |
63 | |
64 | //! Fills a FileProtocol with the list of Protocols attached to |
65 | //! the list of Schema Names. It can remain empty ... |
66 | Standard_EXPORT void Build (const Handle(StepData_FileProtocol)& protocol); |
67 | |
68 | //! Returns a Protocol computed from the list of Schema Names : |
69 | //! - a Null Handle if no SchemaName has been recognized (or list |
70 | //! empty) |
71 | //! - a single Protocol if only one SchemaName has been recognized |
72 | //! - a FileProtocol with its componants if several SchemaNames |
73 | //! have been recognized |
74 | Standard_EXPORT Handle(StepData_Protocol) Protocol(); |
75 | |
76 | //! Returns True if either Build or Protocol has been called |
77 | //! If it is False, Ignored and NbIgnored should not be called |
78 | Standard_EXPORT Standard_Boolean IsDone() const; |
79 | |
80 | //! Returns the count of ignored SchemaNames (0 if all were OK) |
81 | Standard_EXPORT Standard_Integer NbIgnoreds() const; |
82 | |
83 | //! Returns an ignored SchemaName, given its rank in the list of |
84 | //! Ignored SchemaNames (not in the total list) |
85 | Standard_EXPORT const TCollection_AsciiString& Ignored (const Standard_Integer num) const; |
86 | |
87 | //! Sends the state of the HeaderTool in a comprehensive way, |
88 | //! to an output stream |
89 | Standard_EXPORT void Print (Standard_OStream& S) const; |
90 | |
91 | |
92 | |
93 | |
94 | protected: |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | private: |
101 | |
102 | |
103 | |
104 | TColStd_SequenceOfAsciiString thenames; |
105 | Standard_Boolean thedone; |
106 | TColStd_SequenceOfAsciiString theignored; |
107 | |
108 | |
109 | }; |
110 | |
111 | |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | #endif // _StepData_HeaderTool_HeaderFile |