Applied patch by PulkoMandy, adjusted and extended by myself:
* integrating most of the locale kit into the build (and image) * removed LocaleBuild.h and _IMPEXP_LOCALE since that does not make sense for elf (which usually exports all symbols anyway) * added a couple of locale kit related pseudo targets for convenience Hey, some of that stuff already seems to work :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30545 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+38
-40
@@ -1,8 +1,6 @@
|
||||
#ifndef _CATALOG_H_
|
||||
#define _CATALOG_H_
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <String.h>
|
||||
|
||||
@@ -12,7 +10,7 @@ class BMessage;
|
||||
struct entry_ref;
|
||||
|
||||
|
||||
class _IMPEXP_LOCALE BCatalog {
|
||||
class BCatalog {
|
||||
|
||||
public:
|
||||
BCatalog();
|
||||
@@ -51,8 +49,8 @@ class _IMPEXP_LOCALE BCatalog {
|
||||
};
|
||||
|
||||
|
||||
extern _IMPEXP_LOCALE BCatalog* be_catalog;
|
||||
extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
|
||||
extern BCatalog* be_catalog;
|
||||
extern BCatalog* be_app_catalog;
|
||||
|
||||
|
||||
#ifndef B_AVOID_TRANSLATION_MACROS
|
||||
@@ -60,22 +58,22 @@ extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
|
||||
// you don't want these:
|
||||
|
||||
#undef TR_CONTEXT
|
||||
// In a single application, several strings (e.g. 'Ok') will be used
|
||||
// more than once, in different contexts.
|
||||
// In a single application, several strings (e.g. 'Ok') will be used
|
||||
// more than once, in different contexts.
|
||||
// As the application programmer can not know if all translations of
|
||||
// this string will be the same for all languages, each occurrence of
|
||||
// the string must be translated on its own.
|
||||
// Specifying the context explicitly with each string allows the person
|
||||
// translating a catalog to separate these different occurrences of the
|
||||
// same string and tell which strings appears in what context of the
|
||||
// same string and tell which strings appears in what context of the
|
||||
// application.
|
||||
// In order to give the translator a useful hint, the application
|
||||
// programmer needs to define TR_CONTEXT with the context he'd like
|
||||
// programmer needs to define TR_CONTEXT with the context he'd like
|
||||
// to be associated with the strings used in this specifc source file.
|
||||
// example:
|
||||
// #define TR_CONTEXT "Folder-Window"
|
||||
// Tip: Use a descriptive name of the class implemented in that
|
||||
// source-file.
|
||||
// Tip: Use a descriptive name of the class implemented in that
|
||||
// source-file.
|
||||
|
||||
|
||||
// Translation macros which may be used to shorten translation requests:
|
||||
@@ -112,7 +110,7 @@ extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
|
||||
for (char **ch = choices; *ch; ch++) {
|
||||
menu->AddItem(
|
||||
new BMenuItem(
|
||||
TR(*ch),
|
||||
TR(*ch),
|
||||
new BMessage(...)
|
||||
)
|
||||
)
|
||||
@@ -130,25 +128,25 @@ extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
|
||||
#undef TR_MARK_ALL
|
||||
#define TR_MARK_ALL(str,ctx,cmt) \
|
||||
BCatalogAddOn::MarkForTranslation((str), (ctx), (cmt))
|
||||
|
||||
|
||||
#undef TR_MARK_ID
|
||||
#define TR_MARK_ID(id) \
|
||||
BCatalogAddOn::MarkForTranslation((id))
|
||||
|
||||
|
||||
#endif /* B_AVOID_TRANSLATION_MACROS */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
// For BCatalog add-on implementations:
|
||||
|
||||
class _IMPEXP_LOCALE BCatalogAddOn {
|
||||
class BCatalogAddOn {
|
||||
friend class BLocaleRoster;
|
||||
public:
|
||||
BCatalogAddOn(const char *signature, const char *language,
|
||||
int32 fingerprint);
|
||||
virtual ~BCatalogAddOn();
|
||||
|
||||
virtual const char *GetString(const char *string,
|
||||
virtual const char *GetString(const char *string,
|
||||
const char *context=NULL,
|
||||
const char *comment=NULL) = 0;
|
||||
virtual const char *GetString(uint32 id) = 0;
|
||||
@@ -157,14 +155,14 @@ class _IMPEXP_LOCALE BCatalogAddOn {
|
||||
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
|
||||
// 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,
|
||||
virtual status_t SetString(const char *string,
|
||||
const char *translated,
|
||||
const char *context=NULL,
|
||||
const char *comment=NULL);
|
||||
@@ -187,7 +185,7 @@ class _IMPEXP_LOCALE BCatalogAddOn {
|
||||
// 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 *str, const char *ctx,
|
||||
static const char *MarkForTranslation(const char *str, const char *ctx,
|
||||
const char *cmt);
|
||||
static int32 MarkForTranslation(int32 id);
|
||||
|
||||
@@ -199,29 +197,29 @@ class _IMPEXP_LOCALE BCatalogAddOn {
|
||||
BString fLanguageName;
|
||||
int32 fFingerprint;
|
||||
BCatalogAddOn *fNext;
|
||||
|
||||
|
||||
friend class BCatalog;
|
||||
friend status_t get_add_on_catalog(BCatalog*, const char *);
|
||||
};
|
||||
|
||||
// every catalog-add-on should export these symbols...
|
||||
// ...the function that instantiates a catalog for this add-on-type...
|
||||
extern "C" _IMPEXP_LOCALE
|
||||
extern "C"
|
||||
BCatalogAddOn *instantiate_catalog(const char *signature,
|
||||
const char *language, int32 fingerprint);
|
||||
// ...the function that creates an empty catalog for this add-on-type...
|
||||
extern "C" _IMPEXP_LOCALE
|
||||
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 _IMPEXP_LOCALE uint8 gCatalogAddOnPriority;
|
||||
extern uint8 gCatalogAddOnPriority;
|
||||
|
||||
|
||||
/*
|
||||
* BCatalog - inlines for trivial accessors:
|
||||
*/
|
||||
inline status_t
|
||||
BCatalog::GetSignature(BString *sig)
|
||||
BCatalog::GetSignature(BString *sig)
|
||||
{
|
||||
if (!sig)
|
||||
return B_BAD_VALUE;
|
||||
@@ -232,8 +230,8 @@ BCatalog::GetSignature(BString *sig)
|
||||
}
|
||||
|
||||
|
||||
inline status_t
|
||||
BCatalog::GetLanguage(BString *lang)
|
||||
inline status_t
|
||||
BCatalog::GetLanguage(BString *lang)
|
||||
{
|
||||
if (!lang)
|
||||
return B_BAD_VALUE;
|
||||
@@ -241,11 +239,11 @@ BCatalog::GetLanguage(BString *lang)
|
||||
return B_NO_INIT;
|
||||
*lang = fCatalog->fLanguageName;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline status_t
|
||||
BCatalog::GetFingerprint(int32 *fp)
|
||||
inline status_t
|
||||
BCatalog::GetFingerprint(int32 *fp)
|
||||
{
|
||||
if (!fp)
|
||||
return B_BAD_VALUE;
|
||||
@@ -259,13 +257,13 @@ BCatalog::GetFingerprint(int32 *fp)
|
||||
inline status_t
|
||||
BCatalog::InitCheck() const
|
||||
{
|
||||
return fCatalog
|
||||
? fCatalog->InitCheck()
|
||||
return fCatalog
|
||||
? fCatalog->InitCheck()
|
||||
: B_NO_INIT;
|
||||
}
|
||||
|
||||
|
||||
inline int32
|
||||
inline int32
|
||||
BCatalog::CountItems() const
|
||||
{
|
||||
if (!fCatalog)
|
||||
@@ -275,7 +273,7 @@ BCatalog::CountItems() const
|
||||
|
||||
|
||||
inline BCatalogAddOn *
|
||||
BCatalog::CatalogAddOn()
|
||||
BCatalog::CatalogAddOn()
|
||||
{
|
||||
return fCatalog;
|
||||
}
|
||||
@@ -285,22 +283,22 @@ BCatalog::CatalogAddOn()
|
||||
* BCatalogAddOn - inlines for trivial accessors:
|
||||
*/
|
||||
inline BCatalogAddOn *
|
||||
BCatalogAddOn::Next()
|
||||
BCatalogAddOn::Next()
|
||||
{
|
||||
return fNext;
|
||||
}
|
||||
|
||||
|
||||
inline const char *
|
||||
BCatalogAddOn::MarkForTranslation(const char *str, const char *ctx,
|
||||
const char *cmt)
|
||||
BCatalogAddOn::MarkForTranslation(const char *str, const char *ctx,
|
||||
const char *cmt)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
inline int32
|
||||
BCatalogAddOn::MarkForTranslation(int32 id)
|
||||
BCatalogAddOn::MarkForTranslation(int32 id)
|
||||
{
|
||||
return id;
|
||||
}
|
||||
@@ -311,14 +309,14 @@ namespace BPrivate {
|
||||
/*
|
||||
* EditableCatalog
|
||||
*/
|
||||
class _IMPEXP_LOCALE EditableCatalog : public BCatalog {
|
||||
class EditableCatalog : public BCatalog {
|
||||
|
||||
public:
|
||||
EditableCatalog(const char *type, const char *signature,
|
||||
EditableCatalog(const char *type, const char *signature,
|
||||
const char *language);
|
||||
~EditableCatalog();
|
||||
|
||||
status_t SetString(const char *string,
|
||||
status_t SetString(const char *string,
|
||||
const char *translated,
|
||||
const char *context=NULL,
|
||||
const char *comment=NULL);
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include <SupportDefs.h>
|
||||
#include <Archivable.h>
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
class BString;
|
||||
class BCollatorAddOn;
|
||||
|
||||
@@ -23,7 +21,7 @@ enum collator_strengths {
|
||||
};
|
||||
|
||||
|
||||
class _IMPEXP_LOCALE BCollator : public BArchivable {
|
||||
class BCollator : public BArchivable {
|
||||
public:
|
||||
BCollator();
|
||||
BCollator(BCollatorAddOn *collator, int8 strength, bool ignorePunctuation);
|
||||
@@ -55,21 +53,21 @@ class _IMPEXP_LOCALE BCollator : public BArchivable {
|
||||
};
|
||||
|
||||
|
||||
inline bool
|
||||
inline bool
|
||||
BCollator::Equal(const char *s1, const char *s2, int32 len, int8 strength)
|
||||
{
|
||||
return Compare(s1, s2, len, strength) == 0;
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
inline bool
|
||||
BCollator::Greater(const char *s1, const char *s2, int32 len, int8 strength)
|
||||
{
|
||||
return Compare(s1, s2, len, strength) > 0;
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
inline bool
|
||||
BCollator::GreaterOrEqual(const char *s1, const char *s2, int32 len, int8 strength)
|
||||
{
|
||||
return Compare(s1, s2, len, strength) >= 0;
|
||||
@@ -80,7 +78,7 @@ BCollator::GreaterOrEqual(const char *s1, const char *s2, int32 len, int8 streng
|
||||
|
||||
// For BCollator add-on implementations:
|
||||
|
||||
class _IMPEXP_LOCALE BCollatorAddOn : public BArchivable {
|
||||
class BCollatorAddOn : public BArchivable {
|
||||
public:
|
||||
BCollatorAddOn();
|
||||
BCollatorAddOn(BMessage *archive);
|
||||
@@ -114,6 +112,6 @@ class _IMPEXP_LOCALE BCollatorAddOn : public BArchivable {
|
||||
// If your add-on should work with the standard tool to create a language, it
|
||||
// should export that function. However, once the language file has been written
|
||||
// only the archived collator is used, and that function won't be called anymore.
|
||||
extern "C" _IMPEXP_LOCALE BCollatorAddOn *instantiate_collator(void);
|
||||
extern "C" BCollatorAddOn *instantiate_collator(void);
|
||||
|
||||
#endif /* _COLLATOR_H_ */
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <LocaleBuild.h>
|
||||
#include <LocaleStrings.h>
|
||||
#include <String.h>
|
||||
|
||||
@@ -13,11 +12,11 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
class _IMPEXP_LOCALE BCountry {
|
||||
class BCountry {
|
||||
public:
|
||||
BCountry();
|
||||
virtual ~BCountry();
|
||||
|
||||
|
||||
virtual const char *Name() const;
|
||||
|
||||
// see definitions below
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
#include <Message.h>
|
||||
#include <String.h>
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
class BLocale;
|
||||
|
||||
class _IMPEXP_LOCALE BCurrency : public BArchivable {
|
||||
class BCurrency : public BArchivable {
|
||||
public:
|
||||
BCurrency(const BCurrency &other);
|
||||
BCurrency(BMessage *archive);
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
# include <hash_map>
|
||||
#endif
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <DataIO.h>
|
||||
#include <String.h>
|
||||
@@ -45,9 +43,9 @@ namespace BPrivate {
|
||||
* but it should also support being created from up to three strings,
|
||||
* which as a whole specify the key to the translated string.
|
||||
*/
|
||||
struct _IMPEXP_LOCALE CatKey {
|
||||
struct CatKey {
|
||||
BString fKey;
|
||||
// the key-string consists of three values separated by a special
|
||||
// the key-string consists of three values separated by a special
|
||||
// token:
|
||||
// - the native string
|
||||
// - the context of the string's usage
|
||||
@@ -73,7 +71,7 @@ struct _IMPEXP_LOCALE CatKey {
|
||||
* but the value-type might change to add support for shortcuts and/or
|
||||
* graphical data (button-images and the like).
|
||||
*/
|
||||
class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
|
||||
class DefaultCatalog : public BCatalogAddOn {
|
||||
|
||||
public:
|
||||
DefaultCatalog(const char *signature, const char *language,
|
||||
@@ -81,10 +79,10 @@ class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
|
||||
// constructor for normal use
|
||||
DefaultCatalog(entry_ref *appOrAddOnRef);
|
||||
// constructor for embedded catalog
|
||||
DefaultCatalog(const char *path, const char *signature,
|
||||
DefaultCatalog(const char *path, const char *signature,
|
||||
const char *language);
|
||||
// constructor for editor-app
|
||||
|
||||
|
||||
~DefaultCatalog();
|
||||
|
||||
// overrides of BCatalogAddOn:
|
||||
@@ -93,7 +91,7 @@ class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
|
||||
const char *GetString(uint32 id);
|
||||
const char *GetString(const CatKey& key);
|
||||
//
|
||||
status_t SetString(const char *string, const char *translated,
|
||||
status_t SetString(const char *string, const char *translated,
|
||||
const char *context = NULL, const char *comment = NULL);
|
||||
status_t SetString(int32 id, const char *translated);
|
||||
status_t SetString(const CatKey& key, const char *translated);
|
||||
@@ -145,50 +143,50 @@ class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
|
||||
CatMap::iterator fPos;
|
||||
CatMap::iterator fEnd;
|
||||
};
|
||||
status_t GetWalker(CatWalker *walker);
|
||||
status_t GetWalker(CatWalker *walker);
|
||||
};
|
||||
|
||||
inline
|
||||
inline
|
||||
DefaultCatalog::CatWalker::CatWalker(CatMap &catMap)
|
||||
: fPos(catMap.begin()),
|
||||
fEnd(catMap.end())
|
||||
{
|
||||
}
|
||||
|
||||
inline bool
|
||||
inline bool
|
||||
DefaultCatalog::CatWalker::AtEnd() const
|
||||
{
|
||||
return fPos == fEnd;
|
||||
}
|
||||
|
||||
inline const CatKey &
|
||||
inline const CatKey &
|
||||
DefaultCatalog::CatWalker::GetKey() const
|
||||
{
|
||||
assert(fPos != fEnd);
|
||||
return fPos->first;
|
||||
}
|
||||
|
||||
inline const char *
|
||||
inline const char *
|
||||
DefaultCatalog::CatWalker::GetValue() const
|
||||
{
|
||||
assert(fPos != fEnd);
|
||||
return fPos->second.String();
|
||||
}
|
||||
|
||||
inline void
|
||||
inline void
|
||||
DefaultCatalog::CatWalker::Next()
|
||||
{
|
||||
++fPos;
|
||||
}
|
||||
|
||||
inline status_t
|
||||
inline status_t
|
||||
DefaultCatalog::GetWalker(CatWalker *walker)
|
||||
{
|
||||
if (!walker)
|
||||
return B_BAD_VALUE;
|
||||
*walker = CatWalker(fCatMap);
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
class BString;
|
||||
class BFloatFormatImpl;
|
||||
|
||||
class _IMPEXP_LOCALE BFloatFormat : public BNumberFormat, public BFloatFormatParameters {
|
||||
class BFloatFormat : public BNumberFormat, public BFloatFormatParameters {
|
||||
public:
|
||||
BFloatFormat(const BFloatFormat &other);
|
||||
~BFloatFormat();
|
||||
|
||||
@@ -7,7 +7,7 @@ struct format_field_position;
|
||||
class BFloatFormatParameters;
|
||||
class BString;
|
||||
|
||||
class _IMPEXP_LOCALE BFloatFormatImpl : public BNumberFormatImpl {
|
||||
class BFloatFormatImpl : public BNumberFormatImpl {
|
||||
public:
|
||||
BFloatFormatImpl();
|
||||
virtual ~BFloatFormatImpl();
|
||||
|
||||
@@ -10,7 +10,7 @@ enum float_format_type {
|
||||
// number to be formatted
|
||||
};
|
||||
|
||||
class _IMPEXP_LOCALE BFloatFormatParameters : public BNumberFormatParameters {
|
||||
class BFloatFormatParameters : public BNumberFormatParameters {
|
||||
public:
|
||||
BFloatFormatParameters(const BFloatFormatParameters *parent = NULL);
|
||||
BFloatFormatParameters(const BFloatFormatParameters &other);
|
||||
|
||||
@@ -24,7 +24,7 @@ enum {
|
||||
};
|
||||
|
||||
// structure filled in while formatting
|
||||
struct _IMPEXP_LOCALE format_field_position {
|
||||
struct format_field_position {
|
||||
uint32 field_type;
|
||||
int32 start;
|
||||
int32 length;
|
||||
@@ -32,7 +32,7 @@ struct _IMPEXP_LOCALE format_field_position {
|
||||
|
||||
class BFormatImpl;
|
||||
|
||||
class _IMPEXP_LOCALE BFormat {
|
||||
class BFormat {
|
||||
protected:
|
||||
BFormat(const BFormat &other);
|
||||
~BFormat();
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
class BFormatParameters;
|
||||
|
||||
class _IMPEXP_LOCALE BFormatImpl {
|
||||
class BFormatImpl {
|
||||
public:
|
||||
BFormatImpl();
|
||||
virtual ~BFormatImpl();
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
enum format_alignment {
|
||||
B_ALIGN_FORMAT_LEFT, // reuse B_ALIGN_LEFT/B_ALIGN_RIGHT?
|
||||
B_ALIGN_FORMAT_RIGHT,
|
||||
};
|
||||
|
||||
class _IMPEXP_LOCALE BFormatParameters {
|
||||
class BFormatParameters {
|
||||
public:
|
||||
BFormatParameters(const BFormatParameters *parent = NULL);
|
||||
BFormatParameters(const BFormatParameters &other);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
class BString;
|
||||
struct format_field_position;
|
||||
|
||||
class _IMPEXP_LOCALE BGenericNumberFormat {
|
||||
class BGenericNumberFormat {
|
||||
public:
|
||||
BGenericNumberFormat();
|
||||
~BGenericNumberFormat();
|
||||
|
||||
@@ -12,7 +12,7 @@ class BString;
|
||||
// and this class (and its base classes) should mirror the parameters
|
||||
// classes' accessor methods.
|
||||
//
|
||||
class _IMPEXP_LOCALE BIntegerFormat : public BNumberFormat, public BIntegerFormatParameters {
|
||||
class BIntegerFormat : public BNumberFormat, public BIntegerFormatParameters {
|
||||
public:
|
||||
BIntegerFormat(const BIntegerFormat &other);
|
||||
~BIntegerFormat();
|
||||
|
||||
@@ -7,7 +7,7 @@ struct format_field_position;
|
||||
class BIntegerFormatParameters;
|
||||
class BString;
|
||||
|
||||
class _IMPEXP_LOCALE BIntegerFormatImpl : public BNumberFormatImpl {
|
||||
class BIntegerFormatImpl : public BNumberFormatImpl {
|
||||
public:
|
||||
BIntegerFormatImpl();
|
||||
virtual ~BIntegerFormatImpl();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <NumberFormatParameters.h>
|
||||
|
||||
class _IMPEXP_LOCALE BIntegerFormatParameters : public BNumberFormatParameters {
|
||||
class BIntegerFormatParameters : public BNumberFormatParameters {
|
||||
public:
|
||||
BIntegerFormatParameters(const BIntegerFormatParameters *parent = NULL);
|
||||
BIntegerFormatParameters(const BIntegerFormatParameters &other);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <LocaleBuild.h>
|
||||
#include <LocaleStrings.h>
|
||||
|
||||
|
||||
@@ -14,7 +13,7 @@ enum script_direction {
|
||||
};
|
||||
|
||||
|
||||
class _IMPEXP_LOCALE BLanguage {
|
||||
class BLanguage {
|
||||
public:
|
||||
~BLanguage();
|
||||
|
||||
|
||||
+10
-12
@@ -2,8 +2,6 @@
|
||||
#define _B_LOCALE_H_
|
||||
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
#include <Collator.h>
|
||||
#include <Language.h>
|
||||
#include <Country.h>
|
||||
@@ -13,7 +11,7 @@ class BCatalog;
|
||||
class BString;
|
||||
|
||||
|
||||
class _IMPEXP_LOCALE BLocale {
|
||||
class BLocale {
|
||||
public:
|
||||
BLocale();
|
||||
~BLocale();
|
||||
@@ -43,7 +41,7 @@ class _IMPEXP_LOCALE BLocale {
|
||||
int StringCompare(const BString *, const BString *, int32 len = -1, int8 strength = B_COLLATE_DEFAULT) const;
|
||||
|
||||
void GetSortKey(const char *string, BString *key);
|
||||
|
||||
|
||||
status_t GetAppCatalog(BCatalog *);
|
||||
|
||||
protected:
|
||||
@@ -53,34 +51,34 @@ class _IMPEXP_LOCALE BLocale {
|
||||
};
|
||||
|
||||
// global objects
|
||||
extern _IMPEXP_LOCALE BLocale *be_locale;
|
||||
extern _IMPEXP_LOCALE BLocaleRoster *be_locale_roster;
|
||||
extern BLocale *be_locale;
|
||||
extern BLocaleRoster *be_locale_roster;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//--- country short-hands inlines ---
|
||||
|
||||
inline void
|
||||
inline void
|
||||
BLocale::FormatDate(char *target, size_t maxSize, time_t timer, bool longFormat)
|
||||
{
|
||||
fCountry->FormatDate(target, maxSize, timer, longFormat);
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
inline void
|
||||
BLocale::FormatDate(BString *target, time_t timer, bool longFormat)
|
||||
{
|
||||
fCountry->FormatDate(target, timer, longFormat);
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
inline void
|
||||
BLocale::FormatTime(char *target, size_t maxSize, time_t timer, bool longFormat)
|
||||
{
|
||||
fCountry->FormatTime(target, maxSize, timer, longFormat);
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
inline void
|
||||
BLocale::FormatTime(BString *target, time_t timer, bool longFormat)
|
||||
{
|
||||
fCountry->FormatTime(target, timer, longFormat);
|
||||
@@ -90,14 +88,14 @@ BLocale::FormatTime(BString *target, time_t timer, bool longFormat)
|
||||
//--- locale short-hands inlines ---
|
||||
// #pragma mark -
|
||||
|
||||
inline int
|
||||
inline int
|
||||
BLocale::StringCompare(const char *string1, const char *string2, int32 length, int8 strength) const
|
||||
{
|
||||
return fCollator->Compare(string1, string2, length, strength);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
inline int
|
||||
BLocale::StringCompare(const BString *string1, const BString *string2, int32 length, int8 strength) const
|
||||
{
|
||||
return fCollator->Compare(string1->String(), string2->String(), length, strength);
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef _B_LOCALE_BUILD_H_
|
||||
#define _B_LOCALE_BUILD_H_
|
||||
|
||||
#if _BUILDING_locale
|
||||
#define _IMPEXP_LOCALE __declspec(dllexport)
|
||||
#else
|
||||
#define _IMPEXP_LOCALE __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* _B_LOCALE_BUILD_H_ */
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef _LOCALE_ROSTER_H_
|
||||
#define _LOCALE_ROSTER_H_
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
#include <String.h>
|
||||
|
||||
class BLanguage;
|
||||
@@ -20,7 +18,7 @@ enum {
|
||||
B_LOCALE_CHANGED = '_LCC',
|
||||
};
|
||||
|
||||
class _IMPEXP_LOCALE BLocaleRoster {
|
||||
class BLocaleRoster {
|
||||
|
||||
public:
|
||||
BLocaleRoster();
|
||||
@@ -35,14 +33,14 @@ class _IMPEXP_LOCALE BLocaleRoster {
|
||||
status_t GetDefaultCollator(BCollator **) const;
|
||||
status_t GetDefaultLanguage(BLanguage **) const;
|
||||
status_t GetDefaultCountry(BCountry **) const;
|
||||
|
||||
|
||||
status_t GetPreferredLanguages(BMessage *) const;
|
||||
status_t SetPreferredLanguages(BMessage *);
|
||||
// the message contains one or more 'language'-string-fields
|
||||
// the message contains one or more 'language'-string-fields
|
||||
// which contain the language-name(s)
|
||||
|
||||
status_t GetInstalledLanguages(BMessage *) const;
|
||||
// the message contains one or more 'language'-string-fields
|
||||
// the message contains one or more 'language'-string-fields
|
||||
// which contain the language-name(s)
|
||||
|
||||
status_t GetInstalledCatalogs(BMessage *,
|
||||
@@ -66,14 +64,14 @@ class _IMPEXP_LOCALE BLocaleRoster {
|
||||
|
||||
private:
|
||||
|
||||
BCatalogAddOn* LoadCatalog(const char *signature,
|
||||
BCatalogAddOn* LoadCatalog(const char *signature,
|
||||
const char *language = NULL,
|
||||
int32 fingerprint = 0);
|
||||
BCatalogAddOn* LoadEmbeddedCatalog(entry_ref *appOrAddOnRef);
|
||||
status_t UnloadCatalog(BCatalogAddOn *addOn);
|
||||
//
|
||||
BCatalogAddOn* CreateCatalog(const char *type,
|
||||
const char *signature,
|
||||
const char *signature,
|
||||
const char *language);
|
||||
|
||||
friend class BCatalog;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
class BNumberFormatImpl;
|
||||
|
||||
class _IMPEXP_LOCALE BNumberFormat : public BFormat {
|
||||
class BNumberFormat : public BFormat {
|
||||
protected:
|
||||
BNumberFormat(const BNumberFormat &other);
|
||||
~BNumberFormat();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
struct format_field_position;
|
||||
class BNumberFormatParameters;
|
||||
|
||||
class _IMPEXP_LOCALE BNumberFormatImpl : public BFormatImpl {
|
||||
class BNumberFormatImpl : public BFormatImpl {
|
||||
public:
|
||||
BNumberFormatImpl();
|
||||
virtual ~BNumberFormatImpl();
|
||||
|
||||
@@ -20,7 +20,7 @@ enum number_format_base {
|
||||
B_HEXADECIMAL_BASE = 16,
|
||||
};
|
||||
|
||||
class _IMPEXP_LOCALE BNumberFormatParameters : public BFormatParameters {
|
||||
class BNumberFormatParameters : public BFormatParameters {
|
||||
public:
|
||||
BNumberFormatParameters(const BNumberFormatParameters *parent = NULL);
|
||||
BNumberFormatParameters(const BNumberFormatParameters &other);
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
enum unicode_char_category
|
||||
{
|
||||
// Non-category for unassigned and non-character code points.
|
||||
@@ -49,9 +47,9 @@ enum unicode_char_category
|
||||
* This specifies the language directional property of a character set.
|
||||
*/
|
||||
|
||||
enum unicode_char_direction {
|
||||
B_UNICODE_LEFT_TO_RIGHT = 0,
|
||||
B_UNICODE_RIGHT_TO_LEFT = 1,
|
||||
enum unicode_char_direction {
|
||||
B_UNICODE_LEFT_TO_RIGHT = 0,
|
||||
B_UNICODE_RIGHT_TO_LEFT = 1,
|
||||
B_UNICODE_EUROPEAN_NUMBER = 2,
|
||||
B_UNICODE_EUROPEAN_NUMBER_SEPARATOR = 3,
|
||||
B_UNICODE_EUROPEAN_NUMBER_TERMINATOR = 4,
|
||||
@@ -59,8 +57,8 @@ enum unicode_char_direction {
|
||||
B_UNICODE_COMMON_NUMBER_SEPARATOR = 6,
|
||||
B_UNICODE_BLOCK_SEPARATOR = 7,
|
||||
B_UNICODE_SEGMENT_SEPARATOR = 8,
|
||||
B_UNICODE_WHITE_SPACE_NEUTRAL = 9,
|
||||
B_UNICODE_OTHER_NEUTRAL = 10,
|
||||
B_UNICODE_WHITE_SPACE_NEUTRAL = 9,
|
||||
B_UNICODE_OTHER_NEUTRAL = 10,
|
||||
B_UNICODE_LEFT_TO_RIGHT_EMBEDDING = 11,
|
||||
B_UNICODE_LEFT_TO_RIGHT_OVERRIDE = 12,
|
||||
B_UNICODE_RIGHT_TO_LEFT_ARABIC = 13,
|
||||
@@ -69,7 +67,7 @@ enum unicode_char_direction {
|
||||
B_UNICODE_POP_DIRECTIONAL_FORMAT = 16,
|
||||
B_UNICODE_DIR_NON_SPACING_MARK = 17,
|
||||
B_UNICODE_BOUNDARY_NEUTRAL = 18,
|
||||
|
||||
|
||||
B_UNICODE_DIRECTION_COUNT
|
||||
};
|
||||
|
||||
@@ -188,7 +186,7 @@ enum unicode_cell_width
|
||||
};
|
||||
|
||||
|
||||
class _IMPEXP_LOCALE BUnicodeChar {
|
||||
class BUnicodeChar {
|
||||
public:
|
||||
static bool IsAlpha(uint32 c);
|
||||
static bool IsAlNum(uint32 c);
|
||||
@@ -224,7 +222,7 @@ class _IMPEXP_LOCALE BUnicodeChar {
|
||||
};
|
||||
|
||||
|
||||
inline uint32
|
||||
inline uint32
|
||||
BUnicodeChar::FromUTF8(const char *in)
|
||||
{
|
||||
const char *string = in;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef _LANGINFO_H_
|
||||
#define _LANGINFO_H_
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
#include <LocaleStrings.h>
|
||||
#include <nl_types.h>
|
||||
|
||||
@@ -81,6 +79,6 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
_IMPEXP_LOCALE char *nl_langinfo(nl_item);
|
||||
char *nl_langinfo(nl_item);
|
||||
|
||||
#endif /* _LANGINFO_H_ */
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <LocaleBuild.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
_IMPEXP_LOCALE ssize_t strfmon(char *string, size_t maxSize, const char *format, ...);
|
||||
_IMPEXP_LOCALE ssize_t vstrfmon(char *string, size_t maxSize, const char *format, va_list args);
|
||||
ssize_t strfmon(char *string, size_t maxSize, const char *format, ...);
|
||||
ssize_t vstrfmon(char *string, size_t maxSize, const char *format, va_list args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user