intl/locale/src/mac/nsCollationMacUC.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     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();
    25   ~nsCollationMacUC(); 
    27   // nsISupports interface
    28   NS_DECL_ISUPPORTS
    30   // nsICollation interface
    31   NS_DECL_NSICOLLATION
    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);
    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 };
    49 #endif  /* nsCollationMacUC_h_ */

mercurial