2004-01-21 00:06:22 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
|
|
|
* Copyright (c) 2004, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
|
|
|
* Author: Alan Liu
|
|
|
|
* Created: January 16 2004
|
|
|
|
* Since: ICU 2.8
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
#ifndef LOCBASED_H
|
|
|
|
#define LOCBASED_H
|
|
|
|
|
|
|
|
#include "unicode/locid.h"
|
2004-01-23 19:28:34 +00:00
|
|
|
#include "unicode/uobject.h"
|
2004-01-21 00:06:22 +00:00
|
|
|
|
|
|
|
#define U_LOCALE_BASED(varname, objname) \
|
|
|
|
LocaleBased varname((objname).validLocale, (objname).actualLocale);
|
|
|
|
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2004-01-23 19:28:34 +00:00
|
|
|
class U_COMMON_API LocaleBased : public UMemory {
|
2004-01-21 00:06:22 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
inline LocaleBased(char* validAlias, char* actualAlias);
|
|
|
|
|
|
|
|
inline LocaleBased(const char* validAlias, const char* actualAlias);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the locale for this break iterator. Two flavors are available: valid and
|
|
|
|
* actual locale.
|
|
|
|
* @draft ICU 2.8
|
|
|
|
*/
|
|
|
|
Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the locale for this break iterator object. You can choose between valid and actual locale.
|
|
|
|
* @param type type of the locale we're looking for (valid or actual)
|
|
|
|
* @param status error code for the operation
|
|
|
|
* @return the locale
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
const char* getLocaleID(ULocDataLocaleType type, UErrorCode& status) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
void setLocaleIDs(const char* valid, const char* actual);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
char* valid;
|
|
|
|
|
|
|
|
char* actual;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline LocaleBased::LocaleBased(char* validAlias, char* actualAlias) :
|
|
|
|
valid(validAlias), actual(actualAlias) {
|
|
|
|
}
|
|
|
|
|
|
|
|
inline LocaleBased::LocaleBased(const char* validAlias,
|
|
|
|
const char* actualAlias) :
|
|
|
|
// ugh: cast away const
|
|
|
|
valid((char*)validAlias), actual((char*)actualAlias) {
|
|
|
|
}
|
|
|
|
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|