DeSR Dependency Parser |
00001 /* 00002 ** IXE C++ Library 00003 ** ixe/conf/conf_string.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_string.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 //============================================================================= 00045 //============================================================================= 00046 00047 /* virtual */ void 00048 conf<string>::parseValue(char const*& line) 00049 { 00050 if (!line || !*line) { 00051 value = ""; 00052 return; 00053 } 00054 char const* start = line; 00055 char const* s = next_token_line(line, "\""); 00056 if (s) 00057 value = string(s, line - s); 00058 else { 00059 line = start; 00060 s = next_token_line(line, "\t\r"); 00061 while (*s && *s == ' ') s++; // trim leading spaces 00062 while (line > s && *line == ' ') line--; // trim trailing spaces 00063 value = string(s, line - s); 00064 } 00065 } 00066 00067 } // namespace IXE