Bumping manifests a=b2g-bump
[gecko.git] / intl / locale / mac / nsCollationMacUC.h
blob8283044bd98c223b7e5a01136e3f9a9c4ac701ab
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 {
23 public:
24 nsCollationMacUC();
26 // nsISupports interface
27 NS_DECL_ISUPPORTS
29 // nsICollation interface
30 NS_DECL_NSICOLLATION
32 protected:
33 ~nsCollationMacUC();
35 nsresult ConvertLocale(nsILocale* aNSLocale, LocaleRef* aMacLocale);
36 nsresult StrengthToOptions(const int32_t aStrength,
37 UCCollateOptions* aOptions);
38 nsresult EnsureCollator(const int32_t newStrength);
40 private:
41 bool mInit;
42 bool mHasCollator;
43 LocaleRef mLocale;
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_ */