#ifndef __LSR_H__
#define __LSR_H__
#include "unicode/utypes.h"
#include "unicode/uobject.h"
#include "cstring.h"
U_NAMESPACE_BEGIN
struct LSR final : public UMemory {
static constexpr int32_t REGION_INDEX_LIMIT = 1001 + 26 * 26;
const char *language;
const char *script;
const char *region;
char *owned = nullptr;
int32_t regionIndex = 0;
int32_t hashCode = 0;
LSR() : language("und"), script(""), region("") {}
LSR(const char *lang, const char *scr, const char *r) :
language(lang), script(scr), region(r),
regionIndex(indexForRegion(region)) {}
LSR(char prefix, const char *lang, const char *scr, const char *r, UErrorCode &errorCode);
LSR(LSR &&other) U_NOEXCEPT;
LSR(const LSR &other) = delete;
inline ~LSR() {
if (owned != nullptr) {
deleteOwned();
}
}
LSR &operator=(LSR &&other) U_NOEXCEPT;
LSR &operator=(const LSR &other) = delete;
static int32_t indexForRegion(const char *region);
UBool operator==(const LSR &other) const;
inline UBool operator!=(const LSR &other) const {
return !operator==(other);
}
LSR &setHashCode();
private:
void deleteOwned();
};
U_NAMESPACE_END
#endif // __LSR_H__