23#include "xabsl_tools.h"
25#include <core/exception.h>
26#include <logging/logger.h>
60 logger_->
log_info(
"XABSL",
"%s", text);
73 filename_ = strdup(filename);
91 f_ = fopen(filename_,
"r");
111 if (read_from_file(buf,
sizeof(buf) - 1)) {
128 return read_from_file(buf, buf_length);
133XabslFileInputSource::omit_comment()
137 if (fread(&c, 1, 1, f_)) {
151XabslFileInputSource::read_and_omit_whitespace(
bool omit_whitespace)
155 if (fread(&c, 1, 1, f_)) {
160 if ((c !=
' ') && (c !=
'\n') && (c !=
'\r') && (c !=
'\t')) {
162 }
else if (!omit_whitespace) {
181XabslFileInputSource::read_from_file(
char *buf,
size_t buf_length)
186 memset(buf, 0, buf_length);
187 size_t cur_length = 0;
188 bool is_first =
true;
189 while (!feof(f_) && (cur_length < buf_length)) {
190 char c = read_and_omit_whitespace(is_first);
193 buf[cur_length++] = c;
196 return (cur_length > 0);
200 return (cur_length > 0);
virtual void printMessage(const char *text)
Print info message.
XabslLoggingErrorHandler(fawkes::Logger *logger)
Constructor.
virtual void printError(const char *text)
Print error message.
Base class for exceptions in Fawkes.
virtual void log_error(const char *component, const char *format,...)=0
Log error message.
virtual void log_info(const char *component, const char *format,...)=0
Log informational message.