00001 // Copyright (C) 2001, Compaq Computer Corporation 00002 // 00003 // This file is part of Vesta. 00004 // 00005 // Vesta is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // Vesta is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with Vesta; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 // Last modified on Thu Nov 8 12:36:38 EST 2001 by ken@xorian.net 00020 // modified on Fri Aug 8 14:41:51 PDT 1997 by heydon 00021 00022 // Wrapper functions for VestaConfig.H 00023 00024 #ifndef _READ_CONFIG_H 00025 #define _READ_CONFIG_H 00026 00027 #include <Basics.H> 00028 00029 /* The routines in this interface are wrapper functions for the "get" method 00030 of a "VestaConfig" object. If there is an error accessing the configuration 00031 file, or if the requested section/name does not exist in the configuration 00032 file, they report a fatal error and cause the process to exit. */ 00033 00034 class ReadConfig { 00035 public: 00036 static Text Location() throw (); 00037 /* Return the result of "VestaConfig::get_location()". Report a 00038 fatal error and exit if that function throws an exception. */ 00039 00040 static Text TextVal(const Text& sect, const Text& nm) throw (); 00041 /* Return the value in the Vesta configuration file associated with 00042 the name "nm" in the section "sect". */ 00043 00044 static int IntVal(const Text& sect, const Text& nm) throw (); 00045 /* Read the value in the Vesta configuration file associated with the name 00046 "nm" in the section "sect". If it is a string representation of an 00047 integer, return its value; otherwise, report a fatal error and 00048 exit. */ 00049 00050 static bool OptIntVal(const Text& sect, const Text& nm, int& val) throw (); 00051 /* Read the value in the Vesta configuration file associated with the 00052 name "nm" in the section "sect". If no such entry exists, return 00053 "false". Otherwise, return "true" and set "val" to the entry's value 00054 converted to an integer. If the entry's value cannot be converted to an 00055 integer, report a fatal error and exit. */ 00056 00057 static bool OptBoolVal(const Text& sect, const Text& nm, bool& val) 00058 throw (); 00059 /* Like "OptIntVal", only read a boolean value. */ 00060 }; 00061 00062 #endif // _READ_CONFIG_H