nsIStringBundle.idl (3302B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 #include "nsISupports.idl" 7 #include "nsISimpleEnumerator.idl" 8 9 %{C++ 10 #include "mozilla/MemoryReporting.h" 11 #include "mozilla/ipc/SharedMemoryHandle.h" 12 13 namespace mozilla { 14 namespace dom { 15 class ContentParent; 16 } 17 } 18 19 // Define Contractid and CID 20 // {D85A17C1-AA7C-11d2-9B8C-00805F8A16D9} 21 #define NS_STRINGBUNDLESERVICE_CID \ 22 { 0xd85a17c1, 0xaa7c, 0x11d2, \ 23 { 0x9b, 0x8c, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } } 24 25 #define NS_STRINGBUNDLE_CONTRACTID "@mozilla.org/intl/stringbundle;1" 26 27 %} 28 29 [ptr] native ContentParent(mozilla::dom::ContentParent); 30 native ReadOnlySharedMemoryHandle(mozilla::ipc::ReadOnlySharedMemoryHandle&&); 31 native MallocSizeOf(mozilla::MallocSizeOf); 32 33 [scriptable, builtinclass, uuid(D85A17C2-AA7C-11d2-9B8C-00805F8A16D9)] 34 interface nsIStringBundle : nsISupports 35 { 36 AString GetStringFromID(in long aID); 37 38 // This method is mostly used from JS, where AUTF8String is appropriate. 39 [binaryname(GetStringFromAUTF8Name)] 40 AString GetStringFromName(in AUTF8String aName); 41 42 // This method is mostly used from C++, where |string| is appropriate because 43 // the names are most often 8-bit string literals (normally ASCII, though 44 // u8"foo" literals will also work). 45 [noscript, binaryname(GetStringFromName)] 46 AString GetStringFromNameCpp(in string aName); 47 48 // This method is mostly used from JS, where AUTF8String is appropriate. 49 [binaryname(FormatStringFromAUTF8Name)] 50 AString formatStringFromName(in AUTF8String aName, in Array<AString> params); 51 52 // This method is mostly used from C++, where |string| is appropriate because 53 // the names are most often 8-bit string literals (normally ASCII, though 54 // u8"foo" literals will also work). 55 [noscript, binaryname(FormatStringFromName)] 56 AString formatStringFromNameCpp(in string aName, in Array<AString> params); 57 58 /* 59 Implements nsISimpleEnumerator, replaces nsIEnumerator 60 */ 61 nsISimpleEnumerator getSimpleEnumeration(); 62 // Preloads string bundle data asynchronously 63 void asyncPreload(); 64 65 [notxpcom, nostdcall] size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf); 66 [notxpcom, nostdcall] size_t SizeOfIncludingThisIfUnshared(in MallocSizeOf aMallocSizeOf); 67 }; 68 69 [scriptable, builtinclass, uuid(D85A17C0-AA7C-11d2-9B8C-00805F8A16D9)] 70 interface nsIStringBundleService : nsISupports 71 { 72 nsIStringBundle createBundle(in string aURLSpec); 73 74 /** 75 * flushes the string bundle cache - useful when the locale changes or 76 * when we need to get some extra memory back 77 * 78 * at some point, we might want to make this flush all the bundles, 79 * because any bundles that are floating around when the locale changes 80 * will suddenly contain bad data 81 * 82 */ 83 void flushBundles(); 84 85 [notxpcom, nostdcall] size_t sizeOfIncludingThis(in MallocSizeOf aMallocSizeOf); 86 87 [notxpcom, nostdcall] void sendContentBundles(in ContentParent aContentParent); 88 89 [notxpcom, nostdcall] void registerContentBundle(in ACString aBundleURL, 90 in ReadOnlySharedMemoryHandle aMapHandle); 91 };