xref: /haiku/headers/private/locale/EditableCatalog.h (revision 17889a8c70dbb3d59c1412f6431968753c767bab)
1 /*
2  * Copyright 2003-2012, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _EDITABLE_CATALOG_H_
6 #define _EDITABLE_CATALOG_H_
7 
8 
9 #include <Catalog.h>
10 
11 
12 class BMessage;
13 struct entry_ref;
14 
15 
16 namespace BPrivate {
17 
18 
19 class EditableCatalog : public BCatalog {
20 public:
21 								EditableCatalog(const char* type,
22 									const char* signature,
23 									const char* language);
24 	virtual						~EditableCatalog();
25 
26 			status_t			SetString(const char* string,
27 									const char* translated,
28 									const char* context = NULL,
29 									const char* comment = NULL);
30 			status_t			SetString(int32 id, const char* translated);
31 
32 			bool				CanWriteData() const;
33 			status_t			SetData(const char* name, BMessage* msg);
34 			status_t			SetData(uint32 id, BMessage* msg);
35 
36 			status_t			ReadFromFile(const char* path = NULL);
37 			status_t			ReadFromAttribute(
38 									const entry_ref& appOrAddOnRef);
39 			status_t			ReadFromResource(
40 									const entry_ref& appOrAddOnRef);
41 			status_t			WriteToFile(const char* path = NULL);
42 			status_t			WriteToAttribute(
43 									const entry_ref& appOrAddOnRef);
44 			status_t			WriteToResource(
45 									const entry_ref& appOrAddOnRef);
46 
47 			void				MakeEmpty();
48 
49 			BCatalogData*		CatalogData();
50 
51 private:
52 								EditableCatalog();
53 								EditableCatalog(const EditableCatalog& other);
54 			const EditableCatalog&	operator=(const EditableCatalog& other);
55 									// hide assignment, default-, and
56 									// copy-constructor
57 };
58 
59 
60 } // namespace BPrivate
61 
62 
63 #endif /* _EDITABLE_CATALOG_H_ */
64