vfs: check userland buffers before reading them.
[haiku.git] / src / apps / icon-o-matic / generic / property / specific_properties / OptionProperty.h
blob47a6dd0109f6a5f56976514d258909efb2b539df
1 /*
2 * Copyright 2006, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 */
9 #ifndef OPTION_PROPERTY_H
10 #define OPTION_PROPERTY_H
12 #include <List.h>
13 #include <String.h>
15 #include "Property.h"
17 class OptionProperty : public Property {
18 public:
19 OptionProperty(uint32 identifier);
20 OptionProperty(const OptionProperty& other);
21 OptionProperty(BMessage* archive);
22 virtual ~OptionProperty();
24 // Property interface
25 virtual status_t Archive(BMessage* archive,
26 bool deep = true) const;
27 static BArchivable* Instantiate(BMessage* archive);
29 virtual Property* Clone() const;
31 virtual type_code Type() const;
33 virtual bool SetValue(const char* value);
34 virtual bool SetValue(const Property* other);
35 virtual void GetValue(BString& string);
37 // animation
38 virtual bool MakeAnimatable(bool animatable = true);
41 // OptionProperty
42 void AddOption(int32 id, const char* name);
44 int32 CurrentOptionID() const;
45 bool SetCurrentOptionID(int32 id);
47 bool GetOption(int32 index, BString* string, int32* id) const;
48 bool GetCurrentOption(BString* string) const;
50 bool SetOptionAtOffset(int32 indexOffset);
52 private:
54 struct option {
55 int32 id;
56 BString name;
59 BList fOptions;
60 int32 fCurrentOptionID;
64 #endif // OPTION_PROPERTY_H