|
|
|||
File indexing completed on 2026-05-13 08:44:01
0001 // Created on: 1992-02-03 0002 // Created by: Christian CAILLET 0003 // Copyright (c) 1992-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _Interface_Check_HeaderFile 0018 #define _Interface_Check_HeaderFile 0019 0020 #include <Standard.hxx> 0021 0022 #include <TColStd_HSequenceOfHAsciiString.hxx> 0023 #include <Standard_Transient.hxx> 0024 #include <Standard_Integer.hxx> 0025 #include <Interface_CheckStatus.hxx> 0026 class Message_Msg; 0027 class TCollection_HAsciiString; 0028 0029 // resolve name collisions with X11 headers 0030 #ifdef Status 0031 #undef Status 0032 #endif 0033 0034 class Interface_Check; 0035 DEFINE_STANDARD_HANDLE(Interface_Check, Standard_Transient) 0036 0037 //! Defines a Check, as a list of Fail or Warning Messages under 0038 //! a literal form, which can be empty. A Check can also bring an 0039 //! Entity, which is the Entity to which the messages apply 0040 //! (this Entity may be any Transient Object). 0041 //! 0042 //! Messages can be stored in two forms : the definitive form 0043 //! (the only one by default), and another form, the original 0044 //! form, which can be different if it contains values to be 0045 //! inserted (integers, reals, strings) 0046 //! The original form can be more suitable for some operations 0047 //! such as counting messages 0048 class Interface_Check : public Standard_Transient 0049 { 0050 0051 public: 0052 //! Allows definition of a Sequence. Used also for Global Check 0053 //! of an InterfaceModel (which stores global messages for file) 0054 Standard_EXPORT Interface_Check(); 0055 0056 //! Defines a Check on an Entity 0057 Standard_EXPORT Interface_Check(const Handle(Standard_Transient)& anentity); 0058 0059 //! New name for AddFail (Msg) 0060 Standard_EXPORT void SendFail(const Message_Msg& amsg); 0061 0062 //! Records a new Fail message 0063 Standard_EXPORT void AddFail(const Handle(TCollection_HAsciiString)& amess); 0064 0065 //! Records a new Fail message under two forms : final,original 0066 Standard_EXPORT void AddFail(const Handle(TCollection_HAsciiString)& amess, 0067 const Handle(TCollection_HAsciiString)& orig); 0068 0069 //! Records a new Fail message given as "error text" directly 0070 //! If <orig> is given, a distinct original form is recorded 0071 //! else (D), the original form equates <amess> 0072 Standard_EXPORT void AddFail(const Standard_CString amess, const Standard_CString orig = ""); 0073 0074 //! Records a new Fail from the definition of a Msg (Original+Value) 0075 Standard_EXPORT void AddFail(const Message_Msg& amsg); 0076 0077 //! Returns True if Check brings at least one Fail Message 0078 Standard_EXPORT Standard_Boolean HasFailed() const; 0079 0080 //! Returns count of recorded Fails 0081 Standard_EXPORT Standard_Integer NbFails() const; 0082 0083 //! Returns Fail Message as a String 0084 //! Final form by default, Original form if <final> is False 0085 Standard_EXPORT const Handle(TCollection_HAsciiString)& Fail( 0086 const Standard_Integer num, 0087 const Standard_Boolean final = Standard_True) const; 0088 0089 //! Same as above, but returns a CString (to be printed ...) 0090 //! Final form by default, Original form if <final> is False 0091 Standard_EXPORT Standard_CString CFail(const Standard_Integer num, 0092 const Standard_Boolean final = Standard_True) const; 0093 0094 //! Returns the list of Fails, for a frontal-engine logic 0095 //! Final forms by default, Original forms if <final> is False 0096 //! Can be empty 0097 Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) Fails( 0098 const Standard_Boolean final = Standard_True) const; 0099 0100 //! New name for AddWarning 0101 Standard_EXPORT void SendWarning(const Message_Msg& amsg); 0102 0103 //! Records a new Warning message 0104 Standard_EXPORT void AddWarning(const Handle(TCollection_HAsciiString)& amess); 0105 0106 //! Records a new Warning message under two forms : final,original 0107 Standard_EXPORT void AddWarning(const Handle(TCollection_HAsciiString)& amess, 0108 const Handle(TCollection_HAsciiString)& orig); 0109 0110 //! Records a Warning message given as "warning message" directly 0111 //! If <orig> is given, a distinct original form is recorded 0112 //! else (D), the original form equates <amess> 0113 Standard_EXPORT void AddWarning(const Standard_CString amess, const Standard_CString orig = ""); 0114 0115 //! Records a new Warning from the definition of a Msg (Original+Value) 0116 Standard_EXPORT void AddWarning(const Message_Msg& amsg); 0117 0118 //! Returns True if Check brings at least one Warning Message 0119 Standard_EXPORT Standard_Boolean HasWarnings() const; 0120 0121 //! Returns count of recorded Warning messages 0122 Standard_EXPORT Standard_Integer NbWarnings() const; 0123 0124 //! Returns Warning message as a String 0125 //! Final form by default, Original form if <final> is False 0126 Standard_EXPORT const Handle(TCollection_HAsciiString)& Warning( 0127 const Standard_Integer num, 0128 const Standard_Boolean final = Standard_True) const; 0129 0130 //! Same as above, but returns a CString (to be printed ...) 0131 //! Final form by default, Original form if <final> is False 0132 Standard_EXPORT Standard_CString CWarning(const Standard_Integer num, 0133 const Standard_Boolean final = Standard_True) const; 0134 0135 //! Returns the list of Warnings, for a frontal-engine logic 0136 //! Final forms by default, Original forms if <final> is False 0137 //! Can be empty 0138 Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) Warnings( 0139 const Standard_Boolean final = Standard_True) const; 0140 0141 //! Records an information message 0142 //! This does not change the status of the Check 0143 Standard_EXPORT void SendMsg(const Message_Msg& amsg); 0144 0145 //! Returns the count of recorded information messages 0146 Standard_EXPORT Standard_Integer NbInfoMsgs() const; 0147 0148 //! Returns information message as a String 0149 Standard_EXPORT const Handle(TCollection_HAsciiString)& InfoMsg( 0150 const Standard_Integer num, 0151 const Standard_Boolean final = Standard_True) const; 0152 0153 //! Same as above, but returns a CString (to be printed ...) 0154 //! Final form by default, Original form if <final> is False 0155 Standard_EXPORT Standard_CString CInfoMsg(const Standard_Integer num, 0156 const Standard_Boolean final = Standard_True) const; 0157 0158 //! Returns the list of Info Msg, for a frontal-engine logic 0159 //! Final forms by default, Original forms if <final> is False 0160 //! Can be empty 0161 Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) InfoMsgs( 0162 const Standard_Boolean final = Standard_True) const; 0163 0164 //! Returns the Check Status : OK, Warning or Fail 0165 Standard_EXPORT Interface_CheckStatus Status() const; 0166 0167 //! Tells if Check Status complies with a given one 0168 //! (i.e. also status for query) 0169 Standard_EXPORT Standard_Boolean Complies(const Interface_CheckStatus status) const; 0170 0171 //! Tells if a message is brought by a Check, as follows : 0172 //! <incl> = 0 : <mess> exactly matches one of the messages 0173 //! <incl> < 0 : <mess> is contained by one of the messages 0174 //! <incl> > 0 : <mess> contains one of the messages 0175 //! For <status> : for CheckWarning and CheckFail, considers only 0176 //! resp. Warning or Check messages. for CheckAny, considers all 0177 //! other values are ignored (answer will be false) 0178 Standard_EXPORT Standard_Boolean Complies(const Handle(TCollection_HAsciiString)& mess, 0179 const Standard_Integer incl, 0180 const Interface_CheckStatus status) const; 0181 0182 //! Returns True if a Check is devoted to an entity; else, it is 0183 //! global (for InterfaceModel's storing of global error messages) 0184 Standard_EXPORT Standard_Boolean HasEntity() const; 0185 0186 //! Returns the entity on which the Check has been defined 0187 Standard_EXPORT const Handle(Standard_Transient)& Entity() const; 0188 0189 //! Clears a check, in order to receive information from transfer 0190 //! (Messages and Entity) 0191 Standard_EXPORT void Clear(); 0192 0193 //! Clears the Fail Messages (for instance to keep only Warnings) 0194 Standard_EXPORT void ClearFails(); 0195 0196 //! Clears the Warning Messages (for instance to keep only Fails) 0197 Standard_EXPORT void ClearWarnings(); 0198 0199 //! Clears the Info Messages 0200 Standard_EXPORT void ClearInfoMsgs(); 0201 0202 //! Removes the messages which comply with <mess>, as follows : 0203 //! <incl> = 0 : <mess> exactly matches one of the messages 0204 //! <incl> < 0 : <mess> is contained by one of the messages 0205 //! <incl> > 0 : <mess> contains one of the messages 0206 //! For <status> : for CheckWarning and CheckFail, considers only 0207 //! resp. Warning or Check messages. for CheckAny, considers all 0208 //! other values are ignored (nothing is done) 0209 //! Returns True if at least one message has been removed, False else 0210 Standard_EXPORT Standard_Boolean Remove(const Handle(TCollection_HAsciiString)& mess, 0211 const Standard_Integer incl, 0212 const Interface_CheckStatus status); 0213 0214 //! Mends messages, according <pref> and <num> 0215 //! According to <num>, works on the whole list of Fails if = 0(D) 0216 //! or only one Fail message, given its rank 0217 //! If <pref> is empty, converts Fail(s) to Warning(s) 0218 //! Else, does the conversion but prefixes the new Warning(s) but 0219 //! <pref> followed by a semi-column 0220 //! Some reserved values of <pref> are : 0221 //! "FM" : standard prefix "Mended" (can be translated) 0222 //! "CF" : clears Fail(s) 0223 //! "CW" : clears Warning(s) : here, <num> refers to Warning list 0224 //! "CA" : clears all messages : here, <num> is ignored 0225 Standard_EXPORT Standard_Boolean Mend(const Standard_CString pref, 0226 const Standard_Integer num = 0); 0227 0228 //! Receives an entity result of a Transfer 0229 Standard_EXPORT void SetEntity(const Handle(Standard_Transient)& anentity); 0230 0231 //! same as SetEntity (old form kept for compatibility) 0232 //! Warning : Does nothing if Entity field is not yet clear 0233 Standard_EXPORT void GetEntity(const Handle(Standard_Transient)& anentity); 0234 0235 //! Copies messages stored in another Check, cumulating 0236 //! Does not regard other's Entity. Used to cumulate messages 0237 Standard_EXPORT void GetMessages(const Handle(Interface_Check)& other); 0238 0239 //! Copies messages converted into Warning messages 0240 //! If failsonly is true, only Fails are taken, and converted 0241 //! else, Warnings are taken too. Does not regard Entity 0242 //! Used to keep Fail messages as Warning, after a recovery 0243 Standard_EXPORT void GetAsWarning(const Handle(Interface_Check)& other, 0244 const Standard_Boolean failsonly); 0245 0246 //! Prints the messages of the check to an Messenger 0247 //! <level> = 1 : only fails 0248 //! <level> = 2 : fails and warnings 0249 //! <level> = 3 : all (fails, warnings, info msg) 0250 //! <final> : if positive (D) prints final values of messages 0251 //! if negative, prints originals 0252 //! if null, prints both forms 0253 Standard_EXPORT void Print(Standard_OStream& S, 0254 const Standard_Integer level, 0255 const Standard_Integer final = 1) const; 0256 0257 //! Prints the messages of the check to the default trace file 0258 //! By default, according to the default standard level 0259 //! Else, according level (see method Print) 0260 Standard_EXPORT void Trace(const Standard_Integer level = -1, 0261 const Standard_Integer final = 1) const; 0262 0263 DEFINE_STANDARD_RTTIEXT(Interface_Check, Standard_Transient) 0264 0265 protected: 0266 private: 0267 Handle(TColStd_HSequenceOfHAsciiString) thefails; 0268 Handle(TColStd_HSequenceOfHAsciiString) thefailo; 0269 Handle(TColStd_HSequenceOfHAsciiString) thewarns; 0270 Handle(TColStd_HSequenceOfHAsciiString) thewarno; 0271 Handle(TColStd_HSequenceOfHAsciiString) theinfos; 0272 Handle(TColStd_HSequenceOfHAsciiString) theinfoo; 0273 Handle(Standard_Transient) theent; 0274 }; 0275 0276 #endif // _Interface_Check_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|