Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsStringBundleService_h__ |
michael@0 | 7 | #define nsStringBundleService_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsCOMPtr.h" |
michael@0 | 10 | #include "nsDataHashtable.h" |
michael@0 | 11 | #include "nsHashKeys.h" |
michael@0 | 12 | #include "nsIPersistentProperties2.h" |
michael@0 | 13 | #include "nsIStringBundle.h" |
michael@0 | 14 | #include "nsIObserver.h" |
michael@0 | 15 | #include "nsWeakReference.h" |
michael@0 | 16 | #include "nsIErrorService.h" |
michael@0 | 17 | #include "nsIStringBundleOverride.h" |
michael@0 | 18 | |
michael@0 | 19 | #include "mozilla/LinkedList.h" |
michael@0 | 20 | |
michael@0 | 21 | struct bundleCacheEntry_t; |
michael@0 | 22 | |
michael@0 | 23 | class nsStringBundleService : public nsIStringBundleService, |
michael@0 | 24 | public nsIObserver, |
michael@0 | 25 | public nsSupportsWeakReference |
michael@0 | 26 | { |
michael@0 | 27 | public: |
michael@0 | 28 | nsStringBundleService(); |
michael@0 | 29 | virtual ~nsStringBundleService(); |
michael@0 | 30 | |
michael@0 | 31 | nsresult Init(); |
michael@0 | 32 | |
michael@0 | 33 | NS_DECL_ISUPPORTS |
michael@0 | 34 | NS_DECL_NSISTRINGBUNDLESERVICE |
michael@0 | 35 | NS_DECL_NSIOBSERVER |
michael@0 | 36 | |
michael@0 | 37 | private: |
michael@0 | 38 | nsresult getStringBundle(const char *aUrl, nsIStringBundle** aResult); |
michael@0 | 39 | nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus, |
michael@0 | 40 | uint32_t argCount, char16_t** argArray, |
michael@0 | 41 | char16_t* *result); |
michael@0 | 42 | |
michael@0 | 43 | void flushBundleCache(); |
michael@0 | 44 | |
michael@0 | 45 | bundleCacheEntry_t *insertIntoCache(already_AddRefed<nsIStringBundle> aBundle, |
michael@0 | 46 | nsCString &aHashKey); |
michael@0 | 47 | |
michael@0 | 48 | nsDataHashtable<nsCStringHashKey, bundleCacheEntry_t*> mBundleMap; |
michael@0 | 49 | mozilla::LinkedList<bundleCacheEntry_t> mBundleCache; |
michael@0 | 50 | |
michael@0 | 51 | nsCOMPtr<nsIErrorService> mErrorService; |
michael@0 | 52 | nsCOMPtr<nsIStringBundleOverride> mOverrideStrings; |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | #endif |