📄 mainwzwarningtest.html
字号:
<TITLE>WZ 1.1: Messages and warnings</TITLE><H1>Warnings</H1>To handle warnings, we use the class <B>wzWarning</B>. It is implementedas a derived class of <B>wzCounter</B>. This class is defined in<PRE>#include "<A HREF="wzwarning.hxx">wzwarning.hxx</A>"</PRE> <P>The following test code creates a warning:<PRE>static wzWarning Example("mainwzwarningtest","Example");static wzWarning Example2("mainwzwarningtest","Example2");void main(){ Example("first call"); // at this moment the warning will be printed; Example("second call"); // but only once; Example(); // you need not define a string</PRE> <P>The text of the warning includes the name of the warning (here"Example"), the info string if available (here "first call") andextracts the related part from the documentation file (In this case <A HREF="mainwzwarningtest.html#Example">mainwzwarningtest.html#Example </A>, that means the following:<A NAME="Example"> <hr></A> <P>This text should be written out. <P><A NAME="End of example"> <hr></A> <P>If not, control the environment variable <B>COG_HOME</B>. It shouldbe the path name of the sources. <P><A NAME="suppress"> <hr></A><H2>Suppressing Warnings</H2> <P>The text of the warning gives you information how the warning maybe suppressed. For this purpose, you have to know which is thewarning you have to suppress, and to call the method<B>.ignore()</B>. For example, we suppress the warning Example2 withthe following code:<PRE> Example2.ignore(); Example2(); // should be ignored now.</PRE> <P>To try out the following may be interesting too (but please don'tsend me a mail after this ;-):<PRE>/* { wzWarning ww1("badfilename","entry"); wzWarning ww2("warnings","badentryname"); ww1(); ww2(); }*/</PRE><A NAME="errors"> <hr></A><H2><A HREF="errors.html">Errors</A></H2> <P>No exceptions will be caused. But, if the documentation is not upto date, the following errors may occur:<A NAME="Documentation_Not_Found"> <hr></A><H2>Documentation not found</H2> <P>The documentation seems to be invalid, for the error/warning whichhas occured we have not yet written a documentation, or written itinto the wrong place. Mail a short info to the author.<A NAME="Documentation_Entry_Not_Found"> <hr></A><H2>Documentation entry not found</H2> <P>The documentation seems to be invalid, for the error/warning whichhas occured we have not yet written a documentation, or written itinto the wrong place. Mail a short info to the author.<A NAME="End"> <hr></A> <P>You can test this code with: <BR> <BR><B>>cog main wzwarning</B> <BR> <BR>The output should be: <BR> <BR>Warning: Example; <BR> <BR> This text should be written out. <BR> <BR>---- for more see /home/ilja/cog/mainwzwarningtest.html ---- <BR>success <BR>Summary: warning "Example" called 1 time(s);<PRE> fine();}</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -