libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / tools / locale / Catalog.cpp
blobeeb99514043dd169e2670dc77440df0de49ad576
1 /*
2 ** Distributed under the terms of the MIT License.
3 ** Copyright 2003-2004,2012. All rights reserved.
4 **
5 ** Authors: Axel Dörfler, axeld@pinc-software.de
6 ** Oliver Tappe, zooey@hirschkaefer.de
7 */
9 #include <Catalog.h>
10 #include <CatalogData.h>
13 // Provides an implementation of BCatalog for the build host, in effect only
14 // supporting setting and getting of catalog entries.
17 BCatalog::BCatalog()
19 fCatalogData(NULL)
24 BCatalog::BCatalog(const entry_ref& catalogOwner, const char *language,
25 uint32 fingerprint)
27 fCatalogData(NULL)
32 BCatalog::~BCatalog()
37 const char *
38 BCatalog::GetString(const char *string, const char *context, const char *comment)
40 if (fCatalogData == 0)
41 return string;
43 const char *translated;
44 for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
45 translated = cat->GetString(string, context, comment);
46 if (translated)
47 return translated;
50 return string;
54 const char *
55 BCatalog::GetString(uint32 id)
57 if (fCatalogData == 0)
58 return "";
60 const char *translated;
61 for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
62 translated = cat->GetString(id);
63 if (translated)
64 return translated;
67 return "";
71 status_t
72 BCatalog::GetData(const char *name, BMessage *msg)
74 if (fCatalogData == 0)
75 return B_NO_INIT;
77 status_t res;
78 for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
79 res = cat->GetData(name, msg);
80 if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
81 return res;
82 // return B_OK if found, or specific error-code
85 return B_NAME_NOT_FOUND;
89 status_t
90 BCatalog::GetData(uint32 id, BMessage *msg)
92 if (fCatalogData == 0)
93 return B_NO_INIT;
95 status_t res;
96 for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
97 res = cat->GetData(id, msg);
98 if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
99 return res;
100 // return B_OK if found, or specific error-code
103 return B_NAME_NOT_FOUND;