michael@0: michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef nsCollation_h__ michael@0: #define nsCollation_h__ michael@0: michael@0: michael@0: #include "nsICollation.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: class nsIUnicodeEncoder; michael@0: michael@0: // Create a collation interface for an input locale. michael@0: // michael@0: class nsCollationFactory MOZ_FINAL : public nsICollationFactory { michael@0: michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: NS_IMETHOD CreateCollation(nsILocale* locale, nsICollation** instancePtr); michael@0: michael@0: nsCollationFactory() {} michael@0: }; michael@0: michael@0: michael@0: struct nsCollation { michael@0: michael@0: public: michael@0: michael@0: nsCollation(); michael@0: michael@0: ~nsCollation(); michael@0: michael@0: // normalize string before collation key generation michael@0: nsresult NormalizeString(const nsAString& stringIn, nsAString& stringOut); michael@0: michael@0: // charset conversion util, C string buffer is allocate by PR_Malloc, caller should call PR_Free michael@0: nsresult SetCharset(const char* aCharset); michael@0: nsresult UnicodeToChar(const nsAString& aSrc, char** dst); michael@0: michael@0: protected: michael@0: nsCOMPtr mEncoder; michael@0: }; michael@0: michael@0: #endif /* nsCollation_h__ */