0031004: Coding - eliminate warnings issued by gcc 9.1.0
[occt.git] / src / StepData / StepData_FileRecognizer.hxx
1 // Created on: 1992-02-11
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-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_FileRecognizer_HeaderFile
18 #define _StepData_FileRecognizer_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Boolean.hxx>
24 #include <Standard_Transient.hxx>
25 class Standard_Transient;
26 class Standard_NoSuchObject;
27 class TCollection_AsciiString;
28
29
30 class StepData_FileRecognizer;
31 DEFINE_STANDARD_HANDLE(StepData_FileRecognizer, Standard_Transient)
32
33
34 class StepData_FileRecognizer : public Standard_Transient
35 {
36
37 public:
38
39   
40   //! Evaluates if recognition has a result, returns it if yes
41   //! In case of success, Returns True and puts result in "res"
42   //! In case of Failure, simply Returns False
43   //! Works by calling deferred method Eval, and in case of failure,
44   //! looks for Added Recognizers to work
45   Standard_EXPORT Standard_Boolean Evaluate (const TCollection_AsciiString& akey, Handle(Standard_Transient)& res);
46   
47   //! Returns result of last recognition (call of Evaluate)
48   Standard_EXPORT Handle(Standard_Transient) Result() const;
49   
50   //! Adds a new Recognizer to the Compound, at the end
51   //! Several calls to Add work by adding in the order of calls :
52   //! Hence, when Eval has failed to recognize, Evaluate will call
53   //! Evaluate from the first added Recognizer if there is one,
54   //! and to the second if there is still no result, and so on
55   Standard_EXPORT void Add (const Handle(StepData_FileRecognizer)& reco);
56
57
58
59
60   DEFINE_STANDARD_RTTI_INLINE(StepData_FileRecognizer,Standard_Transient)
61
62 protected:
63
64   
65   //! Assumes that no result has yet been recognized
66   Standard_EXPORT StepData_FileRecognizer();
67   
68   //! Records the result of the recognition. Called by specific
69   //! method Eval to record a result : after calling it, Eval has
70   //! finished and can return
71   Standard_EXPORT void SetOK (const Handle(Standard_Transient)& aresult);
72   
73   //! Records that recognition gives no result
74   Standard_EXPORT void SetKO();
75   
76   //! THIS METHOD DEFINES THE RECOGNITION PROTOCOL, it is proper to
77   //! each precise type of Recognizer
78   //! For a suitable type of akey, it calls SetOK(result) where
79   //! result is an empty result of appropriate type, then returns
80   Standard_EXPORT virtual void Eval (const TCollection_AsciiString& akey) = 0;
81
82
83
84 private:
85
86
87   Handle(Standard_Transient) theres;
88   Standard_Boolean hasnext;
89   Handle(StepData_FileRecognizer) thenext;
90
91
92 };
93
94
95
96
97
98
99
100 #endif // _StepData_FileRecognizer_HeaderFile