switch(mSel) { case eJaDetector: inst = new nsXPCOMJaDetector(); break; case eKoDetector: inst = new nsXPCOMKoDetector(); break; case eZhCnDetector: inst = new nsXPCOMZhCnDetector(); break; case eZhTwDetector: inst = new nsXPCOMZhTwDetector(); break; case eZhDetector: inst = new nsXPCOMZhDetector(); break; case eCJKDetector: inst = new nsXPCOMCJKDetector(); break; case eJaStringDetector: inst = new nsXPCOMJaStringDetector(); break; case eKoStringDetector: inst = new nsXPCOMKoStringDetector(); break; case eZhCnStringDetector: inst = new nsXPCOMZhCnStringDetector(); break; case eZhTwStringDetector: inst = new nsXPCOMZhTwStringDetector(); break; case eCJKStringDetector: inst = new nsXPCOMCJKStringDetector(); break; case eZhStringDetector: inst = new nsXPCOMZhStringDetector(); break; default: return NS_ERROR_NOT_IMPLEMENTED; }
if (mCID.Equals(kJAPSMDetectorCID)) { inst = new nsXPCOMDetector(JA_DETECTOR_NUM_VERIFIERS, gJaVerifierSet); } else if (mCID.Equals(kJAStringPSMDetectorCID)) { inst = new nsXPCOMStringDetector(JA_DETECTOR_NUM_VERIFIERS, gJaVerifierSet); } else if (mCID.Equals(kKOPSMDetectorCID)) { inst = new nsXPCOMDetector(KO_DETECTOR_NUM_VERIFIERS, gKoVerifierSet); } else if (mCID.Equals(kKOStringPSMDetectorCID)) { inst = new nsXPCOMStringDetector(KO_DETECTOR_NUM_VERIFIERS, gKoVerifierSet); } else if (mCID.Equals(kZHCNPSMDetectorCID)) { inst = new nsXPCOMDetector(ZHCN_DETECTOR_NUM_VERIFIERS, gZhCnVerifierSet); } else if (mCID.Equals(kZHCNStringPSMDetectorCID)) { inst = new nsXPCOMStringDetector(ZHCN_DETECTOR_NUM_VERIFIERS, gZhCnVerifierSet); } else if (mCID.Equals(kZHTWPSMDetectorCID)) { inst = new nsXPCOMDetector(ZHTW_DETECTOR_NUM_VERIFIERS, gZhTwVerifierSet); } else if (mCID.Equals(kZHTWStringPSMDetectorCID)) { inst = new nsXPCOMStringDetector(ZHTW_DETECTOR_NUM_VERIFIERS, gZhTwVerifierSet); } else if (mCID.Equals(kZHPSMDetectorCID)) { inst = new nsXPCOMDetector(ZH_DETECTOR_NUM_VERIFIERS, gZhVerifierSet); } else if (mCID.Equals(kZHStringPSMDetectorCID)) { inst = new nsXPCOMStringDetector(ZH_DETECTOR_NUM_VERIFIERS, gZhVerifierSet); } else if (mCID.Equals(kCJKPSMDetectorCID)) { inst = new nsXPCOMDetector(CJK_DETECTOR_NUM_VERIFIERS, gCJKVerifierSet); } else if (mCID.Equals(kCJKStringPSMDetectorCID)) { inst = new nsXPCOMStringDetector(CJK_DETECTOR_NUM_VERIFIERS, gCJKVerifierSet); }
NS_IMETHODIMP nsXPCOMDetectorFactory::CreateInstance(    nsISupports* aDelegate, const nsIID &aIID, void** aResult){  if(NULL == aResult)        return NS_ERROR_NULL_POINTER;  if(NULL != aDelegate)        return NS_ERROR_NO_AGGREGATION;  *aResult = NULL;  nsISupports *inst = nsnull;  switch(mSel)  {    case eJaDetector:      inst = new nsXPCOMJaDetector();      break;    case eKoDetector:      inst = new nsXPCOMKoDetector();      break;    case eZhCnDetector:      inst = new nsXPCOMZhCnDetector();      break;    case eZhTwDetector:      inst = new nsXPCOMZhTwDetector();      break;    case eZhDetector:      inst = new nsXPCOMZhDetector();      break;    case eCJKDetector:      inst = new nsXPCOMCJKDetector();      break;    case eJaStringDetector:      inst = new nsXPCOMJaStringDetector();      break;    case eKoStringDetector:      inst = new nsXPCOMKoStringDetector();      break;    case eZhCnStringDetector:      inst = new nsXPCOMZhCnStringDetector();      break;    case eZhTwStringDetector:      inst = new nsXPCOMZhTwStringDetector();      break;    case eCJKStringDetector:      inst = new nsXPCOMCJKStringDetector();      break;    case eZhStringDetector:      inst = new nsXPCOMZhStringDetector();      break;    default:       return NS_ERROR_NOT_IMPLEMENTED;  }   if(NULL == inst) {    return NS_ERROR_OUT_OF_MEMORY;  }  nsresult res =inst->QueryInterface(aIID, aResult);  if(NS_FAILED(res)) {     delete inst;  }  return res;}