KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
l_readable.h
Go to the documentation of this file.
1 /* $Id: l_readable.h 17324 2014-08-18 23:24:24Z predoehl $ */
2 
3 /* =========================================================================== *
4 |
5 | Copyright (c) 1994-2008 by Kobus Barnard (author).
6 |
7 | Personal and educational use of this code is granted, provided that this
8 | header is kept intact, and that the authorship is not misrepresented, that
9 | its use is acknowledged in publications, and relevant papers are cited.
10 |
11 | For other use contact the author (kobus AT cs DOT arizona DOT edu).
12 |
13 | Please note that the code in this file has not necessarily been adequately
14 | tested. Naturally, there is no guarantee of performance, support, or fitness
15 | for any particular task. Nonetheless, I am interested in hearing about
16 | problems that you encounter.
17 |
18 | Authors:
19 | Kyle Simek, Joseph Schlecht, Luca Del Pero
20 |
21 * =========================================================================== */
22 
23 #ifndef KJB_READABLE_H
24 #define KJB_READABLE_H
25 
26 #include <l_cpp/l_exception.h>
27 
28 #include <iosfwd>
29 
30 namespace kjb
31 {
32 
39 class Readable
40 {
41 public:
42 
44  virtual ~Readable() { }
45 
46 
48  virtual void read(std::istream& in) = 0;
49 
50 
52  virtual void read(const char* fname);
53 
54 
59  static const char* read_field_value
60  (
61  std::istream& in,
62  const char* field_name,
63  char* field_buf,
64  size_t buf_len,
65  char separator=':'
66  );
67 
68 
74  static const char* read_field_value
75  (
76  std::istream& in,
77  const char* field_name,
78  char separator=':'
79  );
80 };
81 
82 
83 }
84 
85 
86 #endif
Abstract class to read this object from an input stream.
Definition: l_readable.h:39
virtual ~Readable()
Deletes this Readable.
Definition: l_readable.h:44
static const char * read_field_value(std::istream &in, const char *field_name, char *field_buf, size_t buf_len, char separator=':')
Reads a line off in into a buffer and returns a pointer to the field value in the buffer...
Definition: l_readable.cpp:90
virtual void read(std::istream &in)=0
Reads this Readable from an input stream.
Support for error handling exception classes in libKJB.