scuffed-code/icu4c/source/common/locbased.h

70 lines
1.8 KiB
C
Raw Normal View History

/*
**********************************************************************
* 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"
#include "unicode/uobject.h"
#define U_LOCALE_BASED(varname, objname) \
LocaleBased varname((objname).validLocale, (objname).actualLocale);
U_NAMESPACE_BEGIN
class U_COMMON_API LocaleBased : public UMemory {
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