Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsEntityConverter_h__ |
michael@0 | 7 | #define nsEntityConverter_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsIEntityConverter.h" |
michael@0 | 10 | #include "nsIStringBundle.h" |
michael@0 | 11 | #include "nsCOMPtr.h" |
michael@0 | 12 | |
michael@0 | 13 | #define kVERSION_STRING_LEN 128 |
michael@0 | 14 | |
michael@0 | 15 | class nsEntityVersionList |
michael@0 | 16 | { |
michael@0 | 17 | public: |
michael@0 | 18 | nsEntityVersionList() {} |
michael@0 | 19 | |
michael@0 | 20 | uint32_t mVersion; |
michael@0 | 21 | char16_t mEntityListName[kVERSION_STRING_LEN+1]; |
michael@0 | 22 | nsCOMPtr<nsIStringBundle> mEntities; |
michael@0 | 23 | }; |
michael@0 | 24 | |
michael@0 | 25 | class nsEntityConverter: public nsIEntityConverter |
michael@0 | 26 | { |
michael@0 | 27 | public: |
michael@0 | 28 | |
michael@0 | 29 | // |
michael@0 | 30 | // implementation methods |
michael@0 | 31 | // |
michael@0 | 32 | nsEntityConverter(); |
michael@0 | 33 | virtual ~nsEntityConverter(); |
michael@0 | 34 | |
michael@0 | 35 | // |
michael@0 | 36 | // nsISupports |
michael@0 | 37 | // |
michael@0 | 38 | NS_DECL_ISUPPORTS |
michael@0 | 39 | |
michael@0 | 40 | // |
michael@0 | 41 | // nsIEntityConverter |
michael@0 | 42 | // |
michael@0 | 43 | NS_IMETHOD ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersion, char **_retval); |
michael@0 | 44 | NS_IMETHOD ConvertToEntity(char16_t character, uint32_t entityVersion, char **_retval); |
michael@0 | 45 | |
michael@0 | 46 | NS_IMETHOD ConvertToEntities(const char16_t *inString, uint32_t entityVersion, char16_t **_retval); |
michael@0 | 47 | |
michael@0 | 48 | protected: |
michael@0 | 49 | |
michael@0 | 50 | // load a version property file and generate a version list (number/name pair) |
michael@0 | 51 | NS_IMETHOD LoadVersionPropertyFile(); |
michael@0 | 52 | |
michael@0 | 53 | // map version number to version string |
michael@0 | 54 | const char16_t* GetVersionName(uint32_t versionNumber); |
michael@0 | 55 | |
michael@0 | 56 | // map version number to a string bundle |
michael@0 | 57 | nsIStringBundle* GetVersionBundleInstance(uint32_t versionNumber); |
michael@0 | 58 | |
michael@0 | 59 | // load a string bundle file |
michael@0 | 60 | already_AddRefed<nsIStringBundle> LoadEntityBundle(uint32_t version); |
michael@0 | 61 | |
michael@0 | 62 | |
michael@0 | 63 | nsEntityVersionList *mVersionList; // array of version number/name pairs |
michael@0 | 64 | uint32_t mVersionListLength; // number of supported versions |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | #endif |