DeSR Dependency Parser |
00001 /* 00002 ** IXE C++ Library 00003 ** ixe/conf/FileType.cpp 00004 ** ---------------------------------------------------------------------- 00005 ** Copyright (c) 2000 Ideare SpA. 00006 ** Copyright (c) 2000 Giuseppe Attardi (attardi@di.unipi.it). 00007 ** ---------------------------------------------------------------------- 00008 ** 00009 ** This file is part of DeSR. 00010 ** 00011 ** DeSR is free software; you can redistribute it and/or modify it 00012 ** under the terms of the GNU General Public License, version 3, 00013 ** as published by the Free Software Foundation. 00014 ** 00015 ** DeSR is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 ** GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 ** ---------------------------------------------------------------------- 00023 */ 00024 00025 #include "conf/FileType.h" 00026 00027 // standard 00028 #include <cstdlib> /* for exit(2) */ 00029 00030 // local 00031 #include "text/strings.h" 00032 #include "include/exit_codes.h" 00033 00034 using namespace std; 00035 using namespace IXE::Text; 00036 00037 namespace IXE { 00038 00039 //============================================================================= 00052 //============================================================================= 00053 00054 /* virtual */ void 00055 FileType::parseValue(char const*& line) 00056 { 00057 char const* type = next_token_line(line, " \r\t"); 00058 if (!type) { 00059 Configuration::error() << "no file type" << endl; 00060 ::exit(Exit_Config_File); 00061 } 00062 type = strndup(type, line - type); 00063 char const* pattern; 00064 bool nopattern = true; 00065 while (pattern = next_token_line(line, " \r\t")) { 00066 value.insert(strndup(pattern, line - pattern), type); 00067 nopattern = false; 00068 } 00069 if (nopattern) { 00070 Configuration::error() << "no file pattern" << endl; 00071 ::exit(Exit_Config_File); 00072 } 00073 } 00074 00075 } // namespace IXE