lib: simplified parser and builder API, using the new DBData class
[barry.git] / src / pipe.h
blob9b15996a9195fef120cb345f748206788bfde3ab
1 ///
2 /// \file pipe.h
3 /// Connector class to join parsers and builders together
4 ///
6 /*
7 Copyright (C) 2010, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRY_PIPE_H__
23 #define __BARRY_PIPE_H__
25 #include "dll.h"
26 #include "builder.h"
27 #include "parser.h"
29 namespace Barry {
32 // class Pipe
34 /// Reads data from a builder and feeds it into a parser.
35 ///
36 class BXEXPORT Pipe
38 Builder &m_builder;
39 bool m_valid_builder;
41 DBData m_buffer;
43 public:
44 explicit Pipe(Builder &builder);
45 ~Pipe();
47 /// Access the builder... mostly useful for finding out
48 /// the database name for the next series, if using multiple
49 /// parser objects.
50 const Builder& GetBuilder() const { return m_builder; }
52 /// Reads one item from the builder and feeds it into the parser
53 /// and returns the builder Retrieve status.
54 bool PumpEntry(Parser &parser, const IConverter *ic = 0);
56 /// Reads all items from builder, feeding them into the parser,
57 /// until the builder's Retrieve() signals the end of the series.
58 void PumpSeries(Parser &parser, const IConverter *ic = 0);
60 /// Reads all series from the builder, feeding them into the parser,
61 /// until the builder's EndOfFile() is true.
62 void PumpFile(Parser &parser, const IConverter *ic = 0);
65 } // namespace Barry
67 #endif