intl/locale/src/nsCollation.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/locale/src/nsCollation.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +
     1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.6 + *
     1.7 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +#ifndef nsCollation_h__
    1.11 +#define nsCollation_h__
    1.12 +
    1.13 +
    1.14 +#include "nsICollation.h"
    1.15 +#include "nsCOMPtr.h"
    1.16 +#include "mozilla/Attributes.h"
    1.17 +
    1.18 +class nsIUnicodeEncoder;
    1.19 +
    1.20 +// Create a collation interface for an input locale.
    1.21 +// 
    1.22 +class nsCollationFactory MOZ_FINAL : public nsICollationFactory {
    1.23 +
    1.24 +public: 
    1.25 +  NS_DECL_ISUPPORTS 
    1.26 +
    1.27 +  NS_IMETHOD CreateCollation(nsILocale* locale, nsICollation** instancePtr);
    1.28 +
    1.29 +  nsCollationFactory() {}
    1.30 +};
    1.31 +
    1.32 +
    1.33 +struct nsCollation {
    1.34 +
    1.35 +public: 
    1.36 +
    1.37 +  nsCollation();
    1.38 +  
    1.39 +  ~nsCollation();
    1.40 +
    1.41 +  // normalize string before collation key generation
    1.42 +  nsresult NormalizeString(const nsAString& stringIn, nsAString& stringOut);
    1.43 +
    1.44 +  // charset conversion util, C string buffer is allocate by PR_Malloc, caller should call PR_Free
    1.45 +  nsresult SetCharset(const char* aCharset);
    1.46 +  nsresult UnicodeToChar(const nsAString& aSrc, char** dst);
    1.47 +
    1.48 +protected:
    1.49 +  nsCOMPtr <nsIUnicodeEncoder>            mEncoder;
    1.50 +};
    1.51 +
    1.52 +#endif  /* nsCollation_h__ */

mercurial