|
// ESBServerImpl.cpp : Implementation of ESBServer
#include "stdafx.h"
#include "resource.h" // main symbols
#include "ESBServerComModule.h"
extern ESBServerComModule _Module;
#include <atlcom.h>
#include "IESBServer.h"
#include "IESBServerImpl.h"
#include "stl_ext.h"
/////////////////////////////////////////////////////////////////////////////
// ESBServer
#include <map>
#include <string>
using namespace std;
std::string asString(const BSTR &bstr)
{
return std::string(CString(bstr).GetBuffer(0));
}
template<class Param>
void Emit(int msgID, Param p)
{
if(!AfxGetMainWnd()->PostMessage(msgID, 0, (LPARAM)new Param(p))) {
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
LocalFree( lpMsgBuf );
}
}
STDMETHODIMP IESBServerImpl::fileContentChanged(BSTR file)
{
//AFX_MANAGE_STATE(AfxGetStaticModuleState())
string f = asString(file);
Emit(WM_REPARSE_FILE, to_lower(file_path_is::pathof(f)) + file_name_is::nameof(f) + "." + file_suffix_is::suffixof(f));
return S_OK;
}
STDMETHODIMP IESBServerImpl::showFileOutline(BSTR file)
{
//AFX_MANAGE_STATE(AfxGetStaticModuleState())
string f = asString(file);
Emit(WM_SHOW_FILEOUTLINE, to_lower(file_path_is::pathof(f)) + file_name_is::nameof(f) + "." + file_suffix_is::suffixof(f));
return S_OK;
}
STDMETHODIMP IESBServerImpl::loadWorkspace(BSTR name, BSTR packages)
{
//AFX_MANAGE_STATE(AfxGetStaticModuleState())
Emit(WM_OPEN_WORKSPACE, make_pair(asString(name), asString(packages)));
return S_OK;
}
STDMETHODIMP IESBServerImpl::showBrowser(BSTR browser)
{
//AFX_MANAGE_STATE(AfxGetStaticModuleState())
Emit(WM_SHOW_BROWSER, asString(browser));
return S_OK;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.