Bumping manifests a=b2g-bump
[gecko.git] / intl / strres / nsStringBundle.h
blobeab1ae602f43bf4646eb8dd7c4dcfd35e6c89048
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 nsStringBundle_h__
7 #define nsStringBundle_h__
9 #include "mozilla/ReentrantMonitor.h"
10 #include "nsIStringBundle.h"
11 #include "nsCOMPtr.h"
12 #include "nsString.h"
13 #include "nsCOMArray.h"
15 class nsIPersistentProperties;
16 class nsIStringBundleOverride;
18 class nsStringBundle : public nsIStringBundle
20 public:
21 // init version
22 nsStringBundle(const char* aURLSpec, nsIStringBundleOverride*);
23 nsresult LoadProperties();
25 NS_DECL_THREADSAFE_ISUPPORTS
26 NS_DECL_NSISTRINGBUNDLE
28 nsCOMPtr<nsIPersistentProperties> mProps;
30 protected:
31 virtual ~nsStringBundle();
34 // functional decomposition of the funitions repeatively called
36 nsresult GetStringFromID(int32_t aID, nsAString& aResult);
37 nsresult GetStringFromName(const nsAString& aName, nsAString& aResult);
39 nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString,
40 nsISimpleEnumerator** aResult);
41 private:
42 nsCString mPropertiesURL;
43 nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
44 mozilla::ReentrantMonitor mReentrantMonitor;
45 bool mAttemptedLoad;
46 bool mLoaded;
48 public:
49 static nsresult FormatString(const char16_t *formatStr,
50 const char16_t **aParams, uint32_t aLength,
51 char16_t **aResult);
54 class nsExtensibleStringBundle;
56 /**
57 * An extensible implementation of the StringBundle interface.
59 * @created 28/Dec/1999
60 * @author Catalin Rotaru [CATA]
62 class nsExtensibleStringBundle MOZ_FINAL : public nsIStringBundle
64 NS_DECL_ISUPPORTS
65 NS_DECL_NSISTRINGBUNDLE
67 nsresult Init(const char * aCategory, nsIStringBundleService *);
69 public:
70 nsExtensibleStringBundle();
72 private:
73 virtual ~nsExtensibleStringBundle();
75 nsCOMArray<nsIStringBundle> mBundles;
76 bool mLoaded;
81 #endif