Cleanup BCatalogAddOn.
* rename BCatalogAddOn to BCatalogData, since it doesn't represent an
add-on, but rather the catalog data provided by an add-on
* move BCatalogData out of Catalog.{h,cpp} into its own header and
implementation file
* drop BCatalogData::MarkForTranslation() methods, they're not needed
* drop BCatalog::GetNoAutoCollectString() methods, they're not being
used anywhere
* cleanup the B_TRANSLATE_... macros somewhat
* add versions of the B_TRANSLATE_MARK_... macros that are meant to be
used in void context (when the string isn't being used by the program,
just meant to be picked up by collectcatkeys).
* adjust several apps to use B_TRANSLATE_MARK_..._VOID where needed
* adjust users of BCatalogAddOn accordingly
This commit is contained in:
+71
-178
@@ -12,7 +12,7 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
class BCatalogAddOn;
|
class BCatalogData;
|
||||||
class BLocale;
|
class BLocale;
|
||||||
class BMessage;
|
class BMessage;
|
||||||
struct entry_ref;
|
struct entry_ref;
|
||||||
@@ -31,11 +31,6 @@ public:
|
|||||||
const char* comment = NULL);
|
const char* comment = NULL);
|
||||||
const char* GetString(uint32 id);
|
const char* GetString(uint32 id);
|
||||||
|
|
||||||
const char* GetNoAutoCollectString(const char* string,
|
|
||||||
const char* context = NULL,
|
|
||||||
const char* comment = NULL);
|
|
||||||
const char* GetNoAutoCollectString(uint32 id);
|
|
||||||
|
|
||||||
status_t GetData(const char* name, BMessage* msg);
|
status_t GetData(const char* name, BMessage* msg);
|
||||||
status_t GetData(uint32 id, BMessage* msg);
|
status_t GetData(uint32 id, BMessage* msg);
|
||||||
|
|
||||||
@@ -55,7 +50,7 @@ protected:
|
|||||||
const BCatalog& operator= (const BCatalog&);
|
const BCatalog& operator= (const BCatalog&);
|
||||||
// hide assignment and copy-constructor
|
// hide assignment and copy-constructor
|
||||||
|
|
||||||
BCatalogAddOn* fCatalog;
|
BCatalogData* fCatalogData;
|
||||||
mutable BLocker fLock;
|
mutable BLocker fLock;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -122,12 +117,13 @@ private:
|
|||||||
#undef B_TRANSLATE_SYSTEM_NAME
|
#undef B_TRANSLATE_SYSTEM_NAME
|
||||||
#define B_TRANSLATE_SYSTEM_NAME(string) \
|
#define B_TRANSLATE_SYSTEM_NAME(string) \
|
||||||
BLocaleRoster::Default()->IsFilesystemTranslationPreferred() \
|
BLocaleRoster::Default()->IsFilesystemTranslationPreferred() \
|
||||||
? BLocaleRoster::Default()->GetCatalog()->GetString((string), \
|
? BLocaleRoster::Default()->GetCatalog()->GetString((string), \
|
||||||
B_TRANSLATE_SYSTEM_NAME_CONTEXT) : (string)
|
B_TRANSLATE_SYSTEM_NAME_CONTEXT) \
|
||||||
|
: (string)
|
||||||
|
|
||||||
// Translation markers which can be used to mark static strings/IDs which
|
// Translation markers which can be used to mark static strings/IDs which
|
||||||
// are used as key for translation requests (at other places in the code):
|
// are used as key for translation requests (at other places in the code).
|
||||||
/* example:
|
/* Example:
|
||||||
#define B_TRANSLATE_CONTEXT "MyDecentApp-Menu"
|
#define B_TRANSLATE_CONTEXT "MyDecentApp-Menu"
|
||||||
|
|
||||||
static const char* choices[] = {
|
static const char* choices[] = {
|
||||||
@@ -137,7 +133,8 @@ private:
|
|||||||
B_TRANSLATE_MARK("down")
|
B_TRANSLATE_MARK("down")
|
||||||
};
|
};
|
||||||
|
|
||||||
void MyClass::AddChoices(BMenu* menu) {
|
void MyClass::AddChoices(BMenu* menu)
|
||||||
|
{
|
||||||
for (char** ch = choices; *ch != '\0'; ++ch) {
|
for (char** ch = choices; *ch != '\0'; ++ch) {
|
||||||
menu->AddItem(
|
menu->AddItem(
|
||||||
new BMenuItem(
|
new BMenuItem(
|
||||||
@@ -149,46 +146,57 @@ private:
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
#undef B_TRANSLATE_MARK
|
#undef B_TRANSLATE_MARK
|
||||||
#define B_TRANSLATE_MARK(str) \
|
#define B_TRANSLATE_MARK(string) (string)
|
||||||
BCatalogAddOn::MarkForTranslation((str), B_TRANSLATE_CONTEXT, "")
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_MARK_COMMENT
|
#undef B_TRANSLATE_MARK_COMMENT
|
||||||
#define B_TRANSLATE_MARK_COMMENT(str, cmt) \
|
#define B_TRANSLATE_MARK_COMMENT(string, comment) (string)
|
||||||
BCatalogAddOn::MarkForTranslation((str), B_TRANSLATE_CONTEXT, (cmt))
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_MARK_ALL
|
#undef B_TRANSLATE_MARK_ALL
|
||||||
#define B_TRANSLATE_MARK_ALL(str, ctx, cmt) \
|
#define B_TRANSLATE_MARK_ALL(string, context, comment) (string)
|
||||||
BCatalogAddOn::MarkForTranslation((str), (ctx), (cmt))
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_MARK_ID
|
#undef B_TRANSLATE_MARK_ID
|
||||||
#define B_TRANSLATE_MARK_ID(id) \
|
#define B_TRANSLATE_MARK_ID(id) (id)
|
||||||
BCatalogAddOn::MarkForTranslation((id))
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_MARK_SYSTEM_NAME
|
#undef B_TRANSLATE_MARK_SYSTEM_NAME
|
||||||
#define B_TRANSLATE_MARK_SYSTEM_NAME(str) \
|
#define B_TRANSLATE_MARK_SYSTEM_NAME(string) (string)
|
||||||
BCatalogAddOn::MarkForTranslation((str), B_TRANSLATE_SYSTEM_NAME_CONTEXT, "")
|
|
||||||
|
// the same for void contexts:
|
||||||
|
#undef B_TRANSLATE_MARK_VOID
|
||||||
|
#define B_TRANSLATE_MARK_VOID(string)
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_MARK_COMMENT_VOID
|
||||||
|
#define B_TRANSLATE_MARK_COMMENT_VOID(string, comment)
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_MARK_ALL_VOID
|
||||||
|
#define B_TRANSLATE_MARK_ALL_VOID(string, context, comment)
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_MARK_ID_VOID
|
||||||
|
#define B_TRANSLATE_MARK_ID_VOID(id)
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_MARK_SYSTEM_NAME_VOID
|
||||||
|
#define B_TRANSLATE_MARK_SYSTEM_NAME_VOID(string)
|
||||||
|
|
||||||
// Translation macros which do not let collectcatkeys try to collect the key
|
// Translation macros which do not let collectcatkeys try to collect the key
|
||||||
// (useful in combination with the marking macros above):
|
// (useful in combination with the marking macros above):
|
||||||
#undef B_TRANSLATE_NOCOLLECT
|
#undef B_TRANSLATE_NOCOLLECT
|
||||||
#define B_TRANSLATE_NOCOLLECT(str) \
|
#define B_TRANSLATE_NOCOLLECT(string) \
|
||||||
B_TRANSLATE(str)
|
B_TRANSLATE(string)
|
||||||
|
|
||||||
#undef B_TRANSLATE_NOCOLLECT_COMMENT
|
#undef B_TRANSLATE_NOCOLLECT_COMMENT
|
||||||
#define B_TRANSLATE_NOCOLLECT_COMMENT(str, cmt) \
|
#define B_TRANSLATE_NOCOLLECT_COMMENT(string, comment) \
|
||||||
B_TRANSLATE_COMMENT(str, cmt)
|
B_TRANSLATE_COMMENT(string, comment)
|
||||||
|
|
||||||
#undef B_TRANSLATE_NOCOLLECT_ALL
|
#undef B_TRANSLATE_NOCOLLECT_ALL
|
||||||
#define B_TRANSLATE_NOCOLLECT_ALL(str, ctx, cmt) \
|
#define B_TRANSLATE_NOCOLLECT_ALL(string, context, comment) \
|
||||||
B_TRANSLATE_ALL(str, ctx, cmt)
|
B_TRANSLATE_ALL(string, context, comment)
|
||||||
|
|
||||||
#undef B_TRANSLATE_NOCOLLECT_ID
|
#undef B_TRANSLATE_NOCOLLECT_ID
|
||||||
#define B_TRANSLATE_NOCOLLECT_ID(id) \
|
#define B_TRANSLATE_NOCOLLECT_ID(id) \
|
||||||
B_TRANSLATE_ID(id)
|
B_TRANSLATE_ID(id)
|
||||||
|
|
||||||
#undef B_TRANSLATE_NOCOLLECT_SYSTEM_NAME
|
#undef B_TRANSLATE_NOCOLLECT_SYSTEM_NAME
|
||||||
#define B_TRANSLATE_NOCOLLECT_SYSTEM_NAME(str) \
|
#define B_TRANSLATE_NOCOLLECT_SYSTEM_NAME(string) \
|
||||||
B_TRANSLATE_SYSTEM_NAME(str)
|
B_TRANSLATE_SYSTEM_NAME(string)
|
||||||
|
|
||||||
#endif /* B_AVOID_TRANSLATION_MACROS */
|
#endif /* B_AVOID_TRANSLATION_MACROS */
|
||||||
|
|
||||||
@@ -226,176 +234,61 @@ private:
|
|||||||
B_CATKEY((string), B_TRANSLATE_SYSTEM_NAME_CONTEXT)
|
B_CATKEY((string), B_TRANSLATE_SYSTEM_NAME_CONTEXT)
|
||||||
|
|
||||||
#undef B_TRANSLATE_MARK
|
#undef B_TRANSLATE_MARK
|
||||||
#define B_TRANSLATE_MARK(str) \
|
#define B_TRANSLATE_MARK(string) \
|
||||||
B_CATKEY((str), B_TRANSLATE_CONTEXT)
|
B_CATKEY((string), B_TRANSLATE_CONTEXT)
|
||||||
|
|
||||||
#undef B_TRANSLATE_MARK_COMMENT
|
#undef B_TRANSLATE_MARK_COMMENT
|
||||||
#define B_TRANSLATE_MARK_COMMENT(str, cmt) \
|
#define B_TRANSLATE_MARK_COMMENT(string, comment) \
|
||||||
B_CATKEY((str), B_TRANSLATE_CONTEXT, (cmt))
|
B_CATKEY((string), B_TRANSLATE_CONTEXT, (comment))
|
||||||
|
|
||||||
#undef B_TRANSLATE_MARK_ALL
|
#undef B_TRANSLATE_MARK_ALL
|
||||||
#define B_TRANSLATE_MARK_ALL(str, ctx, cmt) \
|
#define B_TRANSLATE_MARK_ALL(string, context, comment) \
|
||||||
B_CATKEY((str), (ctx), (cmt))
|
B_CATKEY((string), (context), (comment))
|
||||||
|
|
||||||
#undef B_TRANSLATE_MARK_ID
|
#undef B_TRANSLATE_MARK_ID
|
||||||
#define B_TRANSLATE_MARK_ID(id) \
|
#define B_TRANSLATE_MARK_ID(id) \
|
||||||
B_CATKEY((id))
|
B_CATKEY((id))
|
||||||
|
|
||||||
#undef B_TRANSLATE_MARK_SYSTEM_NAME
|
#undef B_TRANSLATE_MARK_SYSTEM_NAME
|
||||||
#define B_TRANSLATE_MARK_SYSTEM_NAME(str) \
|
#define B_TRANSLATE_MARK_SYSTEM_NAME(string) \
|
||||||
B_CATKEY((str), B_TRANSLATE_SYSTEM_NAME_CONTEXT, "")
|
B_CATKEY((string), B_TRANSLATE_SYSTEM_NAME_CONTEXT, "")
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_MARK_VOID
|
||||||
|
#define B_TRANSLATE_MARK_VOID(string) \
|
||||||
|
B_CATKEY((string), B_TRANSLATE_CONTEXT)
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_MARK_COMMENT_VOID
|
||||||
|
#define B_TRANSLATE_MARK_COMMENT_VOID(string, comment) \
|
||||||
|
B_CATKEY((string), B_TRANSLATE_CONTEXT, (comment))
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_MARK_ALL_VOID
|
||||||
|
#define B_TRANSLATE_MARK_ALL_VOID(string, context, comment) \
|
||||||
|
B_CATKEY((string), (context), (comment))
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_MARK_ID_VOID
|
||||||
|
#define B_TRANSLATE_MARK_ID_VOID(id) \
|
||||||
|
B_CATKEY((id))
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_MARK_SYSTEM_NAME_VOID
|
||||||
|
#define B_TRANSLATE_MARK_SYSTEM_NAME_VOID(string) \
|
||||||
|
B_CATKEY((string), B_TRANSLATE_SYSTEM_NAME_CONTEXT, "")
|
||||||
|
|
||||||
#undef B_TRANSLATE_NOCOLLECT
|
#undef B_TRANSLATE_NOCOLLECT
|
||||||
#define B_TRANSLATE_NOCOLLECT(str) \
|
#define B_TRANSLATE_NOCOLLECT(string)
|
||||||
(void)
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_NOCOLLECT_COMMENT
|
#undef B_TRANSLATE_NOCOLLECT_COMMENT
|
||||||
#define B_TRANSLATE_NOCOLLECT_COMMENT(str, cmt) \
|
#define B_TRANSLATE_NOCOLLECT_COMMENT(string, comment)
|
||||||
(void)
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_NOCOLLECT_ALL
|
#undef B_TRANSLATE_NOCOLLECT_ALL
|
||||||
#define B_TRANSLATE_NOCOLLECT_ALL(str, ctx, cmt) \
|
#define B_TRANSLATE_NOCOLLECT_ALL(string, context, comment)
|
||||||
(void)
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_NOCOLLECT_ID
|
#undef B_TRANSLATE_NOCOLLECT_ID
|
||||||
#define B_TRANSLATE_NOCOLLECT_ID(id) \
|
#define B_TRANSLATE_NOCOLLECT_ID(id)
|
||||||
(void)
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_NOCOLLECT_SYSTEM_NAME
|
#undef B_TRANSLATE_NOCOLLECT_SYSTEM_NAME
|
||||||
#define B_TRANSLATE_NOCOLLECT_SYSTEM_NAME(str) \
|
#define B_TRANSLATE_NOCOLLECT_SYSTEM_NAME(string)
|
||||||
(void)
|
|
||||||
|
|
||||||
#endif /* B_COLLECTING_CATKEYS */
|
#endif /* B_COLLECTING_CATKEYS */
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
// For BCatalog add-on implementations:
|
|
||||||
// TODO: should go into another header
|
|
||||||
|
|
||||||
class BCatalogAddOn {
|
|
||||||
public:
|
|
||||||
BCatalogAddOn(const char* signature,
|
|
||||||
const char* language,
|
|
||||||
uint32 fingerprint);
|
|
||||||
virtual ~BCatalogAddOn();
|
|
||||||
|
|
||||||
virtual const char* GetString(const char* string,
|
|
||||||
const char* context = NULL,
|
|
||||||
const char* comment = NULL) = 0;
|
|
||||||
virtual const char* GetString(uint32 id) = 0;
|
|
||||||
|
|
||||||
status_t InitCheck() const;
|
|
||||||
BCatalogAddOn* Next();
|
|
||||||
|
|
||||||
// the following could be used to localize non-textual data (e.g.
|
|
||||||
// icons), but these will only be implemented if there's demand for such
|
|
||||||
// a feature:
|
|
||||||
virtual bool CanHaveData() const;
|
|
||||||
virtual status_t GetData(const char* name, BMessage* msg);
|
|
||||||
virtual status_t GetData(uint32 id, BMessage* msg);
|
|
||||||
|
|
||||||
// interface for catalog-editor-app and testing apps:
|
|
||||||
virtual status_t SetString(const char* string,
|
|
||||||
const char* translated,
|
|
||||||
const char* context = NULL,
|
|
||||||
const char* comment = NULL);
|
|
||||||
virtual status_t SetString(int32 id, const char* translated);
|
|
||||||
|
|
||||||
virtual bool CanWriteData() const;
|
|
||||||
virtual status_t SetData(const char* name, BMessage* msg);
|
|
||||||
virtual status_t SetData(uint32 id, BMessage* msg);
|
|
||||||
|
|
||||||
virtual status_t ReadFromFile(const char* path = NULL);
|
|
||||||
virtual status_t ReadFromAttribute(
|
|
||||||
const entry_ref& appOrAddOnRef);
|
|
||||||
virtual status_t ReadFromResource(
|
|
||||||
const entry_ref& appOrAddOnRef);
|
|
||||||
virtual status_t WriteToFile(const char* path = NULL);
|
|
||||||
virtual status_t WriteToAttribute(
|
|
||||||
const entry_ref& appOrAddOnRef);
|
|
||||||
virtual status_t WriteToResource(
|
|
||||||
const entry_ref& appOrAddOnRef);
|
|
||||||
|
|
||||||
virtual void MakeEmpty();
|
|
||||||
virtual int32 CountItems() const;
|
|
||||||
|
|
||||||
// magic marker functions which are used to mark a string/id
|
|
||||||
// which will be translated elsewhere in the code (where it can
|
|
||||||
// not be found since it is references by a variable):
|
|
||||||
static const char* MarkForTranslation(const char* string,
|
|
||||||
const char* context, const char* comment);
|
|
||||||
static int32 MarkForTranslation(int32 id);
|
|
||||||
|
|
||||||
void SetNext(BCatalogAddOn* next);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void UpdateFingerprint();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
friend class BCatalog;
|
|
||||||
friend status_t get_add_on_catalog(BCatalog*, const char*);
|
|
||||||
|
|
||||||
status_t fInitCheck;
|
|
||||||
BString fSignature;
|
|
||||||
BString fLanguageName;
|
|
||||||
uint32 fFingerprint;
|
|
||||||
BCatalogAddOn* fNext;
|
|
||||||
};
|
|
||||||
|
|
||||||
// every catalog-add-on should export these symbols...
|
|
||||||
// ...the function that instantiates a catalog for this add-on-type...
|
|
||||||
extern "C"
|
|
||||||
BCatalogAddOn* instantiate_catalog(const char* signature, const char* language,
|
|
||||||
uint32 fingerprint);
|
|
||||||
|
|
||||||
// ...the function that creates an empty catalog for this add-on-type...
|
|
||||||
extern "C"
|
|
||||||
BCatalogAddOn* create_catalog(const char* signature, const char* language);
|
|
||||||
|
|
||||||
// ...and the priority which will be used to order the catalog-add-ons:
|
|
||||||
extern uint8 gCatalogAddOnPriority;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BCatalog - inlines for trivial accessors:
|
|
||||||
*/
|
|
||||||
inline const char*
|
|
||||||
BCatalog::GetNoAutoCollectString(const char* string, const char* context,
|
|
||||||
const char* comment)
|
|
||||||
{
|
|
||||||
return GetString(string, context, comment);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline const char*
|
|
||||||
BCatalog::GetNoAutoCollectString(uint32 id)
|
|
||||||
{
|
|
||||||
return GetString(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BCatalogAddOn - inlines for trivial accessors:
|
|
||||||
*/
|
|
||||||
inline BCatalogAddOn*
|
|
||||||
BCatalogAddOn::Next()
|
|
||||||
{
|
|
||||||
return fNext;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const char*
|
|
||||||
BCatalogAddOn::MarkForTranslation(const char* str, const char* /* context */,
|
|
||||||
const char* /* comment */)
|
|
||||||
{
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline int32
|
|
||||||
BCatalogAddOn::MarkForTranslation(int32 id)
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _CATALOG_H_ */
|
#endif /* _CATALOG_H_ */
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2012, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _CATALOG_DATA_H_
|
||||||
|
#define _CATALOG_DATA_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
|
class BCatalog;
|
||||||
|
class BMessage;
|
||||||
|
struct entry_ref;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for the catalog-data provided by every catalog add-on. An instance
|
||||||
|
* of this class represents (the data of) a single catalog. Several of these
|
||||||
|
* catalog data objects may be chained together in order to represent
|
||||||
|
* variations of a specific language. If for instance the catalog data 'en_uk'
|
||||||
|
* is chained to the data for 'en', a BCatalog using this catalog data chain
|
||||||
|
* will prefer any entries in the 'en_uk' catalog, but fallback onto 'en' for
|
||||||
|
* entries missing in the former.
|
||||||
|
*/
|
||||||
|
class BCatalogData {
|
||||||
|
public:
|
||||||
|
BCatalogData(const char* signature,
|
||||||
|
const char* language,
|
||||||
|
uint32 fingerprint);
|
||||||
|
virtual ~BCatalogData();
|
||||||
|
|
||||||
|
virtual const char* GetString(const char* string,
|
||||||
|
const char* context = NULL,
|
||||||
|
const char* comment = NULL) = 0;
|
||||||
|
virtual const char* GetString(uint32 id) = 0;
|
||||||
|
|
||||||
|
status_t InitCheck() const;
|
||||||
|
BCatalogData* Next();
|
||||||
|
|
||||||
|
// the following could be used to localize non-textual data (e.g.
|
||||||
|
// icons), but these will only be implemented if there's demand for such
|
||||||
|
// a feature:
|
||||||
|
virtual bool CanHaveData() const;
|
||||||
|
virtual status_t GetData(const char* name, BMessage* msg);
|
||||||
|
virtual status_t GetData(uint32 id, BMessage* msg);
|
||||||
|
|
||||||
|
// interface for catalog-editor-app and testing apps:
|
||||||
|
virtual status_t SetString(const char* string,
|
||||||
|
const char* translated,
|
||||||
|
const char* context = NULL,
|
||||||
|
const char* comment = NULL);
|
||||||
|
virtual status_t SetString(int32 id, const char* translated);
|
||||||
|
|
||||||
|
virtual bool CanWriteData() const;
|
||||||
|
virtual status_t SetData(const char* name, BMessage* msg);
|
||||||
|
virtual status_t SetData(uint32 id, BMessage* msg);
|
||||||
|
|
||||||
|
virtual status_t ReadFromFile(const char* path = NULL);
|
||||||
|
virtual status_t ReadFromAttribute(
|
||||||
|
const entry_ref& appOrAddOnRef);
|
||||||
|
virtual status_t ReadFromResource(
|
||||||
|
const entry_ref& appOrAddOnRef);
|
||||||
|
virtual status_t WriteToFile(const char* path = NULL);
|
||||||
|
virtual status_t WriteToAttribute(
|
||||||
|
const entry_ref& appOrAddOnRef);
|
||||||
|
virtual status_t WriteToResource(
|
||||||
|
const entry_ref& appOrAddOnRef);
|
||||||
|
|
||||||
|
virtual void MakeEmpty();
|
||||||
|
virtual int32 CountItems() const;
|
||||||
|
|
||||||
|
void SetNext(BCatalogData* next);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void UpdateFingerprint();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
friend class BCatalog;
|
||||||
|
friend status_t get_add_on_catalog(BCatalog*, const char*);
|
||||||
|
|
||||||
|
status_t fInitCheck;
|
||||||
|
BString fSignature;
|
||||||
|
BString fLanguageName;
|
||||||
|
uint32 fFingerprint;
|
||||||
|
BCatalogData* fNext;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline BCatalogData*
|
||||||
|
BCatalogData::Next()
|
||||||
|
{
|
||||||
|
return fNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// every catalog-add-on should export the following three symbols:
|
||||||
|
//
|
||||||
|
// 1. the function that instantiates a catalog for this add-on-type
|
||||||
|
extern "C"
|
||||||
|
BCatalogData* instantiate_catalog(const char* signature, const char* language,
|
||||||
|
uint32 fingerprint);
|
||||||
|
|
||||||
|
// 2. the function that creates an empty catalog for this add-on-type
|
||||||
|
extern "C"
|
||||||
|
BCatalogData* create_catalog(const char* signature, const char* language);
|
||||||
|
|
||||||
|
// 3. the priority which will be used to order the catalog add-ons
|
||||||
|
extern uint8 gCatalogAddOnPriority;
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _CATALOG_DATA_H_ */
|
||||||
@@ -46,9 +46,9 @@ class DefaultCatalog : public HashMapCatalog {
|
|||||||
status_t SetRawString(const CatKey& key, const char *translated);
|
status_t SetRawString(const CatKey& key, const char *translated);
|
||||||
void SetSignature(const entry_ref &catalogOwner);
|
void SetSignature(const entry_ref &catalogOwner);
|
||||||
|
|
||||||
static BCatalogAddOn *Instantiate(const entry_ref& catalogOwner,
|
static BCatalogData *Instantiate(const entry_ref& catalogOwner,
|
||||||
const char *language, uint32 fingerprint);
|
const char *language, uint32 fingerprint);
|
||||||
static BCatalogAddOn *Create(const char *signature,
|
static BCatalogData *Create(const char *signature,
|
||||||
const char *language);
|
const char *language);
|
||||||
|
|
||||||
static const uint8 kDefaultCatalogAddOnPriority;
|
static const uint8 kDefaultCatalogAddOnPriority;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
void MakeEmpty();
|
void MakeEmpty();
|
||||||
|
|
||||||
BCatalogAddOn* CatalogAddOn();
|
BCatalogData* CatalogData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EditableCatalog();
|
EditableCatalog();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <Catalog.h>
|
#include <CatalogData.h>
|
||||||
#include <HashMap.h>
|
#include <HashMap.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ class CatKey {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class HashMapCatalog: public BCatalogAddOn {
|
class HashMapCatalog: public BCatalogData {
|
||||||
protected:
|
protected:
|
||||||
uint32 ComputeFingerprint() const;
|
uint32 ComputeFingerprint() const;
|
||||||
typedef HashMap<CatKey, BString> CatMap;
|
typedef HashMap<CatKey, BString> CatMap;
|
||||||
@@ -72,7 +72,7 @@ class HashMapCatalog: public BCatalogAddOn {
|
|||||||
uint32 fingerprint);
|
uint32 fingerprint);
|
||||||
// Constructor for normal use
|
// Constructor for normal use
|
||||||
//
|
//
|
||||||
// overrides of BCatalogAddOn:
|
// overrides of BCatalogData:
|
||||||
const char *GetString(const char *string, const char *context = NULL,
|
const char *GetString(const char *string, const char *context = NULL,
|
||||||
const char *comment = NULL);
|
const char *comment = NULL);
|
||||||
const char *GetString(uint32 id);
|
const char *GetString(uint32 id);
|
||||||
@@ -132,7 +132,7 @@ class HashMapCatalog: public BCatalogAddOn {
|
|||||||
inline HashMapCatalog::HashMapCatalog(const char* signature,
|
inline HashMapCatalog::HashMapCatalog(const char* signature,
|
||||||
const char* language, uint32 fingerprint)
|
const char* language, uint32 fingerprint)
|
||||||
:
|
:
|
||||||
BCatalogAddOn(signature, language, fingerprint)
|
BCatalogData(signature, language, fingerprint)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, Haiku. All rights reserved.
|
* Copyright 2010-2012, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*/
|
*/
|
||||||
#ifndef _MUTABLE_LOCALE_ROSTER_H_
|
#ifndef _MUTABLE_LOCALE_ROSTER_H_
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
class BLocale;
|
class BLocale;
|
||||||
class BCatalog;
|
class BCatalog;
|
||||||
class BCatalogAddOn;
|
class BCatalogData;
|
||||||
|
|
||||||
struct entry_ref;
|
struct entry_ref;
|
||||||
|
|
||||||
@@ -44,28 +44,29 @@ public:
|
|||||||
// the message contains one or more
|
// the message contains one or more
|
||||||
// 'language'-string-fields which
|
// 'language'-string-fields which
|
||||||
// contain the language-name(s)
|
// contain the language-name(s)
|
||||||
status_t SetFilesystemTranslationPreferred(bool preferred);
|
status_t SetFilesystemTranslationPreferred(
|
||||||
|
bool preferred);
|
||||||
|
|
||||||
status_t LoadSystemCatalog(BCatalog* catalog) const;
|
status_t LoadSystemCatalog(BCatalog* catalog) const;
|
||||||
|
|
||||||
BCatalogAddOn* LoadCatalog(const entry_ref& catalogOwner,
|
BCatalogData* LoadCatalog(const entry_ref& catalogOwner,
|
||||||
const char* language = NULL,
|
const char* language = NULL,
|
||||||
int32 fingerprint = 0) const;
|
int32 fingerprint = 0) const;
|
||||||
status_t UnloadCatalog(BCatalogAddOn* addOn);
|
status_t UnloadCatalog(BCatalogData* catalogData);
|
||||||
|
|
||||||
BCatalogAddOn* CreateCatalog(const char* type,
|
BCatalogData* CreateCatalog(const char* type,
|
||||||
const char* signature,
|
const char* signature,
|
||||||
const char* language);
|
const char* language);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef BCatalogAddOn* (*InstantiateCatalogFunc)(const entry_ref& catalogOwner,
|
typedef BCatalogData* (*InstantiateCatalogFunc)(const entry_ref& catalogOwner,
|
||||||
const char* language, uint32 fingerprint);
|
const char* language, uint32 fingerprint);
|
||||||
|
|
||||||
typedef BCatalogAddOn* (*CreateCatalogFunc)(const char* name,
|
typedef BCatalogData* (*CreateCatalogFunc)(const char* name,
|
||||||
const char* language);
|
const char* language);
|
||||||
|
|
||||||
typedef BCatalogAddOn* (*InstantiateEmbeddedCatalogFunc)(
|
typedef BCatalogData* (*InstantiateEmbeddedCatalogFunc)(
|
||||||
entry_ref* appOrAddOnRef);
|
entry_ref* appOrAddOnRef);
|
||||||
|
|
||||||
typedef status_t (*GetAvailableLanguagesFunc)(BMessage*, const char*,
|
typedef status_t (*GetAvailableLanguagesFunc)(BMessage*, const char*,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class PlainTextCatalog : public HashMapCatalog {
|
|||||||
status_t ReadFromFile(const char *path = NULL);
|
status_t ReadFromFile(const char *path = NULL);
|
||||||
status_t WriteToFile(const char *path = NULL);
|
status_t WriteToFile(const char *path = NULL);
|
||||||
|
|
||||||
static BCatalogAddOn *Instantiate(const char *signature,
|
static BCatalogData *Instantiate(const char *signature,
|
||||||
const char *language, uint32 fingerprint);
|
const char *language, uint32 fingerprint);
|
||||||
|
|
||||||
static const char *kCatMimeType;
|
static const char *kCatMimeType;
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ PlainTextCatalog::UpdateAttributes(const char* path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCatalogAddOn *
|
BCatalogData *
|
||||||
PlainTextCatalog::Instantiate(const char *signature, const char *language,
|
PlainTextCatalog::Instantiate(const char *signature, const char *language,
|
||||||
uint32 fingerprint)
|
uint32 fingerprint)
|
||||||
{
|
{
|
||||||
@@ -410,7 +410,7 @@ PlainTextCatalog::Instantiate(const char *signature, const char *language,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" BCatalogAddOn *
|
extern "C" BCatalogData *
|
||||||
instantiate_catalog(const char *signature, const char *language,
|
instantiate_catalog(const char *signature, const char *language,
|
||||||
uint32 fingerprint)
|
uint32 fingerprint)
|
||||||
{
|
{
|
||||||
@@ -424,7 +424,7 @@ instantiate_catalog(const char *signature, const char *language,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" BCatalogAddOn *
|
extern "C" BCatalogData *
|
||||||
create_catalog(const char *signature, const char *language)
|
create_catalog(const char *signature, const char *language)
|
||||||
{
|
{
|
||||||
PlainTextCatalog *catalog
|
PlainTextCatalog *catalog
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ FlurryView::FlurryView(BRect bounds)
|
|||||||
fOldFrameTime(-1.0),
|
fOldFrameTime(-1.0),
|
||||||
fFlurryInfo_t(NULL)
|
fFlurryInfo_t(NULL)
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("Flurry");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("Flurry");
|
||||||
|
|
||||||
fWidth = bounds.Width();
|
fWidth = bounds.Width();
|
||||||
fHeight = bounds.Height();
|
fHeight = bounds.Height();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ Clock::Clock(BMessage *message, image_id image)
|
|||||||
:
|
:
|
||||||
BScreenSaver(message, image)
|
BScreenSaver(message, image)
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("SimpleClock");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("SimpleClock");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ SlideShowSaver::SlideShowSaver(BMessage *archive, image_id image)
|
|||||||
:
|
:
|
||||||
BScreenSaver(archive, image), fLock("SlideShow Lock")
|
BScreenSaver(archive, image), fLock("SlideShow Lock")
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("SlideShowSaver");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("SlideShowSaver");
|
||||||
|
|
||||||
fNewDirectory = true;
|
fNewDirectory = true;
|
||||||
fBitmap = NULL;
|
fBitmap = NULL;
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ private:
|
|||||||
AboutApp::AboutApp()
|
AboutApp::AboutApp()
|
||||||
: BApplication("application/x-vnd.Haiku-About")
|
: BApplication("application/x-vnd.Haiku-About")
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("AboutSystem");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("AboutSystem");
|
||||||
|
|
||||||
AboutWindow *window = new(std::nothrow) AboutWindow();
|
AboutWindow *window = new(std::nothrow) AboutWindow();
|
||||||
if (window)
|
if (window)
|
||||||
|
|||||||
@@ -41,15 +41,13 @@ const char* kCategoryString[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// This list is only used to translate Device properties
|
// This list is only used to translate Device properties
|
||||||
static const char* kTranslateMarkString[] = {
|
B_TRANSLATE_MARK_VOID("unknown");
|
||||||
B_TRANSLATE_MARK("unknown"),
|
B_TRANSLATE_MARK_VOID("Device");
|
||||||
B_TRANSLATE_MARK("Device"),
|
B_TRANSLATE_MARK_VOID("Computer");
|
||||||
B_TRANSLATE_MARK("Computer"),
|
B_TRANSLATE_MARK_VOID("ACPI bus");
|
||||||
B_TRANSLATE_MARK("ACPI bus"),
|
B_TRANSLATE_MARK_VOID("PCI bus");
|
||||||
B_TRANSLATE_MARK("PCI bus"),
|
B_TRANSLATE_MARK_VOID("ISA bus");
|
||||||
B_TRANSLATE_MARK("ISA bus"),
|
B_TRANSLATE_MARK_VOID("Unknown device");
|
||||||
B_TRANSLATE_MARK("Unknown device")
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Device::Device(Device* physicalParent, BusType busType, Category category,
|
Device::Device(Device* physicalParent, BusType busType, Category category,
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ TPeopleApp::TPeopleApp()
|
|||||||
fWindowCount(0),
|
fWindowCount(0),
|
||||||
fAttributes(20, true)
|
fAttributes(20, true)
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("People");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("People");
|
||||||
|
|
||||||
fPosition.Set(6, TITLE_BAR_HEIGHT, 6 + WIND_WIDTH,
|
fPosition.Set(6, TITLE_BAR_HEIGHT, 6 + WIND_WIDTH,
|
||||||
TITLE_BAR_HEIGHT + WIND_HEIGHT);
|
TITLE_BAR_HEIGHT + WIND_HEIGHT);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ ShowImageApp::ShowImageApp()
|
|||||||
fPulseStarted(false),
|
fPulseStarted(false),
|
||||||
fLastWindowFrame(BRect(30, 30, 430, 330))
|
fLastWindowFrame(BRect(30, 30, 430, 330))
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("ShowImage");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("ShowImage");
|
||||||
_UpdateLastWindowFrame();
|
_UpdateLastWindowFrame();
|
||||||
// BBitmap can be created after there is a BApplication instance.
|
// BBitmap can be created after there is a BApplication instance.
|
||||||
init_tool_bar_icons();
|
init_tool_bar_icons();
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ StyledEditApp::StyledEditApp()
|
|||||||
BApplication(APP_SIGNATURE),
|
BApplication(APP_SIGNATURE),
|
||||||
fOpenPanel(NULL)
|
fOpenPanel(NULL)
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("StyledEdit");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("StyledEdit");
|
||||||
|
|
||||||
fOpenPanel = new BFilePanel();
|
fOpenPanel = new BFilePanel();
|
||||||
fOpenAsEncoding = 0;
|
fOpenAsEncoding = 0;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ int main(int , char **)
|
|||||||
SetNewLeakChecking(true);
|
SetNewLeakChecking(true);
|
||||||
SetMallocLeakChecking(true);
|
SetMallocLeakChecking(true);
|
||||||
#endif
|
#endif
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("Tracker");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("Tracker");
|
||||||
|
|
||||||
TTracker tracker;
|
TTracker tracker;
|
||||||
tracker.Run();
|
tracker.Run();
|
||||||
|
|||||||
@@ -46,9 +46,9 @@
|
|||||||
#undef B_TRANSLATE_CONTEXT
|
#undef B_TRANSLATE_CONTEXT
|
||||||
#define B_TRANSLATE_CONTEXT "MainWin"
|
#define B_TRANSLATE_CONTEXT "MainWin"
|
||||||
|
|
||||||
static const char* fLocalizedName = B_TRANSLATE_MARK("TV");
|
B_TRANSLATE_MARK_VOID("TV");
|
||||||
static const char* fLocalizedRevision = B_TRANSLATE_MARK("unknown");
|
B_TRANSLATE_MARK_VOID("unknown");
|
||||||
static const char* fLocalizedInfo1 = B_TRANSLATE_MARK("DVB - Digital Video Broadcasting TV");
|
B_TRANSLATE_MARK_VOID("DVB - Digital Video Broadcasting TV");
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ BView* instantiate_deskbar_item()
|
|||||||
|
|
||||||
WatchApp::WatchApp() : BApplication(APP_SIGNATURE)
|
WatchApp::WatchApp() : BApplication(APP_SIGNATURE)
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("WebWatch");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("WebWatch");
|
||||||
|
|
||||||
// Here we tell the Deskbar that we want to add a new replicant, and
|
// Here we tell the Deskbar that we want to add a new replicant, and
|
||||||
// where it can find this replicant (in our app). Because we only run
|
// where it can find this replicant (in our app). Because we only run
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ main(int argc, char **argv)
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
DefaultCatalog* inputCatImpl
|
DefaultCatalog* inputCatImpl
|
||||||
= dynamic_cast<DefaultCatalog*>(inputCatalog.CatalogAddOn());
|
= dynamic_cast<DefaultCatalog*>(inputCatalog.CatalogData());
|
||||||
if (!inputCatImpl) {
|
if (!inputCatImpl) {
|
||||||
fprintf(stderr, "couldn't access impl of input-catalog %s\n",
|
fprintf(stderr, "couldn't access impl of input-catalog %s\n",
|
||||||
inputFile);
|
inputFile);
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ main(int argc, char **argv)
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
DefaultCatalog* targetCatImpl
|
DefaultCatalog* targetCatImpl
|
||||||
= dynamic_cast<DefaultCatalog*>(targetCatalog.CatalogAddOn());
|
= dynamic_cast<DefaultCatalog*>(targetCatalog.CatalogData());
|
||||||
if (!targetCatImpl) {
|
if (!targetCatImpl) {
|
||||||
fprintf(stderr, "couldn't access impl of target-catalog %s\n",
|
fprintf(stderr, "couldn't access impl of target-catalog %s\n",
|
||||||
outputFile.String());
|
outputFile.String());
|
||||||
@@ -116,7 +116,7 @@ main(int argc, char **argv)
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
HashMapCatalog* inputCatImpl
|
HashMapCatalog* inputCatImpl
|
||||||
= dynamic_cast<HashMapCatalog*>(inputCatalog.CatalogAddOn());
|
= dynamic_cast<HashMapCatalog*>(inputCatalog.CatalogData());
|
||||||
if (!inputCatImpl) {
|
if (!inputCatImpl) {
|
||||||
fprintf(stderr, "couldn't access impl of input-catalog %s\n",
|
fprintf(stderr, "couldn't access impl of input-catalog %s\n",
|
||||||
inputFiles[i]);
|
inputFiles[i]);
|
||||||
|
|||||||
+20
-173
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
|
#include <CatalogData.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <MutableLocaleRoster.h>
|
#include <MutableLocaleRoster.h>
|
||||||
#include <Node.h>
|
#include <Node.h>
|
||||||
@@ -22,7 +23,7 @@ using BPrivate::MutableLocaleRoster;
|
|||||||
//#pragma mark - BCatalog
|
//#pragma mark - BCatalog
|
||||||
BCatalog::BCatalog()
|
BCatalog::BCatalog()
|
||||||
:
|
:
|
||||||
fCatalog(NULL),
|
fCatalogData(NULL),
|
||||||
fLock("Catalog")
|
fLock("Catalog")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -31,7 +32,7 @@ BCatalog::BCatalog()
|
|||||||
BCatalog::BCatalog(const entry_ref& catalogOwner, const char* language,
|
BCatalog::BCatalog(const entry_ref& catalogOwner, const char* language,
|
||||||
uint32 fingerprint)
|
uint32 fingerprint)
|
||||||
:
|
:
|
||||||
fCatalog(NULL),
|
fCatalogData(NULL),
|
||||||
fLock("Catalog")
|
fLock("Catalog")
|
||||||
{
|
{
|
||||||
SetTo(catalogOwner, language, fingerprint);
|
SetTo(catalogOwner, language, fingerprint);
|
||||||
@@ -40,7 +41,7 @@ BCatalog::BCatalog(const entry_ref& catalogOwner, const char* language,
|
|||||||
|
|
||||||
BCatalog::~BCatalog()
|
BCatalog::~BCatalog()
|
||||||
{
|
{
|
||||||
MutableLocaleRoster::Default()->UnloadCatalog(fCatalog);
|
MutableLocaleRoster::Default()->UnloadCatalog(fCatalogData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ BCatalog::GetString(const char* string, const char* context,
|
|||||||
return string;
|
return string;
|
||||||
|
|
||||||
const char* translated;
|
const char* translated;
|
||||||
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
|
for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
|
||||||
translated = cat->GetString(string, context, comment);
|
translated = cat->GetString(string, context, comment);
|
||||||
if (translated != NULL)
|
if (translated != NULL)
|
||||||
return translated;
|
return translated;
|
||||||
@@ -71,7 +72,7 @@ BCatalog::GetString(uint32 id)
|
|||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char* translated;
|
const char* translated;
|
||||||
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
|
for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
|
||||||
translated = cat->GetString(id);
|
translated = cat->GetString(id);
|
||||||
if (translated != NULL)
|
if (translated != NULL)
|
||||||
return translated;
|
return translated;
|
||||||
@@ -88,11 +89,11 @@ BCatalog::GetData(const char* name, BMessage* msg)
|
|||||||
if (!lock.IsLocked())
|
if (!lock.IsLocked())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
status_t res;
|
status_t res;
|
||||||
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
|
for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
|
||||||
res = cat->GetData(name, msg);
|
res = cat->GetData(name, msg);
|
||||||
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
|
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
|
||||||
return res; // return B_OK if found, or specific error-code
|
return res; // return B_OK if found, or specific error-code
|
||||||
@@ -109,11 +110,11 @@ BCatalog::GetData(uint32 id, BMessage* msg)
|
|||||||
if (!lock.IsLocked())
|
if (!lock.IsLocked())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
status_t res;
|
status_t res;
|
||||||
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
|
for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
|
||||||
res = cat->GetData(id, msg);
|
res = cat->GetData(id, msg);
|
||||||
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
|
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
|
||||||
return res; // return B_OK if found, or specific error-code
|
return res; // return B_OK if found, or specific error-code
|
||||||
@@ -133,10 +134,10 @@ BCatalog::GetSignature(BString* sig)
|
|||||||
if (sig == NULL)
|
if (sig == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
*sig = fCatalog->fSignature;
|
*sig = fCatalogData->fSignature;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -152,10 +153,10 @@ BCatalog::GetLanguage(BString* lang)
|
|||||||
if (lang == NULL)
|
if (lang == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
*lang = fCatalog->fLanguageName;
|
*lang = fCatalogData->fLanguageName;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -171,10 +172,10 @@ BCatalog::GetFingerprint(uint32* fp)
|
|||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
*fp = fCatalog->fFingerprint;
|
*fp = fCatalogData->fFingerprint;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -188,8 +189,8 @@ BCatalog::SetTo(const entry_ref& catalogOwner, const char* language,
|
|||||||
if (!lock.IsLocked())
|
if (!lock.IsLocked())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
MutableLocaleRoster::Default()->UnloadCatalog(fCatalog);
|
MutableLocaleRoster::Default()->UnloadCatalog(fCatalogData);
|
||||||
fCatalog = MutableLocaleRoster::Default()->LoadCatalog(catalogOwner,
|
fCatalogData = MutableLocaleRoster::Default()->LoadCatalog(catalogOwner,
|
||||||
language, fingerprint);
|
language, fingerprint);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -203,7 +204,7 @@ BCatalog::InitCheck() const
|
|||||||
if (!lock.IsLocked())
|
if (!lock.IsLocked())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
return fCatalog != NULL ? fCatalog->InitCheck() : B_NO_INIT;
|
return fCatalogData != NULL ? fCatalogData->InitCheck() : B_NO_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -214,159 +215,5 @@ BCatalog::CountItems() const
|
|||||||
if (!lock.IsLocked())
|
if (!lock.IsLocked())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return fCatalog != NULL ? fCatalog->CountItems() : 0;
|
return fCatalogData != NULL ? fCatalogData->CountItems() : 0;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//#pragma mark - BCatalogAddOn
|
|
||||||
BCatalogAddOn::BCatalogAddOn(const char* signature, const char* language,
|
|
||||||
uint32 fingerprint)
|
|
||||||
:
|
|
||||||
fInitCheck(B_NO_INIT),
|
|
||||||
fSignature(signature),
|
|
||||||
fLanguageName(language),
|
|
||||||
fFingerprint(fingerprint),
|
|
||||||
fNext(NULL)
|
|
||||||
{
|
|
||||||
fLanguageName.ToLower();
|
|
||||||
// canonicalize language-name to lowercase
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BCatalogAddOn::~BCatalogAddOn()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BCatalogAddOn::UpdateFingerprint()
|
|
||||||
{
|
|
||||||
fFingerprint = 0;
|
|
||||||
// base implementation always yields the same fingerprint,
|
|
||||||
// which means that no version-mismatch detection is possible.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::InitCheck() const
|
|
||||||
{
|
|
||||||
return fInitCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
BCatalogAddOn::CanHaveData() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::GetData(const char* name, BMessage* msg)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::GetData(uint32 id, BMessage* msg)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::SetString(const char* string, const char* translated,
|
|
||||||
const char* context, const char* comment)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::SetString(int32 id, const char* translated)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
BCatalogAddOn::CanWriteData() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::SetData(const char* name, BMessage* msg)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::SetData(uint32 id, BMessage* msg)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::ReadFromFile(const char* path)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::ReadFromAttribute(const entry_ref& appOrAddOnRef)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::ReadFromResource(const entry_ref& appOrAddOnRef)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::WriteToFile(const char* path)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::WriteToAttribute(const entry_ref& appOrAddOnRef)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::WriteToResource(const entry_ref& appOrAddOnRef)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BCatalogAddOn::MakeEmpty()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32
|
|
||||||
BCatalogAddOn::CountItems() const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BCatalogAddOn::SetNext(BCatalogAddOn* next)
|
|
||||||
{
|
|
||||||
fNext = next;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,160 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de
|
||||||
|
* Copyright 2003-2004,2012, Oliver Tappe, zooey@hirschkaefer.de
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <CatalogData.h>
|
||||||
|
|
||||||
|
|
||||||
|
BCatalogData::BCatalogData(const char* signature, const char* language,
|
||||||
|
uint32 fingerprint)
|
||||||
|
:
|
||||||
|
fInitCheck(B_NO_INIT),
|
||||||
|
fSignature(signature),
|
||||||
|
fLanguageName(language),
|
||||||
|
fFingerprint(fingerprint),
|
||||||
|
fNext(NULL)
|
||||||
|
{
|
||||||
|
fLanguageName.ToLower();
|
||||||
|
// canonicalize language-name to lowercase
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BCatalogData::~BCatalogData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BCatalogData::UpdateFingerprint()
|
||||||
|
{
|
||||||
|
fFingerprint = 0;
|
||||||
|
// base implementation always yields the same fingerprint,
|
||||||
|
// which means that no version-mismatch detection is possible.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::InitCheck() const
|
||||||
|
{
|
||||||
|
return fInitCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BCatalogData::CanHaveData() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::GetData(const char* name, BMessage* msg)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::GetData(uint32 id, BMessage* msg)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::SetString(const char* string, const char* translated,
|
||||||
|
const char* context, const char* comment)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::SetString(int32 id, const char* translated)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BCatalogData::CanWriteData() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::SetData(const char* name, BMessage* msg)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::SetData(uint32 id, BMessage* msg)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::ReadFromFile(const char* path)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::ReadFromAttribute(const entry_ref& appOrAddOnRef)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::ReadFromResource(const entry_ref& appOrAddOnRef)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::WriteToFile(const char* path)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::WriteToAttribute(const entry_ref& appOrAddOnRef)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::WriteToResource(const entry_ref& appOrAddOnRef)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BCatalogData::MakeEmpty()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
BCatalogData::CountItems() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BCatalogData::SetNext(BCatalogData* next)
|
||||||
|
{
|
||||||
|
fNext = next;
|
||||||
|
}
|
||||||
@@ -593,7 +593,7 @@ DefaultCatalog::Unflatten(BDataIO *dataIO)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCatalogAddOn *
|
BCatalogData *
|
||||||
DefaultCatalog::Instantiate(const entry_ref &catalogOwner, const char *language,
|
DefaultCatalog::Instantiate(const entry_ref &catalogOwner, const char *language,
|
||||||
uint32 fingerprint)
|
uint32 fingerprint)
|
||||||
{
|
{
|
||||||
@@ -607,7 +607,7 @@ DefaultCatalog::Instantiate(const entry_ref &catalogOwner, const char *language,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCatalogAddOn *
|
BCatalogData *
|
||||||
DefaultCatalog::Create(const char *signature, const char *language)
|
DefaultCatalog::Create(const char *signature, const char *language)
|
||||||
{
|
{
|
||||||
DefaultCatalog *catalog
|
DefaultCatalog *catalog
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <EditableCatalog.h>
|
#include <EditableCatalog.h>
|
||||||
|
|
||||||
|
#include <CatalogData.h>
|
||||||
#include <MutableLocaleRoster.h>
|
#include <MutableLocaleRoster.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -16,8 +17,8 @@ namespace BPrivate {
|
|||||||
EditableCatalog::EditableCatalog(const char* type, const char* signature,
|
EditableCatalog::EditableCatalog(const char* type, const char* signature,
|
||||||
const char* language)
|
const char* language)
|
||||||
{
|
{
|
||||||
fCatalog = MutableLocaleRoster::Default()->CreateCatalog(type, signature,
|
fCatalogData = MutableLocaleRoster::Default()->CreateCatalog(type,
|
||||||
language);
|
signature, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -30,124 +31,124 @@ status_t
|
|||||||
EditableCatalog::SetString(const char* string, const char* translated,
|
EditableCatalog::SetString(const char* string, const char* translated,
|
||||||
const char* context, const char* comment)
|
const char* context, const char* comment)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->SetString(string, translated, context, comment);
|
return fCatalogData->SetString(string, translated, context, comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EditableCatalog::SetString(int32 id, const char* translated)
|
EditableCatalog::SetString(int32 id, const char* translated)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->SetString(id, translated);
|
return fCatalogData->SetString(id, translated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
EditableCatalog::CanWriteData() const
|
EditableCatalog::CanWriteData() const
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return fCatalog->CanWriteData();
|
return fCatalogData->CanWriteData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EditableCatalog::SetData(const char* name, BMessage* msg)
|
EditableCatalog::SetData(const char* name, BMessage* msg)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->SetData(name, msg);
|
return fCatalogData->SetData(name, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EditableCatalog::SetData(uint32 id, BMessage* msg)
|
EditableCatalog::SetData(uint32 id, BMessage* msg)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->SetData(id, msg);
|
return fCatalogData->SetData(id, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EditableCatalog::ReadFromFile(const char* path)
|
EditableCatalog::ReadFromFile(const char* path)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->ReadFromFile(path);
|
return fCatalogData->ReadFromFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EditableCatalog::ReadFromAttribute(const entry_ref& appOrAddOnRef)
|
EditableCatalog::ReadFromAttribute(const entry_ref& appOrAddOnRef)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->ReadFromAttribute(appOrAddOnRef);
|
return fCatalogData->ReadFromAttribute(appOrAddOnRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EditableCatalog::ReadFromResource(const entry_ref& appOrAddOnRef)
|
EditableCatalog::ReadFromResource(const entry_ref& appOrAddOnRef)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->ReadFromResource(appOrAddOnRef);
|
return fCatalogData->ReadFromResource(appOrAddOnRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EditableCatalog::WriteToFile(const char* path)
|
EditableCatalog::WriteToFile(const char* path)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->WriteToFile(path);
|
return fCatalogData->WriteToFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EditableCatalog::WriteToAttribute(const entry_ref& appOrAddOnRef)
|
EditableCatalog::WriteToAttribute(const entry_ref& appOrAddOnRef)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->WriteToAttribute(appOrAddOnRef);
|
return fCatalogData->WriteToAttribute(appOrAddOnRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EditableCatalog::WriteToResource(const entry_ref& appOrAddOnRef)
|
EditableCatalog::WriteToResource(const entry_ref& appOrAddOnRef)
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fCatalog->WriteToResource(appOrAddOnRef);
|
return fCatalogData->WriteToResource(appOrAddOnRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EditableCatalog::MakeEmpty()
|
void EditableCatalog::MakeEmpty()
|
||||||
{
|
{
|
||||||
if (fCatalog == NULL)
|
if (fCatalogData == NULL)
|
||||||
fCatalog->MakeEmpty();
|
fCatalogData->MakeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCatalogAddOn*
|
BCatalogData*
|
||||||
EditableCatalog::CatalogAddOn()
|
EditableCatalog::CatalogData()
|
||||||
{
|
{
|
||||||
return fCatalog;
|
return fCatalogData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace BPrivate {
|
|||||||
* reading and writing the catalog to a file. Classes doing that are
|
* reading and writing the catalog to a file. Classes doing that are
|
||||||
* HashMapCatalog and PlainTextCatalog.
|
* HashMapCatalog and PlainTextCatalog.
|
||||||
* If you ever need to create a catalog not built around an hash map, inherit
|
* If you ever need to create a catalog not built around an hash map, inherit
|
||||||
* BCatalogAddOn instead. Note that in this case you will not be able to use our
|
* BCatalogData instead. Note that in this case you will not be able to use our
|
||||||
* development tools anymore.
|
* development tools anymore.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ UsePublicHeaders locale storage ;
|
|||||||
local sources =
|
local sources =
|
||||||
cat.cpp
|
cat.cpp
|
||||||
Catalog.cpp
|
Catalog.cpp
|
||||||
|
CatalogData.cpp
|
||||||
Collator.cpp
|
Collator.cpp
|
||||||
Country.cpp
|
Country.cpp
|
||||||
DefaultCatalog.cpp
|
DefaultCatalog.cpp
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2010, Haiku. All rights reserved.
|
* Copyright 2003-2012, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -67,8 +67,8 @@ CatalogAddOnInfo::~CatalogAddOnInfo()
|
|||||||
{
|
{
|
||||||
int32 count = fLoadedCatalogs.CountItems();
|
int32 count = fLoadedCatalogs.CountItems();
|
||||||
for (int32 i = 0; i < count; ++i) {
|
for (int32 i = 0; i < count; ++i) {
|
||||||
BCatalogAddOn* cat
|
BCatalogData* cat
|
||||||
= static_cast<BCatalogAddOn*>(fLoadedCatalogs.ItemAt(i));
|
= static_cast<BCatalogData*>(fLoadedCatalogs.ItemAt(i));
|
||||||
delete cat;
|
delete cat;
|
||||||
}
|
}
|
||||||
fLoadedCatalogs.MakeEmpty();
|
fLoadedCatalogs.MakeEmpty();
|
||||||
@@ -817,7 +817,7 @@ MutableLocaleRoster::LoadSystemCatalog(BCatalog* catalog) const
|
|||||||
* Any created catalog will be initialized with the given signature and
|
* Any created catalog will be initialized with the given signature and
|
||||||
* language-name.
|
* language-name.
|
||||||
*/
|
*/
|
||||||
BCatalogAddOn*
|
BCatalogData*
|
||||||
MutableLocaleRoster::CreateCatalog(const char* type, const char* signature,
|
MutableLocaleRoster::CreateCatalog(const char* type, const char* signature,
|
||||||
const char* language)
|
const char* language)
|
||||||
{
|
{
|
||||||
@@ -836,7 +836,7 @@ MutableLocaleRoster::CreateCatalog(const char* type, const char* signature,
|
|||||||
|| !info->fCreateFunc)
|
|| !info->fCreateFunc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BCatalogAddOn* catalog = info->fCreateFunc(signature, language);
|
BCatalogData* catalog = info->fCreateFunc(signature, language);
|
||||||
if (catalog) {
|
if (catalog) {
|
||||||
info->fLoadedCatalogs.AddItem(catalog);
|
info->fLoadedCatalogs.AddItem(catalog);
|
||||||
info->UnloadIfPossible();
|
info->UnloadIfPossible();
|
||||||
@@ -858,7 +858,7 @@ MutableLocaleRoster::CreateCatalog(const char* type, const char* signature,
|
|||||||
* instead of a single catalog.
|
* instead of a single catalog.
|
||||||
* NULL is returned if no matching catalog could be found.
|
* NULL is returned if no matching catalog could be found.
|
||||||
*/
|
*/
|
||||||
BCatalogAddOn*
|
BCatalogData*
|
||||||
MutableLocaleRoster::LoadCatalog(const entry_ref& catalogOwner,
|
MutableLocaleRoster::LoadCatalog(const entry_ref& catalogOwner,
|
||||||
const char* language, int32 fingerprint) const
|
const char* language, int32 fingerprint) const
|
||||||
{
|
{
|
||||||
@@ -881,7 +881,7 @@ MutableLocaleRoster::LoadCatalog(const entry_ref& catalogOwner,
|
|||||||
// try to load catalogs for one of the preferred languages:
|
// try to load catalogs for one of the preferred languages:
|
||||||
GetPreferredLanguages(&languages);
|
GetPreferredLanguages(&languages);
|
||||||
|
|
||||||
BCatalogAddOn* catalog = NULL;
|
BCatalogData* catalog = NULL;
|
||||||
const char* lang;
|
const char* lang;
|
||||||
for (int32 l=0; languages.FindString("language", l, &lang)==B_OK; ++l) {
|
for (int32 l=0; languages.FindString("language", l, &lang)==B_OK; ++l) {
|
||||||
catalog = info->fInstantiateFunc(catalogOwner, lang, fingerprint);
|
catalog = info->fInstantiateFunc(catalogOwner, lang, fingerprint);
|
||||||
@@ -895,8 +895,8 @@ MutableLocaleRoster::LoadCatalog(const entry_ref& catalogOwner,
|
|||||||
// to "english"):
|
// to "english"):
|
||||||
int32 pos;
|
int32 pos;
|
||||||
BString langName(lang);
|
BString langName(lang);
|
||||||
BCatalogAddOn* currCatalog = catalog;
|
BCatalogData* currCatalog = catalog;
|
||||||
BCatalogAddOn* nextCatalog = NULL;
|
BCatalogData* nextCatalog = NULL;
|
||||||
while ((pos = langName.FindLast('_')) >= 0) {
|
while ((pos = langName.FindLast('_')) >= 0) {
|
||||||
// language is based on parent, so we load that, too:
|
// language is based on parent, so we load that, too:
|
||||||
// (even if the parent catalog was not found)
|
// (even if the parent catalog was not found)
|
||||||
@@ -928,7 +928,7 @@ MutableLocaleRoster::LoadCatalog(const entry_ref& catalogOwner,
|
|||||||
* Add-ons that have no more current catalogs are unloaded, too.
|
* Add-ons that have no more current catalogs are unloaded, too.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
MutableLocaleRoster::UnloadCatalog(BCatalogAddOn* catalog)
|
MutableLocaleRoster::UnloadCatalog(BCatalogData* catalog)
|
||||||
{
|
{
|
||||||
if (!catalog)
|
if (!catalog)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -938,7 +938,7 @@ MutableLocaleRoster::UnloadCatalog(BCatalogAddOn* catalog)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
status_t res = B_ERROR;
|
status_t res = B_ERROR;
|
||||||
BCatalogAddOn* nextCatalog;
|
BCatalogData* nextCatalog;
|
||||||
|
|
||||||
while (catalog != NULL) {
|
while (catalog != NULL) {
|
||||||
nextCatalog = catalog->Next();
|
nextCatalog = catalog->Next();
|
||||||
|
|||||||
@@ -42,18 +42,16 @@ extern "C" _EXPORT BView *instantiate_deskbar_item(void);
|
|||||||
* and then collectcatkeys will not see the strings in the file.
|
* and then collectcatkeys will not see the strings in the file.
|
||||||
* So we mark them explicitly here.
|
* So we mark them explicitly here.
|
||||||
*/
|
*/
|
||||||
void notUsed() {
|
B_TRANSLATE_MARK_VOID("Dynamic performance");
|
||||||
B_TRANSLATE_MARK("Dynamic performance");
|
B_TRANSLATE_MARK_VOID("High performance");
|
||||||
B_TRANSLATE_MARK("High performance");
|
B_TRANSLATE_MARK_VOID("Low energy");
|
||||||
B_TRANSLATE_MARK("Low energy");
|
B_TRANSLATE_MARK_VOID("Set state");
|
||||||
B_TRANSLATE_MARK("Set state");
|
B_TRANSLATE_MARK_VOID("CPUFrequency\n"
|
||||||
B_TRANSLATE_MARK("CPUFrequency\n"
|
"\twritten by Clemens Zeidler\n"
|
||||||
"\twritten by Clemens Zeidler\n"
|
"\tCopyright 2009, Haiku, Inc.\n");
|
||||||
"\tCopyright 2009, Haiku, Inc.\n");
|
B_TRANSLATE_MARK_VOID("Ok");
|
||||||
B_TRANSLATE_MARK("Ok");
|
B_TRANSLATE_MARK_VOID("Open Speedstep preferences" B_UTF8_ELLIPSIS);
|
||||||
B_TRANSLATE_MARK("Open Speedstep preferences" B_UTF8_ELLIPSIS);
|
B_TRANSLATE_MARK_VOID("Quit");
|
||||||
B_TRANSLATE_MARK("Quit");
|
|
||||||
}
|
|
||||||
|
|
||||||
// messages FrequencySwitcher
|
// messages FrequencySwitcher
|
||||||
const uint32 kMsgDynamicPolicyPulse = '&dpp';
|
const uint32 kMsgDynamicPolicyPulse = '&dpp';
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("Deskbar");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("Deskbar");
|
||||||
BApplication app("application/x-vnd.Haiku-DeskbarPreferences");
|
BApplication app("application/x-vnd.Haiku-DeskbarPreferences");
|
||||||
be_roster->Launch("application/x-vnd.Be-TSKB", new BMessage(kConfigShow));
|
be_roster->Launch("application/x-vnd.Be-TSKB", new BMessage(kConfigShow));
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
B_TRANSLATE_MARK_SYSTEM_NAME("Tracker");
|
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("Tracker");
|
||||||
BApplication app("application/x-vnd.Haiku-TrackerPreferences");
|
BApplication app("application/x-vnd.Haiku-TrackerPreferences");
|
||||||
|
|
||||||
// launch Tracker if it's not running
|
// launch Tracker if it's not running
|
||||||
|
|||||||
+25
-173
@@ -1,61 +1,52 @@
|
|||||||
/*
|
/*
|
||||||
** Distributed under the terms of the OpenBeOS License.
|
** Distributed under the terms of the OpenBeOS License.
|
||||||
** Copyright 2003-2004. All rights reserved.
|
** Copyright 2003-2004,2012. All rights reserved.
|
||||||
**
|
**
|
||||||
** Authors: Axel Dörfler, axeld@pinc-software.de
|
** Authors: Axel Dörfler, axeld@pinc-software.de
|
||||||
** Oliver Tappe, zooey@hirschkaefer.de
|
** Oliver Tappe, zooey@hirschkaefer.de
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <syslog.h>
|
|
||||||
|
|
||||||
#include <Application.h>
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <Locale.h>
|
#include <CatalogData.h>
|
||||||
#include <LocaleRoster.h>
|
|
||||||
#include <Node.h>
|
|
||||||
#include <Roster.h>
|
|
||||||
|
|
||||||
|
|
||||||
BCatalog* be_catalog = NULL;
|
// Provides an implementation of BCatalog for the build host, in effect only
|
||||||
// catalog used by translation macros
|
// supporting setting and getting of catalog entries.
|
||||||
BCatalog* be_app_catalog = NULL;
|
|
||||||
// app-catalog (useful for accessing app's catalog from inside an add-on,
|
|
||||||
// since in an add-on, be_catalog will hold the add-on's catalog.
|
|
||||||
|
|
||||||
|
|
||||||
//#pragma mark - BCatalog
|
|
||||||
BCatalog::BCatalog()
|
BCatalog::BCatalog()
|
||||||
:
|
:
|
||||||
fCatalog(NULL)
|
fCatalogData(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCatalog::BCatalog(const entry_ref& catalogOwner, const char *language,
|
BCatalog::BCatalog(const entry_ref& catalogOwner, const char *language,
|
||||||
uint32 fingerprint)
|
uint32 fingerprint)
|
||||||
|
:
|
||||||
|
fCatalogData(NULL)
|
||||||
{
|
{
|
||||||
// Unsupported - the build tools can't (and don't need to) load anything
|
|
||||||
// this way.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCatalog::~BCatalog()
|
BCatalog::~BCatalog()
|
||||||
{
|
{
|
||||||
if (be_catalog == this)
|
|
||||||
be_app_catalog = be_catalog = NULL;
|
|
||||||
//be_locale_roster->UnloadCatalog(fCatalog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
BCatalog::GetString(const char *string, const char *context, const char *comment)
|
BCatalog::GetString(const char *string, const char *context, const char *comment)
|
||||||
{
|
{
|
||||||
|
if (fCatalogData == 0)
|
||||||
|
return string;
|
||||||
|
|
||||||
const char *translated;
|
const char *translated;
|
||||||
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
|
for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
|
||||||
translated = cat->GetString(string, context, comment);
|
translated = cat->GetString(string, context, comment);
|
||||||
if (translated)
|
if (translated)
|
||||||
return translated;
|
return translated;
|
||||||
}
|
}
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,12 +54,16 @@ BCatalog::GetString(const char *string, const char *context, const char *comment
|
|||||||
const char *
|
const char *
|
||||||
BCatalog::GetString(uint32 id)
|
BCatalog::GetString(uint32 id)
|
||||||
{
|
{
|
||||||
|
if (fCatalogData == 0)
|
||||||
|
return "";
|
||||||
|
|
||||||
const char *translated;
|
const char *translated;
|
||||||
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
|
for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
|
||||||
translated = cat->GetString(id);
|
translated = cat->GetString(id);
|
||||||
if (translated)
|
if (translated)
|
||||||
return translated;
|
return translated;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,15 +71,17 @@ BCatalog::GetString(uint32 id)
|
|||||||
status_t
|
status_t
|
||||||
BCatalog::GetData(const char *name, BMessage *msg)
|
BCatalog::GetData(const char *name, BMessage *msg)
|
||||||
{
|
{
|
||||||
if (!fCatalog)
|
if (fCatalogData == 0)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
status_t res;
|
status_t res;
|
||||||
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
|
for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
|
||||||
res = cat->GetData(name, msg);
|
res = cat->GetData(name, msg);
|
||||||
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
|
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
|
||||||
return res;
|
return res;
|
||||||
// return B_OK if found, or specific error-code
|
// return B_OK if found, or specific error-code
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_NAME_NOT_FOUND;
|
return B_NAME_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,161 +89,16 @@ BCatalog::GetData(const char *name, BMessage *msg)
|
|||||||
status_t
|
status_t
|
||||||
BCatalog::GetData(uint32 id, BMessage *msg)
|
BCatalog::GetData(uint32 id, BMessage *msg)
|
||||||
{
|
{
|
||||||
if (!fCatalog)
|
if (fCatalogData == 0)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
status_t res;
|
status_t res;
|
||||||
for (BCatalogAddOn* cat = fCatalog; cat != NULL; cat = cat->fNext) {
|
for (BCatalogData* cat = fCatalogData; cat != NULL; cat = cat->fNext) {
|
||||||
res = cat->GetData(id, msg);
|
res = cat->GetData(id, msg);
|
||||||
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
|
if (res != B_NAME_NOT_FOUND && res != EOPNOTSUPP)
|
||||||
return res;
|
return res;
|
||||||
// return B_OK if found, or specific error-code
|
// return B_OK if found, or specific error-code
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_NAME_NOT_FOUND;
|
return B_NAME_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//#pragma mark - BCatalogAddOn
|
|
||||||
BCatalogAddOn::BCatalogAddOn(const char *signature, const char *language,
|
|
||||||
uint32 fingerprint)
|
|
||||||
:
|
|
||||||
fInitCheck(B_NO_INIT),
|
|
||||||
fSignature(signature),
|
|
||||||
fLanguageName(language),
|
|
||||||
fFingerprint(fingerprint),
|
|
||||||
fNext(NULL)
|
|
||||||
{
|
|
||||||
fLanguageName.ToLower();
|
|
||||||
// canonicalize language-name to lowercase
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BCatalogAddOn::~BCatalogAddOn()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BCatalogAddOn::UpdateFingerprint()
|
|
||||||
{
|
|
||||||
fFingerprint = 0;
|
|
||||||
// base implementation always yields the same fingerprint,
|
|
||||||
// which means that no version-mismatch detection is possible.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::InitCheck() const
|
|
||||||
{
|
|
||||||
return fInitCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
BCatalogAddOn::CanHaveData() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::GetData(const char *name, BMessage *msg)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::GetData(uint32 id, BMessage *msg)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::SetString(const char *string, const char *translated,
|
|
||||||
const char *context, const char *comment)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::SetString(int32 id, const char *translated)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
BCatalogAddOn::CanWriteData() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::SetData(const char *name, BMessage *msg)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::SetData(uint32 id, BMessage *msg)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::ReadFromFile(const char *path)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::ReadFromAttribute(const entry_ref &appOrAddOnRef)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::ReadFromResource(const entry_ref &appOrAddOnRef)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::WriteToFile(const char *path)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::WriteToAttribute(const entry_ref &appOrAddOnRef)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BCatalogAddOn::WriteToResource(const entry_ref &appOrAddOnRef)
|
|
||||||
{
|
|
||||||
return EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BCatalogAddOn::MakeEmpty()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32
|
|
||||||
BCatalogAddOn::CountItems() const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
** Distributed under the terms of the OpenBeOS License.
|
||||||
|
** Copyright 2003-2004,2012. All rights reserved.
|
||||||
|
**
|
||||||
|
** Authors: Axel Dörfler, axeld@pinc-software.de
|
||||||
|
** Oliver Tappe, zooey@hirschkaefer.de
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <CatalogData.h>
|
||||||
|
|
||||||
|
|
||||||
|
// Provides an empty implementation of BCatalogData for the build host.
|
||||||
|
|
||||||
|
|
||||||
|
BCatalogData::BCatalogData(const char *signature, const char *language,
|
||||||
|
uint32 fingerprint)
|
||||||
|
:
|
||||||
|
fInitCheck(B_NO_INIT),
|
||||||
|
fSignature(signature),
|
||||||
|
fLanguageName(language),
|
||||||
|
fFingerprint(fingerprint),
|
||||||
|
fNext(NULL)
|
||||||
|
{
|
||||||
|
fLanguageName.ToLower();
|
||||||
|
// canonicalize language-name to lowercase
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BCatalogData::~BCatalogData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BCatalogData::UpdateFingerprint()
|
||||||
|
{
|
||||||
|
fFingerprint = 0;
|
||||||
|
// base implementation always yields the same fingerprint,
|
||||||
|
// which means that no version-mismatch detection is possible.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::InitCheck() const
|
||||||
|
{
|
||||||
|
return fInitCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BCatalogData::CanHaveData() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::GetData(const char *name, BMessage *msg)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::GetData(uint32 id, BMessage *msg)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::SetString(const char *string, const char *translated,
|
||||||
|
const char *context, const char *comment)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::SetString(int32 id, const char *translated)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BCatalogData::CanWriteData() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::SetData(const char *name, BMessage *msg)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::SetData(uint32 id, BMessage *msg)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::ReadFromFile(const char *path)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::ReadFromAttribute(const entry_ref &appOrAddOnRef)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::ReadFromResource(const entry_ref &appOrAddOnRef)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::WriteToFile(const char *path)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::WriteToAttribute(const entry_ref &appOrAddOnRef)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BCatalogData::WriteToResource(const entry_ref &appOrAddOnRef)
|
||||||
|
{
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BCatalogData::MakeEmpty()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
BCatalogData::CountItems() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -401,7 +401,7 @@ DefaultCatalog::Unflatten(BDataIO *dataIO)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCatalogAddOn *
|
BCatalogData *
|
||||||
DefaultCatalog::Instantiate(const entry_ref &catalogOwner, const char *language,
|
DefaultCatalog::Instantiate(const entry_ref &catalogOwner, const char *language,
|
||||||
uint32 fingerprint)
|
uint32 fingerprint)
|
||||||
{
|
{
|
||||||
@@ -415,7 +415,7 @@ DefaultCatalog::Instantiate(const entry_ref &catalogOwner, const char *language,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCatalogAddOn *
|
BCatalogData *
|
||||||
DefaultCatalog::Create(const char *signature, const char *language)
|
DefaultCatalog::Create(const char *signature, const char *language)
|
||||||
{
|
{
|
||||||
DefaultCatalog *catalog
|
DefaultCatalog *catalog
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ BuildPlatformMain <build>collectcatkeys :
|
|||||||
PlainTextCatalog.cpp
|
PlainTextCatalog.cpp
|
||||||
HashMapCatalog.cpp
|
HashMapCatalog.cpp
|
||||||
Catalog.cpp
|
Catalog.cpp
|
||||||
|
CatalogData.cpp
|
||||||
RegExp.cpp
|
RegExp.cpp
|
||||||
: $(HOST_LIBBE) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++) ;
|
: $(HOST_LIBBE) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++) ;
|
||||||
|
|
||||||
@@ -44,4 +45,5 @@ BuildPlatformMain <build>linkcatkeys :
|
|||||||
HashMapCatalog.cpp
|
HashMapCatalog.cpp
|
||||||
DefaultCatalog.cpp
|
DefaultCatalog.cpp
|
||||||
Catalog.cpp
|
Catalog.cpp
|
||||||
|
CatalogData.cpp
|
||||||
: $(HOST_LIBBE) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++) ;
|
: $(HOST_LIBBE) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++) ;
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ PlainTextCatalog::UpdateAttributes(const char* path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCatalogAddOn *
|
BCatalogData *
|
||||||
PlainTextCatalog::Instantiate(const char *signature, const char *language,
|
PlainTextCatalog::Instantiate(const char *signature, const char *language,
|
||||||
uint32 fingerprint)
|
uint32 fingerprint)
|
||||||
{
|
{
|
||||||
@@ -346,7 +346,7 @@ PlainTextCatalog::Instantiate(const char *signature, const char *language,
|
|||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
extern "C" BCatalogAddOn *
|
extern "C" BCatalogData *
|
||||||
instantiate_catalog(const char *signature, const char *language,
|
instantiate_catalog(const char *signature, const char *language,
|
||||||
uint32 fingerprint)
|
uint32 fingerprint)
|
||||||
{
|
{
|
||||||
@@ -360,9 +360,8 @@ instantiate_catalog(const char *signature, const char *language,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
extern "C" BCatalogData *
|
||||||
BCatalogAddOn *create_catalog(const char *signature,
|
create_catalog(const char *signature, const char *language)
|
||||||
const char *language)
|
|
||||||
{
|
{
|
||||||
PlainTextCatalog *catalog
|
PlainTextCatalog *catalog
|
||||||
= new(std::nothrow) PlainTextCatalog("emptycat", signature, language);
|
= new(std::nothrow) PlainTextCatalog("emptycat", signature, language);
|
||||||
|
|||||||
Reference in New Issue
Block a user