xref: /haiku/src/tests/add-ons/print/ppd/model/Value.h (revision 4420c1ceffd7f2246e4303d59cf02ed122980e9d)
1 /*
2  * Copyright 2008, Haiku.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Michael Pfeiffer <laplace@users.sourceforge.net>
7  */
8 
9 #ifndef _VALUE_H
10 #define _VALUE_H
11 
12 #include <String.h>
13 
14 class Value {
15 public:
16 	enum Type {
17 		kSymbolValue,
18 		kStringValue,
19 		kInvocationValue,
20 		kQuotedValue,
21 		kUnknownValue
22 	};
23 
24 private:
25 	Type     fType;
26 	BString* fValue;
27 	BString* fTranslation;
28 
29 	const char* ElementForType();
30 
31 public:
32 	Value(BString* value = NULL, Type type = kUnknownValue);
33 	virtual ~Value();
34 
35 	void SetType(Type type);
36 	Type GetType();
37 
38 	// mandatory in a valid statement
39 	void SetValue(BString* value);
40 	BString* GetValue();
41 
42 	// optional
43 	void SetTranslation(BString* translation);
44 	BString* GetTranslation();
45 
46 	// convenience methods
47 	const char* GetValueString();
48 	const char* GetTranslationString();
49 
50 	void Print();
51 };
52 
53 #endif
54