1 #ifndef EOL_AWARE_CLASS
2 #define EOL_AWARE_CLASS
4 /*****************************************************************************\
7 * Author : Chris Koeritz
9 *******************************************************************************
10 * Copyright (c) 1996-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
18 #include <basis/definitions.h>
19 #include <textual/parser_bits.h>
23 //! Provides an abstract base for logging mechanisms.
25 This assists greatly in generating diagnostic entries polymorphically and in
26 enabling different logging mechanisms to be plugged in easily. Note that all
27 of the functions are defined virtually which enables overriding pretty much
28 all of the base functionality. Use this wisely, if ever.
31 class eol_aware : public virtual basis::root_object
34 virtual textual::parser_bits::line_ending eol() { return c_ending; }
35 //!< observes how line endings are to be printed.
37 virtual void eol(textual::parser_bits::line_ending to_set) { c_ending = to_set; }
38 //!< modifies how line endings are to be printed.
40 virtual basis::astring get_ending() { return textual::parser_bits::eol_to_chars(c_ending); }
41 //!< returns a string for the current ending.
43 virtual void get_ending(basis::astring &to_end) { to_end = textual::parser_bits::eol_to_chars(c_ending); }
44 //!< appends a string for the current ending to "to_end".
47 textual::parser_bits::line_ending c_ending; //!< the current printing style.