src/QtRelationalReaderStringHadler.h
branchv_0
changeset 38 129b8cca9b98
parent 37 d905557eda62
child 39 4ad44f170a58
equal deleted inserted replaced
37:d905557eda62 38:129b8cca9b98
     1 /**
       
     2  * Relational pipes
       
     3  * Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
       
     4  *
       
     5  * This program is free software: you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation, either version 3 of the License, or
       
     8  * (at your option) any later version.
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
       
    13  * GNU General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License
       
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
       
    17  */
       
    18 #pragma once
       
    19 
       
    20 #include <QObject>
       
    21 
       
    22 #include <relpipe/reader/typedefs.h>
       
    23 #include <relpipe/reader/TypeId.h>
       
    24 #include <relpipe/reader/handlers/RelationalReaderStringHandler.h>
       
    25 #include <relpipe/reader/handlers/AttributeMetadata.h>
       
    26 
       
    27 using namespace relpipe::reader;
       
    28 using namespace relpipe::reader::handlers;
       
    29 
       
    30 class QtRelationalReaderStringHadler : public QObject, public RelationalReaderStringHadler {
       
    31 
       
    32 	Q_OBJECT
       
    33 public:
       
    34 	QtRelationalReaderStringHadler(QObject* parent) : QObject(parent) {
       
    35 	}
       
    36 
       
    37 	virtual ~QtRelationalReaderStringHadler() {
       
    38 	}
       
    39 
       
    40 	virtual void startRelation(string_t name, std::vector<AttributeMetadata> attributes) override {
       
    41 		emit startRelationReceived(name, attributes);
       
    42 	}
       
    43 
       
    44 	virtual void attribute(const string_t& value) override {
       
    45 		emit attributeReceived(value);
       
    46 	};
       
    47 
       
    48 	virtual void endOfPipe() override {
       
    49 		emit endOfPipeReceived();
       
    50 	};
       
    51 
       
    52 signals:
       
    53 	void startRelationReceived(const string_t name, std::vector<AttributeMetadata> attributes);
       
    54 	void attributeReceived(const string_t value);
       
    55 	void endOfPipeReceived();
       
    56 };