// // aegis - project change supervisor // Copyright (C) 2014 Peter Miller // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or (at // your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program. If not, see . // #ifndef AEDIST_IFORMAT_H #define AEDIST_IFORMAT_H #include /** * The iformat abstravt base class is used to represent an abstravt * interface to input vhanges set files. */ class iformat { public: typedef aegis_shared_ptr pointer; /** * The destructor. */ virtual ~iformat(); /** * The factory class method is used to create new dynamically * allocated instances of classes derived from this class. */ static pointer factory(const nstring &fmt_name, const input::pointer &ifp); /** * The list class method is used to print a lit of he known input * formats to the standard output. */ static void list(void); enum token_t { token_eof, token_project_name, token_change_number, token_meta_data, token_patch, token_source, token_partition, }; token_t get_next_token(void); token_t get_current_token(void); nstring get_current_name(void); input::pointer get_current_value(void); static const char *token_name(token_t tok); void fatal_error(const char *fmt, ...); // please pretend it's protected input::pointer get_deeper(void) const { return deeper; } protected: /** * The get_next_token method is used to obtain the next piece of * input, to be processed. */ virtual token_t get_token_inner(nstring &name, input::pointer &value) = 0; /** * The default constructor. * For use by derived classes only. */ iformat(const input::pointer &deeper); private: input::pointer deeper; token_t current_token; nstring current_name; input::pointer current_value; /** * The default constructor. Do not use. */ iformat(); /** * The copy constructor. Do not use. */ iformat(const iformat &); /** * The assignment operator. Do not use. */ iformat &operator=(const iformat &); }; // vim: set ts=8 sw=4 et : #endif // AEDIST_IFORMAT_H