intl/locale/src/mac/nsCollationMacUC.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:6ce4e56504d5
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/. */
5
6 #ifndef nsCollationMacUC_h_
7 #define nsCollationMacUC_h_
8
9 #include "nsICollation.h"
10 #include "nsCollation.h"
11 #include "mozilla/Attributes.h"
12 #include <Carbon/Carbon.h>
13
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;
20
21 class nsCollationMacUC MOZ_FINAL : public nsICollation {
22
23 public:
24 nsCollationMacUC();
25 ~nsCollationMacUC();
26
27 // nsISupports interface
28 NS_DECL_ISUPPORTS
29
30 // nsICollation interface
31 NS_DECL_NSICOLLATION
32
33 protected:
34 nsresult ConvertLocale(nsILocale* aNSLocale, LocaleRef* aMacLocale);
35 nsresult StrengthToOptions(const int32_t aStrength,
36 UCCollateOptions* aOptions);
37 nsresult EnsureCollator(const int32_t newStrength);
38
39 private:
40 bool mInit;
41 bool mHasCollator;
42 LocaleRef mLocale;
43 int32_t mLastStrength;
44 CollatorRef mCollator;
45 void *mBuffer; // temporary buffer to generate collation keys
46 uint32_t mBufferLen; // byte length of buffer
47 };
48
49 #endif /* nsCollationMacUC_h_ */

mercurial