intl/strres/src/nsStringBundle.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/strres/src/nsStringBundle.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,78 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsStringBundle_h__
    1.10 +#define nsStringBundle_h__
    1.11 +
    1.12 +#include "mozilla/ReentrantMonitor.h"
    1.13 +#include "nsIStringBundle.h"
    1.14 +#include "nsCOMPtr.h"
    1.15 +#include "nsString.h"
    1.16 +#include "nsCOMArray.h"
    1.17 +
    1.18 +class nsIPersistentProperties;
    1.19 +class nsIStringBundleOverride;
    1.20 +
    1.21 +class nsStringBundle : public nsIStringBundle
    1.22 +{
    1.23 +public:
    1.24 +    // init version
    1.25 +    nsStringBundle(const char* aURLSpec, nsIStringBundleOverride*);
    1.26 +    nsresult LoadProperties();
    1.27 +    virtual ~nsStringBundle();
    1.28 +
    1.29 +    NS_DECL_THREADSAFE_ISUPPORTS
    1.30 +    NS_DECL_NSISTRINGBUNDLE
    1.31 +
    1.32 +    nsCOMPtr<nsIPersistentProperties> mProps;
    1.33 +
    1.34 +protected:
    1.35 +    //
    1.36 +    // functional decomposition of the funitions repeatively called
    1.37 +    //
    1.38 +    nsresult GetStringFromID(int32_t aID, nsAString& aResult);
    1.39 +    nsresult GetStringFromName(const nsAString& aName, nsAString& aResult);
    1.40 +
    1.41 +    nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString,
    1.42 +                                    nsISimpleEnumerator** aResult);
    1.43 +private:
    1.44 +    nsCString              mPropertiesURL;
    1.45 +    nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
    1.46 +    mozilla::ReentrantMonitor    mReentrantMonitor;
    1.47 +    bool                         mAttemptedLoad;
    1.48 +    bool                         mLoaded;
    1.49 +
    1.50 +public:
    1.51 +    static nsresult FormatString(const char16_t *formatStr,
    1.52 +                                 const char16_t **aParams, uint32_t aLength,
    1.53 +                                 char16_t **aResult);
    1.54 +};
    1.55 +
    1.56 +/**
    1.57 + * An extensible implementation of the StringBundle interface.
    1.58 + *
    1.59 + * @created         28/Dec/1999
    1.60 + * @author  Catalin Rotaru [CATA]
    1.61 + */
    1.62 +class nsExtensibleStringBundle : public nsIStringBundle
    1.63 +{
    1.64 +  NS_DECL_ISUPPORTS
    1.65 +  NS_DECL_NSISTRINGBUNDLE
    1.66 +
    1.67 +  nsresult Init(const char * aCategory, nsIStringBundleService *);
    1.68 +private:
    1.69 +
    1.70 +  nsCOMArray<nsIStringBundle> mBundles;
    1.71 +  bool               mLoaded;
    1.72 +
    1.73 +public:
    1.74 +
    1.75 +  nsExtensibleStringBundle();
    1.76 +  virtual ~nsExtensibleStringBundle();
    1.77 +};
    1.78 +
    1.79 +
    1.80 +
    1.81 +#endif

mercurial