Version: 2.9.4
Public Member Functions
wxLogNull Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/log.h>


Detailed Description

このクラスを用いて一時的にロギングを中断することができます。

All calls to the log functions during the life time of an object of this class are just ignored.

In particular, it can be used to suppress the log messages given by wxWidgets itself but it should be noted that it is rarely the best way to cope with this problem as all log messages are suppressed, even if they indicate a completely different error than the one the programmer wanted to suppress.

For instance, the example of the overview:

      wxFile file;

      // 通常はファイルを開けなかった場合に wxFile.Open() がエラーメッセージを出力するが、そうさせたくない
      {
        wxLogNull logNo;
        if ( !file.Open("bar") )
          ... 自分自身でエラー処理を行なう ...
      } // ~wxLogNull called, old log sink restored

      wxLogMessage("..."); // ok

would be better written as:

      wxFile file;

      // don't try to open file if it doesn't exist, we are prepared to deal with
      // this ourselves - but all other errors are not expected
      if ( wxFile::Exists("bar") )
      {
          // gives an error message if the file couldn't be opened
          file.Open("bar");
      }
      else
      {
          ...
      }

Library:  wxBase
Category:  Logging

Public Member Functions

 wxLogNull ()
 Suspends logging.
 ~wxLogNull ()
 Resumes logging.

List of all members.


Constructor & Destructor Documentation

wxLogNull::wxLogNull ( )

Suspends logging.

wxLogNull::~wxLogNull ( )

Resumes logging.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines