1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsStringBundleService_h__
7 #define nsStringBundleService_h__
10 #include "nsDataHashtable.h"
11 #include "nsHashKeys.h"
12 #include "nsIPersistentProperties2.h"
13 #include "nsIStringBundle.h"
14 #include "nsIObserver.h"
15 #include "nsWeakReference.h"
16 #include "nsIErrorService.h"
17 #include "nsIStringBundleOverride.h"
19 #include "mozilla/LinkedList.h"
21 struct bundleCacheEntry_t
;
23 class nsStringBundleService
: public nsIStringBundleService
,
25 public nsSupportsWeakReference
28 nsStringBundleService();
33 NS_DECL_NSISTRINGBUNDLESERVICE
37 virtual ~nsStringBundleService();
39 nsresult
getStringBundle(const char *aUrl
, nsIStringBundle
** aResult
);
40 nsresult
FormatWithBundle(nsIStringBundle
* bundle
, nsresult aStatus
,
41 uint32_t argCount
, char16_t
** argArray
,
44 void flushBundleCache();
46 bundleCacheEntry_t
*insertIntoCache(already_AddRefed
<nsIStringBundle
> aBundle
,
49 nsDataHashtable
<nsCStringHashKey
, bundleCacheEntry_t
*> mBundleMap
;
50 mozilla::LinkedList
<bundleCacheEntry_t
> mBundleCache
;
52 nsCOMPtr
<nsIErrorService
> mErrorService
;
53 nsCOMPtr
<nsIStringBundleOverride
> mOverrideStrings
;