2 * Simulator of microcontrollers (sim.src/optioncl.h)
4 * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
10 /* This file is part of microcontroller simulator: ucsim.
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
28 #ifndef SIM_OPTIONCL_HEADER
29 #define SIM_OPTIONCL_HEADER
59 class cl_option: public cl_base
64 union option_value value;
65 class cl_base *creator;
67 class cl_list *users; // cl_optref
73 cl_option(class cl_base *the_creator, char *aname, char *Ihelp);
74 virtual class cl_option &operator=(class cl_option &o);
75 virtual ~cl_option(void);
76 virtual void pre_remove(void);
78 virtual class cl_base *get_creator(void) { return(creator); }
79 virtual void hide(void) { hidden= DD_TRUE; }
80 virtual void show(void) { hidden= DD_FALSE; }
82 virtual void print(class cl_console *con) {}
84 virtual void get_value(bool *val);
85 virtual void get_value(char **val);
86 virtual union option_value *get_value(void) { return(&value); }
87 virtual void set_value(bool);
88 virtual void set_value(char *s);
90 virtual void new_reference(class cl_optref *ref);
91 virtual void del_reference(class cl_optref *ref);
92 virtual void inform_users(void);
96 class cl_options: public cl_sorted_list
99 cl_options(void): cl_sorted_list(2, 2) { Duplicates= DD_TRUE; }
100 virtual void *key_of(void *item);
101 virtual int compare(void *key1, void *key2);
102 virtual void new_option(class cl_option *opt);
103 virtual void del_option(class cl_option *opt);
104 virtual class cl_option *get_option(char *the_name);
105 virtual class cl_option *get_option(char *the_name, class cl_base *creator);
106 virtual class cl_option *get_option(char *the_name, char *creator);
107 virtual class cl_option *get_option(int idx);
108 virtual int nuof_options(char *the_name);
109 virtual int nuof_options(char *the_name, char *creator);
111 virtual class cl_option *set_value(char *the_name, cl_base *creator,
113 virtual class cl_option *set_value(char *the_name, cl_base *creator,
118 class cl_optref: public cl_base
121 class cl_option *option;
122 class cl_base *owner;
124 cl_optref(class cl_base *the_owner);
125 cl_optref(class cl_base *the_owner, class cl_option *new_option);
126 virtual ~cl_optref(void);
128 virtual class cl_option *create(class cl_base *creator,
129 enum option_type type,
130 char *the_name, char *help);
131 virtual void default_option(char *the_name);
132 virtual class cl_option *use(void);
133 virtual class cl_option *use(char *the_name);
134 virtual void option_changed(void) {}
135 virtual void option_removing(void);
136 virtual class cl_base *get_owner(void) { return(owner); }
138 virtual bool get_value(bool);
139 virtual char *get_value(char *);
143 class cl_bool_option: public cl_option
146 cl_bool_option(class cl_base *the_creator, char *aname, char *Ihelp);
148 virtual void print(class cl_console *con);
149 //virtual void get_value(bool *val);
150 //virtual void set_value(bool);
151 virtual void set_value(char *s);
155 class cl_string_option: public cl_option
158 cl_string_option(class cl_base *the_creator, char *aname, char *Ihelp);
159 virtual class cl_option &operator=(class cl_option &o);
161 virtual void print(class cl_console *con);
162 //virtual void get_value(char *val);
163 //virtual void set_value(char *opt);
167 class cl_cons_debug_opt: public cl_option
172 cl_cons_debug_opt(class cl_app *the_app, char *Iid, char *Ihelp);
174 virtual void print(class cl_console *con);
176 virtual void get_value(bool *val);
178 virtual void set_value(bool);
179 virtual void set_value(char *s);
185 /* End of optioncl.h */