2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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 http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsStringBundle_h__
|
|
|
|
#define nsStringBundle_h__
|
|
|
|
|
2011-04-29 12:21:57 -07:00
|
|
|
#include "mozilla/ReentrantMonitor.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIStringBundle.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsCOMArray.h"
|
2013-09-27 09:45:04 -07:00
|
|
|
|
|
|
|
class nsIPersistentProperties;
|
|
|
|
class nsIStringBundleOverride;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsStringBundle : public nsIStringBundle
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// init version
|
|
|
|
nsStringBundle(const char* aURLSpec, nsIStringBundleOverride*);
|
|
|
|
nsresult LoadProperties();
|
|
|
|
virtual ~nsStringBundle();
|
|
|
|
|
2013-07-18 19:23:32 -07:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_NSISTRINGBUNDLE
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPersistentProperties> mProps;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
//
|
|
|
|
// functional decomposition of the funitions repeatively called
|
|
|
|
//
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult GetStringFromID(int32_t aID, nsAString& aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult GetStringFromName(const nsAString& aName, nsAString& aResult);
|
|
|
|
|
|
|
|
nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString,
|
|
|
|
nsISimpleEnumerator** aResult);
|
|
|
|
private:
|
|
|
|
nsCString mPropertiesURL;
|
|
|
|
nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
|
2011-04-29 12:21:57 -07:00
|
|
|
mozilla::ReentrantMonitor mReentrantMonitor;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mAttemptedLoad;
|
|
|
|
bool mLoaded;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
public:
|
|
|
|
static nsresult FormatString(const PRUnichar *formatStr,
|
2012-08-22 08:56:38 -07:00
|
|
|
const PRUnichar **aParams, uint32_t aLength,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRUnichar **aResult);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An extesible implementation of the StringBudle interface.
|
|
|
|
*
|
|
|
|
* @created 28/Dec/1999
|
|
|
|
* @author Catalin Rotaru [CATA]
|
|
|
|
*/
|
|
|
|
class nsExtensibleStringBundle : public nsIStringBundle
|
|
|
|
{
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSISTRINGBUNDLE
|
|
|
|
|
|
|
|
nsresult Init(const char * aCategory, nsIStringBundleService *);
|
|
|
|
private:
|
|
|
|
|
|
|
|
nsCOMArray<nsIStringBundle> mBundles;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mLoaded;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
nsExtensibleStringBundle();
|
|
|
|
virtual ~nsExtensibleStringBundle();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|