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.
7 #include <EditableCatalog.h>
9 #include <CatalogData.h>
10 #include <MutableLocaleRoster.h>
13 using BPrivate::MutableLocaleRoster
;
17 EditableCatalog::EditableCatalog(const char* type
, const char* signature
,
20 fCatalogData
= MutableLocaleRoster::Default()->CreateCatalog(type
,
25 EditableCatalog::~EditableCatalog()
31 EditableCatalog::SetString(const char* string
, const char* translated
,
32 const char* context
, const char* comment
)
34 if (fCatalogData
== NULL
)
37 return fCatalogData
->SetString(string
, translated
, context
, comment
);
42 EditableCatalog::SetString(int32 id
, const char* translated
)
44 if (fCatalogData
== NULL
)
47 return fCatalogData
->SetString(id
, translated
);
52 EditableCatalog::CanWriteData() const
54 if (fCatalogData
== NULL
)
57 return fCatalogData
->CanWriteData();
62 EditableCatalog::SetData(const char* name
, BMessage
* msg
)
64 if (fCatalogData
== NULL
)
67 return fCatalogData
->SetData(name
, msg
);
72 EditableCatalog::SetData(uint32 id
, BMessage
* msg
)
74 if (fCatalogData
== NULL
)
77 return fCatalogData
->SetData(id
, msg
);
82 EditableCatalog::ReadFromFile(const char* path
)
84 if (fCatalogData
== NULL
)
87 return fCatalogData
->ReadFromFile(path
);
92 EditableCatalog::ReadFromAttribute(const entry_ref
& appOrAddOnRef
)
94 if (fCatalogData
== NULL
)
97 return fCatalogData
->ReadFromAttribute(appOrAddOnRef
);
102 EditableCatalog::ReadFromResource(const entry_ref
& appOrAddOnRef
)
104 if (fCatalogData
== NULL
)
107 return fCatalogData
->ReadFromResource(appOrAddOnRef
);
112 EditableCatalog::WriteToFile(const char* path
)
114 if (fCatalogData
== NULL
)
117 return fCatalogData
->WriteToFile(path
);
122 EditableCatalog::WriteToAttribute(const entry_ref
& appOrAddOnRef
)
124 if (fCatalogData
== NULL
)
127 return fCatalogData
->WriteToAttribute(appOrAddOnRef
);
132 EditableCatalog::WriteToResource(const entry_ref
& appOrAddOnRef
)
134 if (fCatalogData
== NULL
)
137 return fCatalogData
->WriteToResource(appOrAddOnRef
);
141 void EditableCatalog::MakeEmpty()
143 if (fCatalogData
!= NULL
)
144 fCatalogData
->MakeEmpty();
149 EditableCatalog::CatalogData()
155 } // namespace BPrivate