michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsEntityConverter_h__ michael@0: #define nsEntityConverter_h__ michael@0: michael@0: #include "nsIEntityConverter.h" michael@0: #include "nsIStringBundle.h" michael@0: #include "nsCOMPtr.h" michael@0: michael@0: #define kVERSION_STRING_LEN 128 michael@0: michael@0: class nsEntityVersionList michael@0: { michael@0: public: michael@0: nsEntityVersionList() {} michael@0: michael@0: uint32_t mVersion; michael@0: char16_t mEntityListName[kVERSION_STRING_LEN+1]; michael@0: nsCOMPtr mEntities; michael@0: }; michael@0: michael@0: class nsEntityConverter: public nsIEntityConverter michael@0: { michael@0: public: michael@0: michael@0: // michael@0: // implementation methods michael@0: // michael@0: nsEntityConverter(); michael@0: virtual ~nsEntityConverter(); michael@0: michael@0: // michael@0: // nsISupports michael@0: // michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: // michael@0: // nsIEntityConverter michael@0: // michael@0: NS_IMETHOD ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersion, char **_retval); michael@0: NS_IMETHOD ConvertToEntity(char16_t character, uint32_t entityVersion, char **_retval); michael@0: michael@0: NS_IMETHOD ConvertToEntities(const char16_t *inString, uint32_t entityVersion, char16_t **_retval); michael@0: michael@0: protected: michael@0: michael@0: // load a version property file and generate a version list (number/name pair) michael@0: NS_IMETHOD LoadVersionPropertyFile(); michael@0: michael@0: // map version number to version string michael@0: const char16_t* GetVersionName(uint32_t versionNumber); michael@0: michael@0: // map version number to a string bundle michael@0: nsIStringBundle* GetVersionBundleInstance(uint32_t versionNumber); michael@0: michael@0: // load a string bundle file michael@0: already_AddRefed LoadEntityBundle(uint32_t version); michael@0: michael@0: michael@0: nsEntityVersionList *mVersionList; // array of version number/name pairs michael@0: uint32_t mVersionListLength; // number of supported versions michael@0: }; michael@0: michael@0: #endif