1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsCollationMacUC_h_
7 #define nsCollationMacUC_h_
9 #include "nsICollation.h"
10 #include "nsCollation.h"
11 #include "mozilla/Attributes.h"
12 #include <Carbon/Carbon.h>
14 // Maximum number of characters for a buffer to remember
15 // the generated collation key.
16 const uint32_t kCacheSize
= 128;
17 // According to the documentation, the length of the key should typically be
18 // at least 5 * textLength, but 6* would be safer.
19 const uint32_t kCollationValueSizeFactor
= 6;
21 class nsCollationMacUC MOZ_FINAL
: public nsICollation
{
26 // nsISupports interface
29 // nsICollation interface
35 nsresult
ConvertLocale(nsILocale
* aNSLocale
, LocaleRef
* aMacLocale
);
36 nsresult
StrengthToOptions(const int32_t aStrength
,
37 UCCollateOptions
* aOptions
);
38 nsresult
EnsureCollator(const int32_t newStrength
);
44 int32_t mLastStrength
;
45 CollatorRef mCollator
;
46 void *mBuffer
; // temporary buffer to generate collation keys
47 uint32_t mBufferLen
; // byte length of buffer
50 #endif /* nsCollationMacUC_h_ */