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