stdErrPlugin.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2006 Sony Computer Entertainment Inc.
  3. *
  4. * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this
  5. * file except in compliance with the License. You may obtain a copy of the License at:
  6. * http://research.scea.com/scea_shared_source_license.html
  7. *
  8. * Unless required by applicable law or agreed to in writing, software distributed under the License
  9. * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  10. * implied. See the License for the specific language governing permissions and limitations under the
  11. * License.
  12. */
  13. #ifndef _STDERR_PLUGIN_
  14. #define _STDERR_PLUGIN_
  15. #include <dae/daeTypes.h>
  16. #include <dae/daeErrorHandler.h>
  17. /**
  18. * The @c stdErrPlugin class is the default implementation of daeErrorHandler. It routes the Error
  19. * and Warning messaged to stdout.
  20. */
  21. class DLLSPEC stdErrPlugin : public daeErrorHandler {
  22. public:
  23. stdErrPlugin();
  24. virtual ~stdErrPlugin();
  25. public:
  26. void handleError( daeString msg );
  27. void handleWarning( daeString msg );
  28. };
  29. /**
  30. * The @c quietErrorHandler class is an alternative implementation of daeErrorHandler. It suppresses
  31. * error and warning messages. The easiest way to use it is like this:
  32. * daeErrorHandler::setErrorHandler(&quietErrorHandler::getInstance());
  33. */
  34. class DLLSPEC quietErrorHandler : public daeErrorHandler {
  35. public:
  36. quietErrorHandler() { }
  37. void handleError(daeString msg) { }
  38. void handleWarning(daeString msg) { }
  39. static quietErrorHandler& getInstance() { return theInstance; }
  40. private:
  41. static quietErrorHandler theInstance;
  42. };
  43. #endif