Drizzled Public API Documentation

error_message.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Definitions required for Error Message plugin
00005  *
00006  *  Copyright (C) 2008 Sun Microsystems, Inc.
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; version 2 of the License.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  */
00021 
00022 #pragma once
00023 
00024 #include <drizzled/plugin/plugin.h>
00025 #include <drizzled/error/level_t.h>
00026 
00027 #include <stdarg.h>
00028 
00029 #include <string>
00030 
00031 #include <drizzled/visibility.h>
00032 
00033 namespace drizzled
00034 {
00035 
00036 namespace plugin
00037 {
00038 
00039 class DRIZZLED_API ErrorMessage : public Plugin
00040 {
00041   ErrorMessage();
00042   ErrorMessage(const ErrorMessage &);
00043   ErrorMessage& operator=(const ErrorMessage &);
00044 
00045 public:
00046   explicit ErrorMessage(std::string name_arg)
00047    : Plugin(name_arg, "ErrorMessage")
00048   {}
00049   virtual ~ErrorMessage() {}
00050 
00051   virtual bool errmsg(error::level_t priority, const char *format, va_list ap)=0;
00052 
00053   static bool addPlugin(plugin::ErrorMessage *handler);
00054   static void removePlugin(plugin::ErrorMessage *handler);
00055 
00056   static bool vprintf(error::level_t priority, char const *format, va_list ap);
00057 
00058   bool removeLast() const
00059   {
00060     return true;
00061   }
00062 };
00063 
00064 } /* namespace plugin */
00065 } /* namespace drizzled */
00066