Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

options_recorder.hh

Go to the documentation of this file.
00001 /*
00002  *  File:       options_recorder.hh
00003  *              $Id: options_recorder.hh,v 1.5 2002/06/23 23:29:10 alec Exp $
00004  *
00005  *  Author:     Alec Panoviciu (alecu@email.com)
00006  *
00007  *  Comments:
00008  *
00009  *  Revision history:
00010  *
00011  *  $Log: options_recorder.hh,v $
00012  *  Revision 1.5  2002/06/23 23:29:10  alec
00013  *  profile-based optimization stuff
00014  *
00015  *  Revision 1.4  2002/05/27 03:02:43  alec
00016  *  doc update
00017  *
00018  *  Revision 1.3  2002/05/22 01:40:01  alec
00019  *  added option kind check
00020  *
00021  *  Revision 1.2  2002/04/29 09:34:10  alec
00022  *  scanner ptree building compiles
00023  *
00024  */
00025 
00026 
00027 /* 
00028   Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)
00029 
00030   This program is free software; you can redistribute it and/or modify
00031   it under the terms of the GNU General Public License as published by
00032   the Free Software Foundation; either version 2 of the License, or
00033   (at your option) any later version.
00034 
00035   This program is distributed in the hope that it will be useful,
00036   but WITHOUT ANY WARRANTY; without even the implied warranty of
00037   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00038   GNU General Public License for more details.
00039 
00040   You should have received a copy of the GNU General Public License
00041   along with this program; if not, write to the Free Software
00042   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00043 
00044  */
00045 
00046 #ifndef __OPTIONS_RECORDER_HH__
00047 #define __OPTIONS_RECORDER_HH__
00048 
00049 #include "debug.h"
00050 #include "parse_util.hh"
00051 
00052 
00053 class PropRegistry;
00054 
00059 class OptionsRecorder
00060 {
00061   
00067   typedef struct t_OptDesc {
00068 
00069     static char *kNames[];
00070     
00071     enum t_kinds {o_int, o_string, o_bool } kind;
00072     char *name;
00073     char *defVal;
00074     
00075   } OptDesc;
00076 
00077 public:
00078 
00084   OptionsRecorder (PropRegistry &registry_);
00085 
00089   void setOption (const string &key, const string &value)
00090     throw (ParseException);
00091 
00092   void OptionsRecorder::setOption (const string &key, const char *value)
00093     throw (ParseException);
00094   
00098   void setOption (const string &key, int value)
00099     throw (ParseException);
00100 
00104   void setOption (const string &key, bool value)
00105     throw (ParseException);
00106 
00111   void checkName (const string &key, OptDesc::t_kinds kind)
00112     throw (ParseException);
00113 
00114 #ifdef DEBUG
00115 
00119   void dumpRegistry ();
00120   
00121 #endif
00122   
00123 private:
00124   
00132   static OptDesc optDescriptors[];
00133 
00138   PropRegistry &registry;
00139 };
00140 
00141 #endif /* #ifndef __OPTIONS_RECORDER_HH__ */

Generated at Tue Jul 9 21:05:44 2002 for CppCC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001