示例#1
0
HRESULT COMCALL DualTracer::GetTypeInfo(UINT nInfo, LCID dwLCID, ITypeInfo** ppTypeInfo)
{
	LOG_ENTRY(TXT("DualTracer::GetTypeInfoCount(UINT, dwLCID)"));
	LOG_PARAM(TXT("UINT=%u"), nInfo);
	LOG_PARAM(TXT("dwLCID=%u"), dwLCID);

	HRESULT hr = S_OK;

	try
	{
		hr = COM::IDispatchImpl<DualTracer>::GetTypeInfo(nInfo, dwLCID, ppTypeInfo);
	}
	COM_CATCH(hr)

	LOG_EXIT(TXT("HRESULT=0x%08X [%s]"), hr, CStrCvt::FormatError(hr).c_str());

	return hr;
}
示例#2
0
HRESULT COMCALL DualTracer::Invoke(DISPID lMemberID, REFIID rIID, LCID dwLCID, WORD wFlags, DISPPARAMS* pParams, VARIANT* pResult, EXCEPINFO* pExcepInfo, UINT* pnArgError)
{
	LOG_ENTRY(TXT("DualTracer::Invoke(DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT*)"));
	LOG_PARAM(TXT("DISPID=%d"), lMemberID);
	LOG_PARAM(TXT("WORD=0x%08X"), static_cast<DWORD>(wFlags));
	LOG_PARAM(TXT("DISPPARAMS*=%u %u"), pParams->cArgs, pParams->cNamedArgs);

	HRESULT hr = S_OK;

	try
	{
		hr = COM::IDispatchImpl<DualTracer>::Invoke(lMemberID, rIID, dwLCID, wFlags, pParams, pResult, pExcepInfo, pnArgError);
	}
	COM_CATCH(hr)

	LOG_EXIT(TXT("HRESULT=0x%08X [%s]"), hr, CStrCvt::FormatError(hr).c_str());

	return hr;
}
示例#3
0
HRESULT COMCALL DualTracer::GetIDsOfNames(REFIID rIID, LPOLESTR* aszNames, UINT nNames, LCID dwLCID, DISPID* alMemberIDs)
{
	LOG_ENTRY(TXT("DualTracer::GetIDsOfNames(REFIID, LPOLESTR*, UINT, LCID, DISPID*)"));
	LOG_PARAM(TXT("UINT=%u"), nNames);

	for (size_t i = 0; i < nNames; ++i)
		LOG_PARAM(TXT("LPOLESTR*[%d]=%s"), i, W2T(aszNames[i]));

	HRESULT hr = S_OK;

	try
	{
		hr = COM::IDispatchImpl<DualTracer>::GetIDsOfNames(rIID, aszNames, nNames, dwLCID, alMemberIDs);
	}
	COM_CATCH(hr)

	LOG_EXIT(TXT("HRESULT=0x%08X [%s]"), hr, CStrCvt::FormatError(hr).c_str());

	return hr;
}
示例#4
0
HRESULT COMCALL DualTracer::GetTypeInfoCount(UINT* pnInfo)
{
	LOG_ENTRY(TXT("DualTracer::GetTypeInfoCount(UINT*)"));

	HRESULT hr = S_OK;

	try
	{
		// Check output parameters.
		if (pnInfo == nullptr)
			throw WCL::ComException(E_POINTER, TXT("pnInfo is NULL"));

		*pnInfo = 1;
	}
	COM_CATCH(hr)

	LOG_EXIT(TXT("HRESULT=0x%08X [%s]"), hr, CStrCvt::FormatError(hr).c_str());

	return hr;
}
示例#5
0
HRESULT COMCALL CustomTracer::TestMethod(BSTR bstrInput, BSTR* pbstrOutput)
{
	LOG_ENTRY(TXT("CustomTracer::TestMethod()"));

	HRESULT hr = S_OK;

	try
	{
		// Check output parameters.
		if (pbstrOutput == nullptr)
			throw WCL::ComException(E_POINTER, TXT("pbstrOutput is NULL"));

		// Reverse the input string.
		*pbstrOutput = _wcsrev(::SysAllocString(BSTR2W(bstrInput)));
	}
	COM_CATCH(hr)

	LOG_EXIT(TXT("HRESULT=0x%08X [%s]"), hr, CStrCvt::FormatError(hr).c_str());

	return hr;
}
BOOL CCOMSyntaxHolder::BuildBeforeSyntax(string str, BOOL bFile, BOOL bWriteIntermFiles, BOOL bSaveIntermResults)
{
	m_piBeforeSyntaxPlmLines = 0;	
	m_piAfterMorphPlmLines = 0;
	HRESULT hr =  m_piAfterMorphPlmLines.CreateInstance(__uuidof(LEMMATIZERLib::PLMLineCollection));
	m_piAfterMorphPlmLines->AttachLemmatizer(m_piLemmatizer);

	m_piSentCollection->ClearSentences();
	string log_path;
	string FileName = "rossdev.log";
	try {
		
		log_path  = GetRegistryString( "Software\\Dialing\\Logs\\Main" );
		log_path += "/";
	}
	catch (...) {
	};
	if (bFile)
		if (!FileExists(str.c_str()))
		{
			ErrorMessage (Format("file %s  is not found", str.c_str()));
			return FALSE;
		};


	COM_TRY
		
		
		if( bFile )
			m_piGraphan->LoadFileToGraphan(_bstr_t(str.c_str()).copy());
		else
			m_piGraphan->LoadStringToGraphan(_bstr_t(str.c_str()).copy());
		

		

	COM_CATCH( "GraphAn has crushed.");

	
	

	COM_TRY
		m_piAfterMorphPlmLines->ProcessHyphenWords(m_piGraphan);


		m_piAfterMorphPlmLines->ProcessPlmLines(m_piGraphan);				
		if (bWriteIntermFiles)
			m_piAfterMorphPlmLines->SaveToFile(string(log_path+"before.lem").c_str()); 

		if (!bSaveIntermResults)
			m_piGraphan->FreeTable();

	
	COM_CATCH( "MorphAn has crushed.");

	COM_TRY
		if (m_CurrentLanguage == morphEnglish)
		{
			m_piBeforeSyntaxPlmLines = 0;
			m_piBeforeSyntaxPlmLines .CreateInstance(__uuidof(LEMMATIZERLib::PLMLineCollection));
			m_piBeforeSyntaxPlmLines->AttachLemmatizer(m_piLemmatizer);			
			m_piBeforeSyntaxPlmLines->CopyItems(m_piAfterMorphPlmLines);
		}
		else
			m_piBeforeSyntaxPlmLines = m_piMAPost->ProcessData(m_piAfterMorphPlmLines);
		if (bWriteIntermFiles)
			m_piBeforeSyntaxPlmLines->SaveToFile(string(log_path+"after.lem").c_str()); 

	COM_CATCH( "PostMorphology has crushed.");
	
	if (!bSaveIntermResults)
		m_piAfterMorphPlmLines->Clear();

	return TRUE;
};