Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Formatter.h
1 /*
2  * Formatter class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2007-09, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef ELM_STRING_FORMATTER_H
22 #define ELM_STRING_FORMATTER_H
23 
24 #include <elm/io.h>
25 
26 namespace elm {
27 
28 // Formatter class
29 class Formatter {
30  char esc;
31 protected:
32  static const int DONE = 0;
33  static const int CONTINUE = 1;
34  static const int REJECT = 2;
35  virtual int process(io::OutStream& out, char chr) = 0;
36 public:
37  Formatter(char esc = '%');
38  virtual ~Formatter(void) { }
40  inline char escape(void) const { return esc; }
41  inline void escape(char c) { esc = c; }
42 };
43 
44 } // elm
45 
46 #endif // ELM_STRING_FORMATTER_H
elm::t::out
typename type_info< T >::out_t out
Definition: type_info.h:284
elm::Formatter::CONTINUE
static const int CONTINUE
Definition: Formatter.h:33
elm::io::out
sys::SystemOutStream & out
Definition: system_SystemIO.cpp:122
elm::Formatter::~Formatter
virtual ~Formatter(void)
Definition: Formatter.h:38
elm::Formatter::process
virtual int process(io::OutStream &out, char chr)=0
elm::Formatter::REJECT
static const int REJECT
Definition: Formatter.h:34
elm::Formatter
Definition: Formatter.h:29
elm::t::in
typename type_info< T >::in_t in
Definition: type_info.h:283
elm::Formatter::format
int format(io::InStream &in, io::OutStream &out=io::out)
Definition: util_Formatter.cpp:55
elm
Definition: adapter.h:26
elm::io::OutStream
Definition: OutStream.h:30
elm::Formatter::DONE
static const int DONE
Definition: Formatter.h:32
elm::Formatter::Formatter
Formatter(char esc='%')
Definition: util_Formatter.cpp:45
elm::Formatter::escape
char escape(void) const
Definition: Formatter.h:40
elm::Formatter::escape
void escape(char c)
Definition: Formatter.h:41
elm::io::InStream
Definition: InStream.h:29