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"
13 #include "nsCOMArray.h"
15 class nsIPersistentProperties
;
16 class nsIStringBundleOverride
;
18 class nsStringBundle
: public nsIStringBundle
22 nsStringBundle(const char* aURLSpec
, nsIStringBundleOverride
*);
23 nsresult
LoadProperties();
25 NS_DECL_THREADSAFE_ISUPPORTS
26 NS_DECL_NSISTRINGBUNDLE
28 nsCOMPtr
<nsIPersistentProperties
> mProps
;
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
);
42 nsCString mPropertiesURL
;
43 nsCOMPtr
<nsIStringBundleOverride
> mOverrideStrings
;
44 mozilla::ReentrantMonitor mReentrantMonitor
;
49 static nsresult
FormatString(const char16_t
*formatStr
,
50 const char16_t
**aParams
, uint32_t aLength
,
54 class nsExtensibleStringBundle
;
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
65 NS_DECL_NSISTRINGBUNDLE
67 nsresult
Init(const char * aCategory
, nsIStringBundleService
*);
70 nsExtensibleStringBundle();
73 virtual ~nsExtensibleStringBundle();
75 nsCOMArray
<nsIStringBundle
> mBundles
;