1 // Created on: 1994-04-21
2 // Created by: Christian CAILLET
3 // Copyright (c) 1994-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 _IFSelect_Signature_HeaderFile
18 #define _IFSelect_Signature_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22 
23 #include <Standard_Integer.hxx>
24 #include <TColStd_HSequenceOfAsciiString.hxx>
25 #include <TCollection_AsciiString.hxx>
26 #include <Interface_SignType.hxx>
27 #include <Standard_CString.hxx>
28 #include <Standard_Boolean.hxx>
29 class Standard_Transient;
30 class Interface_InterfaceModel;
31 
32 
33 class IFSelect_Signature;
34 DEFINE_STANDARD_HANDLE(IFSelect_Signature, Interface_SignType)
35 
36 //! Signature provides the basic service used by the classes
37 //! SelectSignature and Counter (i.e. Name, Value), which is :
38 //! - for an entity in a model, give a characteristic string, its
39 //! signature
40 //! This string has not to be unique in the model, but gives a
41 //! value for such or such important feature.
42 //! Examples : Dynamic Type; Category; etc
43 class IFSelect_Signature : public Interface_SignType
44 {
45 
46 public:
47 
48 
49   //! Sets the information data to tell "integer cases" with
50   //! possible min and max values
51   //! To be called when creating
52   Standard_EXPORT void SetIntCase (const Standard_Boolean hasmin, const Standard_Integer valmin, const Standard_Boolean hasmax, const Standard_Integer valmax);
53 
54   //! Tells if this Signature gives integer values
55   //! and returns values from SetIntCase if True
56   Standard_EXPORT Standard_Boolean IsIntCase (Standard_Boolean& hasmin, Standard_Integer& valmin, Standard_Boolean& hasmax, Standard_Integer& valmax) const;
57 
58   //! Adds a possible case
59   //! To be called when creating, IF the list of possible cases for
60   //! Value is known when starting
61   //! For instance, for CDL types, rather do not fill this,
62   //! but for a specific enumeration (such as a status), can be used
63   Standard_EXPORT void AddCase (const Standard_CString acase);
64 
65   //! Returns the predefined list of possible cases, filled by AddCase
66   //! Null Handle if no predefined list (hence, to be counted)
67   //! Useful to filter on  really possible vase, for instance, or
68   //! for a help
69   Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) CaseList() const;
70 
71   //! Returns an identification of the Signature (a word), given at
72   //! initialization time
73   //! Returns the Signature for a Transient object. It is specific
74   //! of each sub-class of Signature. For a Null Handle, it should
75   //! provide ""
76   //! It can work with the model which contains the entity
77   Standard_EXPORT Standard_CString Name() const Standard_OVERRIDE;
78 
79   //! The label of a Signature uses its name as follow :
80   //! "Signature : <name>"
81   Standard_EXPORT TCollection_AsciiString Label() const;
82 
83   //! Tells if the value for <ent> in <model> matches a text, with
84   //! a criterium <exact>.
85   //! The default definition calls MatchValue
86   //! Can be redefined
87   Standard_EXPORT virtual Standard_Boolean Matches (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model, const TCollection_AsciiString& text, const Standard_Boolean exact) const;
88 
89   //! Default procedure to tell if a value <val> matches a text
90   //! with a criterium <exact>. <exact> = True requires equality,
91   //! else only contained (no reg-exp)
92   Standard_EXPORT static Standard_Boolean MatchValue (const Standard_CString val, const TCollection_AsciiString& text, const Standard_Boolean exact);
93 
94   //! This procedure converts an Integer to a CString
95   //! It is a convenient way when the value of a signature has the
96   //! form of a simple integer value
97   //! The value is to be used immediately (one buffer only, no copy)
98   Standard_EXPORT static Standard_CString IntValue (const Standard_Integer val);
99 
100 
101 
102 
103   DEFINE_STANDARD_RTTIEXT(IFSelect_Signature,Interface_SignType)
104 
105 protected:
106 
107 
108   //! Initializes a Signature with its name
109   Standard_EXPORT IFSelect_Signature(const Standard_CString name);
110 
111   TCollection_AsciiString thename;
112 
113 
114 private:
115 
116 
117   Standard_Integer thecasi[3];
118   Handle(TColStd_HSequenceOfAsciiString) thecasl;
119 
120 
121 };
122 
123 
124 
125 
126 
127 
128 
129 #endif // _IFSelect_Signature_HeaderFile
130