author Gerald Squelart <>
Thu, 26 May 2016 19:24:35 +1000
changeset 371291 89a24835ba7432bffb9c0c095a98a619a5750658
parent 196039 0d7d58108070f7fae8f149e9f5b4209bec8bee12
child 450305 ee6bed727c3d65bf01762afe3be742ca0f7b1440
permissions -rw-r--r--
Bug 1271483 - p16. gtest for list-string functions - r?cpearce Because it is templated code inside a cpp, the test includes a copy of that code. When we make this more public, the test should then include the proper header instead. MozReview-Commit-ID: 3vOvaj5VVhm

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#ifndef nsStringBundleService_h__
#define nsStringBundleService_h__

#include "nsCOMPtr.h"
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsIPersistentProperties2.h"
#include "nsIStringBundle.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
#include "nsIErrorService.h"
#include "nsIStringBundleOverride.h"

#include "mozilla/LinkedList.h"

struct bundleCacheEntry_t;

class nsStringBundleService : public nsIStringBundleService,
                              public nsIObserver,
                              public nsSupportsWeakReference

  nsresult Init();


  virtual ~nsStringBundleService();

  nsresult getStringBundle(const char *aUrl, nsIStringBundle** aResult);
  nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
                            uint32_t argCount, char16_t** argArray,
                            char16_t* *result);

  void flushBundleCache();

  bundleCacheEntry_t *insertIntoCache(already_AddRefed<nsIStringBundle> aBundle,
                                      nsCString &aHashKey);

  nsDataHashtable<nsCStringHashKey, bundleCacheEntry_t*> mBundleMap;
  mozilla::LinkedList<bundleCacheEntry_t> mBundleCache;

  nsCOMPtr<nsIErrorService> mErrorService;
  nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;