# pipe.h

Go to the documentation of this file.

    00001 ///
    00002 /// \file       pipe.h
    00003 ///             Connector class to join parsers and builders together
    00004 ///
    00005
    00006 /*
    00007     Copyright (C) 2010-2011, Net Direct Inc. (http://www.netdirect.ca/)
    00008
    00009     This program is free software; you can redistribute it and/or modify
    00010     it under the terms of the GNU General Public License as published by
    00011     the Free Software Foundation; either version 2 of the License, or
    00012     (at your option) any later version.
    00013
    00014     This program is distributed in the hope that it will be useful,
    00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00017
    00018     See the GNU General Public License in the COPYING file at the
    00019     root directory of this project for more details.
    00020 */
    00021
    00022 #ifndef __BARRY_PIPE_H__
    00023 #define __BARRY_PIPE_H__
    00024
    00025 #include "dll.h"
    00026 #include "builder.h"
    00027 #include "parser.h"
    00028
    00029 namespace Barry {
    00030
    00031 //
    00032 // class Pipe
    00033 //
    00034 /// Reads data from a builder and feeds it into a parser.
    00035 ///
    00036 class BXEXPORT Pipe
    00037 {
    00038         Builder &m_builder;
    00039
    00040         DBData m_buffer;
    00041
    00042 public:
    00043         explicit Pipe(Builder &builder);
    00044         ~Pipe();
    00045
    00046         /// Access the builder... mostly useful for finding out
    00047         /// the database name for the next series, if using multiple
    00048         /// parser objects.
    00049         const Builder& GetBuilder() const { return m_builder; }
    00050
    00051         /// Reads one item from the builder and feeds it into the parser
    00052         /// and returns the builder Retrieve status.
    00053         bool PumpEntry(Parser &parser, const IConverter *ic = 0);
    00054
    00055         /// Reads all items from builder, feeding them into the parser,
    00056         /// until the builder's Retrieve() signals the end of the series.
    00057         void PumpSeries(Parser &parser, const IConverter *ic = 0);
    00058
    00059         /// Reads all series from the builder, feeding them into the parser,
    00060         /// until the builder's EndOfFile() is true.
    00061         void PumpFile(Parser &parser, const IConverter *ic = 0);
    00062 };
    00063
    00064 } // namespace Barry
    00065
    00066 #endif
    00067