michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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: michael@0: #ifndef nsStringBundleService_h__ michael@0: #define nsStringBundleService_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsDataHashtable.h" michael@0: #include "nsHashKeys.h" michael@0: #include "nsIPersistentProperties2.h" michael@0: #include "nsIStringBundle.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsWeakReference.h" michael@0: #include "nsIErrorService.h" michael@0: #include "nsIStringBundleOverride.h" michael@0: michael@0: #include "mozilla/LinkedList.h" michael@0: michael@0: struct bundleCacheEntry_t; michael@0: michael@0: class nsStringBundleService : public nsIStringBundleService, michael@0: public nsIObserver, michael@0: public nsSupportsWeakReference michael@0: { michael@0: public: michael@0: nsStringBundleService(); michael@0: virtual ~nsStringBundleService(); michael@0: michael@0: nsresult Init(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSISTRINGBUNDLESERVICE michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: private: michael@0: nsresult getStringBundle(const char *aUrl, nsIStringBundle** aResult); michael@0: nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus, michael@0: uint32_t argCount, char16_t** argArray, michael@0: char16_t* *result); michael@0: michael@0: void flushBundleCache(); michael@0: michael@0: bundleCacheEntry_t *insertIntoCache(already_AddRefed aBundle, michael@0: nsCString &aHashKey); michael@0: michael@0: nsDataHashtable mBundleMap; michael@0: mozilla::LinkedList mBundleCache; michael@0: michael@0: nsCOMPtr mErrorService; michael@0: nsCOMPtr mOverrideStrings; michael@0: }; michael@0: michael@0: #endif