nsIStringBundle* nsEntityConverter:: GetVersionBundleInstance(uint32_t versionNumber) { switch(versionNumber){ case nsIEntityConverter::html40Latin1: if (!mHTML40Latin1Bundle) { mHTML40Latin1Bundle = LoadEntityBundle(kHTML40LATIN1); MOZ_ASSERT(mHTML40Latin1Bundle, "LoadEntityBundle failed"); } return mHTML40Latin1Bundle; case nsIEntityConverter::html40Symbols: if (!mHTML40SymbolsBundle) { mHTML40SymbolsBundle = LoadEntityBundle(kHTML40SYMBOLS); MOZ_ASSERT(mHTML40SymbolsBundle, "LoadEntityBundle failed"); } return mHTML40SymbolsBundle; case nsIEntityConverter::html40Special: if (!mHTML40SpecialBundle) { mHTML40SpecialBundle = LoadEntityBundle(kHTML40SPECIAL); MOZ_ASSERT(mHTML40SpecialBundle, "LoadEntityBundle failed"); } return mHTML40SpecialBundle; case nsIEntityConverter::mathml20: if (!mMathML20Bundle) { mMathML20Bundle = LoadEntityBundle(kMATHML20); MOZ_ASSERT(mMathML20Bundle, "LoadEntityBundle failed"); } return mMathML20Bundle; default: return nullptr; } }
nsIStringBundle* nsEntityConverter:: GetVersionBundleInstance(PRUint32 versionNumber) { if (NULL == mVersionList) { // load the property file which contains available version names // and generate a list of version/name pair nsresult rv = LoadVersionPropertyFile(); if (NS_FAILED(rv)) return NULL; } PRUint32 i; for (i = 0; i < mVersionListLength; i++) { if (versionNumber == mVersionList[i].mVersion) { if (!mVersionList[i].mEntities) { // not loaded // load the property file mVersionList[i].mEntities = LoadEntityBundle(versionNumber); NS_ASSERTION(mVersionList[i].mEntities, "LoadEntityBundle failed"); } return mVersionList[i].mEntities.get(); } } return NULL; }