DeSR Dependency Parser |
00001 /* 00002 ** IXE C++ Library 00003 ** ixe/conf/conf_bool.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 // Settings 00026 #include "conf/conf_bool.h" 00027 00028 // standard 00029 #include <iostream> 00030 00031 // local 00032 #include "text/strings.h" 00033 00034 using namespace std; 00035 using namespace Tanl::Text; 00036 00037 namespace IXE { 00038 00039 //============================================================================= 00048 //============================================================================= 00049 /* virtual */ 00050 void conf<bool>::parseValue(char const*& lines) 00051 { 00052 char const* line = next_token_line(lines, "\n"); 00053 if (!strncasecmp(line, "false", 5) || 00054 !strncasecmp(line, "f", 1) || 00055 !strncasecmp(line, "no", 2) || 00056 !strncasecmp(line, "n", 1) || 00057 !strncasecmp(line, "off", 3) || 00058 !strncasecmp(line, "0", 1)) { 00059 value = false; 00060 return; 00061 } 00062 if (!strncasecmp(line, "true", 4) || 00063 !strncasecmp(line, "t", 1) || 00064 !strncasecmp(line, "yes", 3) || 00065 !strncasecmp(line, "y", 1) || 00066 !strncasecmp(line, "on", 2) || 00067 !strncasecmp(line, "1", 1)) { 00068 value = true; 00069 return; 00070 } 00071 Configuration::error() << '"' << name() << "\" is not one of: " 00072 "false, f, no, n, off, 0, true, t, yes, y, on, 1" << endl; 00073 } 00074 00075 } // namespace IXE