src/Command.h
branchv_0
changeset 43 3c8ea5dcf793
parent 42 09cd32a65709
child 44 dd7094457e44
equal deleted inserted replaced
42:09cd32a65709 43:3c8ea5dcf793
     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, version 3 of the License.
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
       
    16  */
       
    17 #pragma once
       
    18 
       
    19 #include <cstdlib>
       
    20 #include <iostream>
       
    21 #include <string>
       
    22 #include <vector>
       
    23 #include <algorithm>
       
    24 
       
    25 
       
    26 namespace relpipe {
       
    27 namespace in {
       
    28 namespace cli {
       
    29 
       
    30 class Command {
       
    31 public:
       
    32 	virtual ~Command() = default;
       
    33 
       
    34 	/**
       
    35 	 * Processes the inputs (stream + arguments) and generates output in the relational pipes format.
       
    36 	 * 
       
    37 	 * @param input usually STDIN, may not be used if all data are passed as CLI arguments
       
    38 	 * @param output usually STDOUT, relational data is passed here
       
    39 	 * @param command command name, usualy not needed, may be significant if the same Command instance is used for several commands
       
    40 	 * @param arguments CLI arguments containing data or parameters (format is specific to each command)
       
    41 	 */
       
    42 	virtual void process(std::istream& input, std::ostream& output, const relpipe::writer::string_t& command, const std::vector<relpipe::writer::string_t> &arguments) = 0;
       
    43 
       
    44 };
       
    45 
       
    46 }
       
    47 }
       
    48 }