Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsCollation_h__
8 #define nsCollation_h__
11 #include "nsICollation.h"
12 #include "nsCOMPtr.h"
13 #include "mozilla/Attributes.h"
15 class nsIUnicodeEncoder;
17 // Create a collation interface for an input locale.
18 //
19 class nsCollationFactory MOZ_FINAL : public nsICollationFactory {
21 public:
22 NS_DECL_ISUPPORTS
24 NS_IMETHOD CreateCollation(nsILocale* locale, nsICollation** instancePtr);
26 nsCollationFactory() {}
27 };
30 struct nsCollation {
32 public:
34 nsCollation();
36 ~nsCollation();
38 // normalize string before collation key generation
39 nsresult NormalizeString(const nsAString& stringIn, nsAString& stringOut);
41 // charset conversion util, C string buffer is allocate by PR_Malloc, caller should call PR_Free
42 nsresult SetCharset(const char* aCharset);
43 nsresult UnicodeToChar(const nsAString& aSrc, char** dst);
45 protected:
46 nsCOMPtr <nsIUnicodeEncoder> mEncoder;
47 };
49 #endif /* nsCollation_h__ */