Fawkes API Fawkes Development Version
xabsl_tools.h
1
2/***************************************************************************
3 * xabsl_tools.h - Tools required for XABSL
4 *
5 * Created: Wed Aug 06 17:20:37 2008
6 * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_XABSL_XABSL_TOOLS_H_
24#define _PLUGINS_XABSL_XABSL_TOOLS_H_
25
26#include <XabslEngine/XabslTools.h>
27
28#include <cstdio>
29
30namespace fawkes {
31class Logger;
32}
33
34class XabslLoggingErrorHandler : public xabsl::ErrorHandler
35{
36public:
38
39 virtual void printError(const char *text);
40 virtual void printMessage(const char *text);
41
42private:
43 fawkes::Logger *logger_;
44};
45
46class XabslFileInputSource : public xabsl::InputSource
47{
48public:
49 XabslFileInputSource(const char *filename);
51
52 virtual bool open();
53 virtual void close();
54
55 virtual double readValue();
56 virtual bool readString(char *destination, int maxLength);
57
58private:
59 char read_and_omit_whitespace(bool omit_whitespace);
60 bool read_from_file(char *buf, size_t buf_length);
61 void omit_comment();
62
63private:
64 char *filename_;
65 FILE *f_;
66};
67
68#endif
File input class for Xabsl integration.
Definition: xabsl_tools.h:47
virtual void close()
Close file.
Definition: xabsl_tools.cpp:97
virtual double readValue()
Read a double value from the file.
XabslFileInputSource(const char *filename)
Constructor.
Definition: xabsl_tools.cpp:71
virtual bool open()
Open file.
Definition: xabsl_tools.cpp:88
~XabslFileInputSource()
Destructor.
Definition: xabsl_tools.cpp:78
virtual bool readString(char *destination, int maxLength)
Read a string from the file.
Logging error handler for XABSL integration.
Definition: xabsl_tools.h:35
virtual void printMessage(const char *text)
Print info message.
Definition: xabsl_tools.cpp:58
XabslLoggingErrorHandler(fawkes::Logger *logger)
Constructor.
Definition: xabsl_tools.cpp:40
virtual void printError(const char *text)
Print error message.
Definition: xabsl_tools.cpp:49
Interface for logging.
Definition: logger.h:42
Fawkes library namespace.