source: trunk/src/objects/RpChoice.h @ 1983

Last change on this file since 1983 was 1560, checked in by dkearney, 15 years ago

updates to the object system, fixed up tree and xml parser objects, added some basic tests for them and adopted number object to accept xml text and configure itself from the parsed xml. added fermi3.cc example program which contains suggested interface from apps meeting.

File size: 1.6 KB
Line 
1/*
2 * ======================================================================
3 *  AUTHOR:  Derrick Kearney, Purdue University
4 *  Copyright (c) 2005-2009  Purdue Research Foundation
5 *
6 *  See the file "license.terms" for information on usage and
7 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8 * ======================================================================
9 */
10#include <errno.h>
11#include "RpObject.h"
12#include "RpChain.h"
13
14#ifndef RAPPTURE_CHOICE_H
15#define RAPPTURE_CHOICE_H
16
17namespace Rappture {
18
19class Choice : public Object
20{
21    public:
22
23        Choice  (   const char *path,
24                    const char *val );
25
26        Choice  (   const char *path,
27                    const char *val,
28                    const char *label,
29                    const char *desc);
30
31        Choice  (   const Choice& o );
32        virtual ~Choice ();
33
34        Accessor<const char *> def;
35        Accessor<const char *> cur;
36
37        Choice& addOption ( const char *label,
38                            const char *desc,
39                            const char *val );
40
41        Choice& delOption ( const char *label);
42
43        const char *xml(size_t indent, size_t tabstop);
44        const int is() const;
45
46    private:
47
48        // hash or linked list of preset values
49        Rp_Chain *_options;
50
51        typedef struct {
52            Accessor<const char *> label;
53            Accessor<const char *> desc;
54            Accessor<const char *> val;
55        } option;
56};
57
58} // namespace Rappture
59
60/*--------------------------------------------------------------------------*/
61/*--------------------------------------------------------------------------*/
62
63#endif
Note: See TracBrowser for help on using the repository browser.