intl/locale/src/nsCollation.h

branch
TOR_BUG_9701
changeset 14
925c144e1f1f
equal deleted inserted replaced
-1:000000000000 0:a67855697f1c
1
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__
9
10
11 #include "nsICollation.h"
12 #include "nsCOMPtr.h"
13 #include "mozilla/Attributes.h"
14
15 class nsIUnicodeEncoder;
16
17 // Create a collation interface for an input locale.
18 //
19 class nsCollationFactory MOZ_FINAL : public nsICollationFactory {
20
21 public:
22 NS_DECL_ISUPPORTS
23
24 NS_IMETHOD CreateCollation(nsILocale* locale, nsICollation** instancePtr);
25
26 nsCollationFactory() {}
27 };
28
29
30 struct nsCollation {
31
32 public:
33
34 nsCollation();
35
36 ~nsCollation();
37
38 // normalize string before collation key generation
39 nsresult NormalizeString(const nsAString& stringIn, nsAString& stringOut);
40
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);
44
45 protected:
46 nsCOMPtr <nsIUnicodeEncoder> mEncoder;
47 };
48
49 #endif /* nsCollation_h__ */

mercurial