BPicture: Fix archive constructor.
[haiku.git] / src / kits / locale / EditableCatalog.cpp
blobb216dd8098464e6b09a98668ab2d6147efb6dcf3
1 /*
2 * Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de
3 * Copyright 2003-2004,2012, Oliver Tappe, zooey@hirschkaefer.de
4 * Distributed under the terms of the MIT License.
5 */
7 #include <EditableCatalog.h>
9 #include <CatalogData.h>
10 #include <MutableLocaleRoster.h>
13 using BPrivate::MutableLocaleRoster;
16 namespace BPrivate {
17 EditableCatalog::EditableCatalog(const char* type, const char* signature,
18 const char* language)
20 fCatalogData = MutableLocaleRoster::Default()->CreateCatalog(type,
21 signature, language);
25 EditableCatalog::~EditableCatalog()
30 status_t
31 EditableCatalog::SetString(const char* string, const char* translated,
32 const char* context, const char* comment)
34 if (fCatalogData == NULL)
35 return B_NO_INIT;
37 return fCatalogData->SetString(string, translated, context, comment);
41 status_t
42 EditableCatalog::SetString(int32 id, const char* translated)
44 if (fCatalogData == NULL)
45 return B_NO_INIT;
47 return fCatalogData->SetString(id, translated);
51 bool
52 EditableCatalog::CanWriteData() const
54 if (fCatalogData == NULL)
55 return false;
57 return fCatalogData->CanWriteData();
61 status_t
62 EditableCatalog::SetData(const char* name, BMessage* msg)
64 if (fCatalogData == NULL)
65 return B_NO_INIT;
67 return fCatalogData->SetData(name, msg);
71 status_t
72 EditableCatalog::SetData(uint32 id, BMessage* msg)
74 if (fCatalogData == NULL)
75 return B_NO_INIT;
77 return fCatalogData->SetData(id, msg);
81 status_t
82 EditableCatalog::ReadFromFile(const char* path)
84 if (fCatalogData == NULL)
85 return B_NO_INIT;
87 return fCatalogData->ReadFromFile(path);
91 status_t
92 EditableCatalog::ReadFromAttribute(const entry_ref& appOrAddOnRef)
94 if (fCatalogData == NULL)
95 return B_NO_INIT;
97 return fCatalogData->ReadFromAttribute(appOrAddOnRef);
101 status_t
102 EditableCatalog::ReadFromResource(const entry_ref& appOrAddOnRef)
104 if (fCatalogData == NULL)
105 return B_NO_INIT;
107 return fCatalogData->ReadFromResource(appOrAddOnRef);
111 status_t
112 EditableCatalog::WriteToFile(const char* path)
114 if (fCatalogData == NULL)
115 return B_NO_INIT;
117 return fCatalogData->WriteToFile(path);
121 status_t
122 EditableCatalog::WriteToAttribute(const entry_ref& appOrAddOnRef)
124 if (fCatalogData == NULL)
125 return B_NO_INIT;
127 return fCatalogData->WriteToAttribute(appOrAddOnRef);
131 status_t
132 EditableCatalog::WriteToResource(const entry_ref& appOrAddOnRef)
134 if (fCatalogData == NULL)
135 return B_NO_INIT;
137 return fCatalogData->WriteToResource(appOrAddOnRef);
141 void EditableCatalog::MakeEmpty()
143 if (fCatalogData != NULL)
144 fCatalogData->MakeEmpty();
148 BCatalogData*
149 EditableCatalog::CatalogData()
151 return fCatalogData;
155 } // namespace BPrivate