1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | #include <EditableCatalog.h> |
8 | |
9 | #include <CatalogData.h> |
10 | #include <MutableLocaleRoster.h> |
11 | |
12 | |
13 | using BPrivate::MutableLocaleRoster; |
14 | |
15 | |
16 | namespace BPrivate { |
17 | EditableCatalog::EditableCatalog(const char* type, const char* signature, |
18 | const char* language) |
19 | { |
20 | fCatalogData = MutableLocaleRoster::Default()->CreateCatalog(type, |
21 | signature, language); |
22 | } |
23 | |
24 | |
25 | EditableCatalog::~EditableCatalog() |
26 | { |
27 | } |
28 | |
29 | |
30 | status_t |
31 | EditableCatalog::SetString(const char* string, const char* translated, |
32 | const char* context, const char* comment) |
33 | { |
34 | if (fCatalogData == NULL__null) |
35 | return B_NO_INIT((-2147483647 - 1) + 13); |
36 | |
37 | return fCatalogData->SetString(string, translated, context, comment); |
38 | } |
39 | |
40 | |
41 | status_t |
42 | EditableCatalog::SetString(int32 id, const char* translated) |
43 | { |
44 | if (fCatalogData == NULL__null) |
45 | return B_NO_INIT((-2147483647 - 1) + 13); |
46 | |
47 | return fCatalogData->SetString(id, translated); |
48 | } |
49 | |
50 | |
51 | bool |
52 | EditableCatalog::CanWriteData() const |
53 | { |
54 | if (fCatalogData == NULL__null) |
55 | return false; |
56 | |
57 | return fCatalogData->CanWriteData(); |
58 | } |
59 | |
60 | |
61 | status_t |
62 | EditableCatalog::SetData(const char* name, BMessage* msg) |
63 | { |
64 | if (fCatalogData == NULL__null) |
65 | return B_NO_INIT((-2147483647 - 1) + 13); |
66 | |
67 | return fCatalogData->SetData(name, msg); |
68 | } |
69 | |
70 | |
71 | status_t |
72 | EditableCatalog::SetData(uint32 id, BMessage* msg) |
73 | { |
74 | if (fCatalogData == NULL__null) |
75 | return B_NO_INIT((-2147483647 - 1) + 13); |
76 | |
77 | return fCatalogData->SetData(id, msg); |
78 | } |
79 | |
80 | |
81 | status_t |
82 | EditableCatalog::ReadFromFile(const char* path) |
83 | { |
84 | if (fCatalogData == NULL__null) |
85 | return B_NO_INIT((-2147483647 - 1) + 13); |
86 | |
87 | return fCatalogData->ReadFromFile(path); |
88 | } |
89 | |
90 | |
91 | status_t |
92 | EditableCatalog::ReadFromAttribute(const entry_ref& appOrAddOnRef) |
93 | { |
94 | if (fCatalogData == NULL__null) |
95 | return B_NO_INIT((-2147483647 - 1) + 13); |
96 | |
97 | return fCatalogData->ReadFromAttribute(appOrAddOnRef); |
98 | } |
99 | |
100 | |
101 | status_t |
102 | EditableCatalog::ReadFromResource(const entry_ref& appOrAddOnRef) |
103 | { |
104 | if (fCatalogData == NULL__null) |
105 | return B_NO_INIT((-2147483647 - 1) + 13); |
106 | |
107 | return fCatalogData->ReadFromResource(appOrAddOnRef); |
108 | } |
109 | |
110 | |
111 | status_t |
112 | EditableCatalog::WriteToFile(const char* path) |
113 | { |
114 | if (fCatalogData == NULL__null) |
115 | return B_NO_INIT((-2147483647 - 1) + 13); |
116 | |
117 | return fCatalogData->WriteToFile(path); |
118 | } |
119 | |
120 | |
121 | status_t |
122 | EditableCatalog::WriteToAttribute(const entry_ref& appOrAddOnRef) |
123 | { |
124 | if (fCatalogData == NULL__null) |
125 | return B_NO_INIT((-2147483647 - 1) + 13); |
126 | |
127 | return fCatalogData->WriteToAttribute(appOrAddOnRef); |
128 | } |
129 | |
130 | |
131 | status_t |
132 | EditableCatalog::WriteToResource(const entry_ref& appOrAddOnRef) |
133 | { |
134 | if (fCatalogData == NULL__null) |
135 | return B_NO_INIT((-2147483647 - 1) + 13); |
136 | |
137 | return fCatalogData->WriteToResource(appOrAddOnRef); |
138 | } |
139 | |
140 | |
141 | void EditableCatalog::MakeEmpty() |
142 | { |
143 | if (fCatalogData == NULL__null) |
| 1 | Assuming pointer value is null | |
|
| |
144 | fCatalogData->MakeEmpty(); |
| 3 | | Called C++ object pointer is null |
|
145 | } |
146 | |
147 | |
148 | BCatalogData* |
149 | EditableCatalog::CatalogData() |
150 | { |
151 | return fCatalogData; |
152 | } |
153 | |
154 | |
155 | } |