1 /* 2 * fileiter.h: Part of GNU CSSC. 3 * 4 * 5 * Copyright (C) 1997, 1998, 1999, 2007, 2008, 2009, 2010, 2011, 2014, 6 * 2019 Free Software Foundation, Inc. 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 * 21 * CSSC was originally Based on MySC, by Ross Ridge, which was 22 * placed in the Public Domain. 23 * 24 * 25 * Defines the class sccs_file_iter. 26 * 27 */ 28 29 #ifndef CSSC__FILEITER_H__ 30 #define CSSC__FILEITER_H__ 31 32 #include <string> 33 #include <vector> 34 #include "sccsname.h" 35 36 class CSSC_Options; 37 38 39 /* This class is used to iterate over the list of SCCS files as 40 specified on the command line. */ 41 class sccs_file_iterator 42 { 43 public: 44 enum sources { NONE = 0, ARGS, STDIN, DIRECTORY }; 45 46 private: 47 enum sources source; 48 49 char **argv; 50 int argc; 51 int is_unique; 52 53 std::vector<std::string> files; 54 std::vector<std::string>::size_type pos; 55 sccs_name name; 56 57 public: 58 // sccs_file_iterator(int ac, char **av, int ind = 1); 59 sccs_file_iterator(const CSSC_Options&); 60 61 int next(); 62 get_name()63 sccs_name &get_name() { return name; } 64 65 // JAY mod: using is now a keyword; change the function name to 66 // using_source(). using_source()67 enum sources using_source() { return source; } using_stdin()68 bool using_stdin() { return STDIN == source; } 69 70 // unique() returns nonzero if more than exactly one file was 71 // specified on the command line; zero if more than one was 72 // specified or the names are gotten from a directory or pipe. 73 int unique() const; 74 }; 75 76 #endif /* __FILEITER_H__ */ 77 78 /* Local variables: */ 79 /* mode: c++ */ 80 /* End: */ 81