Skip to content

Commit

Permalink
addin loader infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilBeaver committed May 30, 2014
1 parent 870d8a3 commit c34b6cb
Show file tree
Hide file tree
Showing 8 changed files with 1,444 additions and 857 deletions.
93 changes: 50 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
/*.vssscc
*.vspscc

/src/*.vssscc
/src/*.suo
/src/oscript/oscript.csproj.user

/src/ScriptEngine/bin/x86/Debug

/src/ScriptEngine/bin/x86/Release

/src/ScriptEngine/obj/Release/*.cache
/src/ScriptEngine/obj/x86/Debug/*.cache
/src/ScriptEngine/obj/x86/Debug

/src/TestApp/bin/x86/Debug

/src/ScriptEngine/obj/x86/Release

/src/TestApp/bin/x86/Release
/src/TestApp/obj/Release

/src/TestApp/obj/x86/Debug

/src/TestApp/obj/x86/Release

/src/oscript/obj/Release

/src/oscript/obj/Debug

/src/oscript/obj/x86/Release

/src/oscript/bin/x86/Release

/src/oscript/obj/x86/Debug

/src/ScriptEngine.StdLib/bin/x86/Release

/src/ScriptEngine.StdLib/obj/Release

/src/ScriptEngine.StdLib/obj/x86/Release

/src/ScriptEngine.StdLib/obj/Debug/*.cache
/*.vssscc
*.vspscc

/src/*.vssscc
/src/*.suo
/src/oscript/oscript.csproj.user

/src/ScriptEngine/bin/x86/Debug

/src/ScriptEngine/bin/x86/Release

/src/ScriptEngine/obj/Release/*.cache
/src/ScriptEngine/obj/x86/Debug/*.cache
/src/ScriptEngine/obj/x86/Debug

/src/TestApp/bin/x86/Debug

/src/ScriptEngine/obj/x86/Release

/src/TestApp/bin/x86/Release
/src/TestApp/obj/Release

/src/TestApp/obj/x86/Debug

/src/TestApp/obj/x86/Release

/src/oscript/obj/Release

/src/oscript/obj/Debug

/src/oscript/obj/x86/Release

/src/oscript/bin/x86/Release

/src/oscript/obj/x86/Debug

/src/ScriptEngine.StdLib/bin/x86/Release

/src/ScriptEngine.StdLib/obj/Release

/src/ScriptEngine.StdLib/obj/x86/Release

/src/ScriptEngine.StdLib/obj/Debug/*.cache
/src/*.sdf
/src/Debug
/src/ScriptEngine.HostedScript/bin/x86/Debug
/src/ScriptEngine.HostedScript/obj/x86/Debug
Debug
/src/*.opensdf
/src/ipch/scriptengine.snegopat-bbe5b63/scriptengine.ipch
110 changes: 110 additions & 0 deletions src/ScriptEngine.Snegopat/IAddinLoaderImpl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#include "stdafx.h"
#include "IAddinLoaderImpl.h"
#include "Snegopat_i.c"

//extern const IID IID_IAddinLoader;
//extern const IID IID_IAddinGroup;

IAddinLoaderImpl::IAddinLoaderImpl(IDispatch* pDesigner)
{
m_refCount = 0;
m_pDesigner = pDesigner;
}


IAddinLoaderImpl::~IAddinLoaderImpl(void)
{

}

//IUnknown interface
#pragma region IUnknown implementation

HRESULT __stdcall IAddinLoaderImpl::QueryInterface(
REFIID riid ,
void **ppObj)
{
if (riid == IID_IUnknown)
{
*ppObj = static_cast<IUnknown*>(this);
AddRef() ;
return S_OK;
}
if (riid == IID_IAddinLoader)
{
*ppObj = static_cast<IUnknown*>(this);
AddRef() ;
return S_OK;
}
//
//if control reaches here then , let the client know that
//we do not satisfy the required interface
//
*ppObj = NULL ;
return E_NOINTERFACE ;
}

ULONG __stdcall IAddinLoaderImpl::AddRef()
{
return InterlockedIncrement(&m_refCount) ;
}

ULONG __stdcall IAddinLoaderImpl::Release()
{
long nRefCount = 0;
nRefCount = InterlockedDecrement(&m_refCount) ;
if (nRefCount == 0)
{
m_pDesigner->Release();
delete this;
}

return nRefCount;
}

#pragma endregion

HRESULT __stdcall IAddinLoaderImpl::proto(
BSTR *result)
{
*result = SysAllocString(L"1s");
return S_OK;
}

HRESULT __stdcall IAddinLoaderImpl::load(
BSTR uri,
BSTR *fullPath,
BSTR *uniqueName,
BSTR *displayName,
IUnknown **result)
{
return E_NOTIMPL;
}

HRESULT __stdcall IAddinLoaderImpl::canUnload(
BSTR fullPath,
IUnknown *addin,
VARIANT_BOOL *result)
{
return E_NOTIMPL;
}

HRESULT __stdcall IAddinLoaderImpl::unload(
BSTR fullPath,
IUnknown *addin,
VARIANT_BOOL *result)
{
return E_NOTIMPL;
}

HRESULT __stdcall IAddinLoaderImpl::loadCommandName(
BSTR *result)
{
return E_NOTIMPL;
}

HRESULT __stdcall IAddinLoaderImpl::selectLoadURI(
BSTR *result)
{
return E_NOTIMPL;
}
51 changes: 51 additions & 0 deletions src/ScriptEngine.Snegopat/IAddinLoaderImpl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#pragma once

#include "Stdafx.h"
#include "Snegopat_h.h"

class IAddinLoaderImpl :
public IAddinLoader
{
private:
ULONG m_refCount;
IDispatch* m_pDesigner;

public:
IAddinLoaderImpl(IDispatch* pDesigner);

//IUnknown interface
virtual HRESULT __stdcall QueryInterface(
REFIID riid,
void **ppObj);
virtual ULONG __stdcall AddRef();
virtual ULONG __stdcall Release();

virtual HRESULT __stdcall proto(
BSTR *result);

virtual HRESULT __stdcall load(
BSTR uri,
BSTR *fullPath,
BSTR *uniqueName,
BSTR *displayName,
IUnknown **result);

virtual HRESULT __stdcall canUnload(
BSTR fullPath,
IUnknown *addin,
VARIANT_BOOL *result);

virtual HRESULT __stdcall unload(
BSTR fullPath,
IUnknown *addin,
VARIANT_BOOL *result);

virtual HRESULT __stdcall loadCommandName(
BSTR *result);

virtual HRESULT __stdcall selectLoadURI(
BSTR *result);

virtual ~IAddinLoaderImpl(void);
};

Loading

0 comments on commit c34b6cb

Please sign in to comment.