xabsl_tools.h

00001 
00002 /***************************************************************************
00003  *  xabsl_tools.h - Tools required for XABSL
00004  *
00005  *  Created: Wed Aug 06 17:20:37 2008
00006  *  Copyright  2006-2008  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __PLUGINS_XABSL_XABSL_TOOLS_H_
00024 #define __PLUGINS_XABSL_XABSL_TOOLS_H_
00025 
00026 #include <XabslEngine/XabslTools.h>
00027 
00028 #include <cstdio>
00029 
00030 namespace fawkes {
00031   class Logger;
00032 }
00033 
00034 class XabslLoggingErrorHandler : public xabsl::ErrorHandler
00035 {
00036  public:
00037   XabslLoggingErrorHandler(fawkes::Logger *logger);
00038 
00039   virtual void printError(const char *text);
00040   virtual void printMessage(const char *text);
00041 
00042  private:
00043   fawkes::Logger *__logger;
00044 };
00045 
00046 
00047 class XabslFileInputSource : public xabsl::InputSource
00048 {
00049  public:
00050   XabslFileInputSource(const char* filename);
00051   ~XabslFileInputSource();
00052 
00053   virtual bool open();
00054   virtual void close();
00055 
00056   virtual double readValue() ;
00057   virtual bool   readString(char* destination, int maxLength);
00058 
00059  private:
00060   char read_and_omit_whitespace(bool omit_whitespace);
00061   bool read_from_file(char *buf, size_t buf_length);
00062   void omit_comment();
00063 
00064  private:
00065   char *__filename;
00066   FILE *__f;
00067 };
00068 
00069 #endif

Generated on Tue Feb 22 13:31:30 2011 for Fawkes API by  doxygen 1.4.7