1 | /* |
---|
2 | * ====================================================================== |
---|
3 | * AUTHOR: Derrick Kearney, Purdue University |
---|
4 | * Copyright (c) 2004-2012 HUBzero Foundation, LLC |
---|
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 | |
---|
17 | namespace Rappture { |
---|
18 | |
---|
19 | class 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 |
---|