intl/strres/src/nsStringBundleService.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/strres/src/nsStringBundleService.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsStringBundleService_h__
    1.10 +#define nsStringBundleService_h__
    1.11 +
    1.12 +#include "nsCOMPtr.h"
    1.13 +#include "nsDataHashtable.h"
    1.14 +#include "nsHashKeys.h"
    1.15 +#include "nsIPersistentProperties2.h"
    1.16 +#include "nsIStringBundle.h"
    1.17 +#include "nsIObserver.h"
    1.18 +#include "nsWeakReference.h"
    1.19 +#include "nsIErrorService.h"
    1.20 +#include "nsIStringBundleOverride.h"
    1.21 +
    1.22 +#include "mozilla/LinkedList.h"
    1.23 +
    1.24 +struct bundleCacheEntry_t;
    1.25 +
    1.26 +class nsStringBundleService : public nsIStringBundleService,
    1.27 +                              public nsIObserver,
    1.28 +                              public nsSupportsWeakReference
    1.29 +{
    1.30 +public:
    1.31 +  nsStringBundleService();
    1.32 +  virtual ~nsStringBundleService();
    1.33 +
    1.34 +  nsresult Init();
    1.35 +
    1.36 +  NS_DECL_ISUPPORTS
    1.37 +  NS_DECL_NSISTRINGBUNDLESERVICE
    1.38 +  NS_DECL_NSIOBSERVER
    1.39 +
    1.40 +private:
    1.41 +  nsresult getStringBundle(const char *aUrl, nsIStringBundle** aResult);
    1.42 +  nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
    1.43 +                            uint32_t argCount, char16_t** argArray,
    1.44 +                            char16_t* *result);
    1.45 +
    1.46 +  void flushBundleCache();
    1.47 +
    1.48 +  bundleCacheEntry_t *insertIntoCache(already_AddRefed<nsIStringBundle> aBundle,
    1.49 +                                      nsCString &aHashKey);
    1.50 +
    1.51 +  nsDataHashtable<nsCStringHashKey, bundleCacheEntry_t*> mBundleMap;
    1.52 +  mozilla::LinkedList<bundleCacheEntry_t> mBundleCache;
    1.53 +
    1.54 +  nsCOMPtr<nsIErrorService> mErrorService;
    1.55 +  nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
    1.56 +};
    1.57 +
    1.58 +#endif

mercurial