intl/strres/src/nsStringBundle.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:7ef9e794d778
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/. */
5
6 #ifndef nsStringBundle_h__
7 #define nsStringBundle_h__
8
9 #include "mozilla/ReentrantMonitor.h"
10 #include "nsIStringBundle.h"
11 #include "nsCOMPtr.h"
12 #include "nsString.h"
13 #include "nsCOMArray.h"
14
15 class nsIPersistentProperties;
16 class nsIStringBundleOverride;
17
18 class nsStringBundle : public nsIStringBundle
19 {
20 public:
21 // init version
22 nsStringBundle(const char* aURLSpec, nsIStringBundleOverride*);
23 nsresult LoadProperties();
24 virtual ~nsStringBundle();
25
26 NS_DECL_THREADSAFE_ISUPPORTS
27 NS_DECL_NSISTRINGBUNDLE
28
29 nsCOMPtr<nsIPersistentProperties> mProps;
30
31 protected:
32 //
33 // functional decomposition of the funitions repeatively called
34 //
35 nsresult GetStringFromID(int32_t aID, nsAString& aResult);
36 nsresult GetStringFromName(const nsAString& aName, nsAString& aResult);
37
38 nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString,
39 nsISimpleEnumerator** aResult);
40 private:
41 nsCString mPropertiesURL;
42 nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
43 mozilla::ReentrantMonitor mReentrantMonitor;
44 bool mAttemptedLoad;
45 bool mLoaded;
46
47 public:
48 static nsresult FormatString(const char16_t *formatStr,
49 const char16_t **aParams, uint32_t aLength,
50 char16_t **aResult);
51 };
52
53 /**
54 * An extensible implementation of the StringBundle interface.
55 *
56 * @created 28/Dec/1999
57 * @author Catalin Rotaru [CATA]
58 */
59 class nsExtensibleStringBundle : public nsIStringBundle
60 {
61 NS_DECL_ISUPPORTS
62 NS_DECL_NSISTRINGBUNDLE
63
64 nsresult Init(const char * aCategory, nsIStringBundleService *);
65 private:
66
67 nsCOMArray<nsIStringBundle> mBundles;
68 bool mLoaded;
69
70 public:
71
72 nsExtensibleStringBundle();
73 virtual ~nsExtensibleStringBundle();
74 };
75
76
77
78 #endif

mercurial