`stdCallback` refactor
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- visualbasic
- Ambito
- tooling
Direzione di ricerca
Start by locating stdCallback and comparing its current implementation with the proposed CallbackType, TThis, constructor, Clone, and Bind structure in the issue. Determine the intended refactor boundaries and confirm that the listed callback construction and binding paths remain covered when the reorganization is complete.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
It's time for stdCallback to get a refactor. I feel some aspects are overcomplicated and this is in part because I didn't really know what I was doing when I originally made it.
Structure:
Private Enum CallbackType
EApplicationRun
ECallByName
EDispCallFunc
End Enum
Private Type TThis
iType as CallbackType
args() as variant
vBoundArgs as variant
End Type
Private This as TThis
'Core constructors
Public Function CreateFromRunCommand(ByVal sRunCommand as string) as stdCallback
set CreateFromRunCommand = new stdCallback
CreateFromRunCommand.protInit(CallbackType.EApplicationRun, Array(sRunCommand))
End Function
Public Function CreateFromObjectMember(Byval o as object, ByVal sMemberName as string, ByVal cType as vbCallType) as stdCallback
set CreateFromObjectMember= new stdCallback
CreateFromObjectMember.protInit(CallbackType.ECallByName, Array(o, sMemberName, cType))
End Function
Public Function CreateFromObjectOffset(ByVal oPtr as LongPtr, ByVal iVTableOffset as LongPtr, ByVal iRetType as vbVarType, ByRef vParamTypes() as vbVarType)
set CreateFromObjectOffset = new stdCallback
CreateFromObjectOffset.protInit(CallbackType.EDispCallFunc, Array(oPtr, iVTableOffset, iRetType, vParamTypes))
End Function
Public Function Clone() as stdCallback
set Clone = new stdCallback
Clone.protInit(This.iType, This.args)
End Function
Public Function Bind(ParamArray vParams()) as stdCallback
set Bind = Clone()
Bind.protBindParams(vParams)
End Function
'More specific constructors
Public Function CreateFromModule(sModuleName as string, sMethodName as string)
set CreateFromModule = CreateFromRunCommand(sModuleName & "." & sMethodName)
End Function
Public Function CreateFromWorkbookModule(sWorkbookPath as string, sModuleName as string, sMethodName as string)
set CreateFromWorkbookModule = CreateFromRunCommand("'" & sWorkbookPath & "'!" & sModuleName & "." & sMethodName)
End Function
Public Function CreateFromObjectMethod(ByVal o as object, ByVal sMethodName as string)
set CreateFromObjectMethod = CreateFromObjectMember(o, sMethodName, vbMethod
End Function
Public Function CreateFromObjectProperty(ByVal o as object, ByVal sPropertyName as string, ByVal cType as vbCallType)
set CreateFromObjectProperty = CreateFromObjectMember(o, sPropertyName, cType)
End Function
Public Function CreateFromFunctionPointer(ByVal iPtr as LongPtr, ByVal iRetType as vbVarType, ByRef vParamTypes() as vbVarType)
set CreateFromFunctionPointer = CreateFromObjectOffset(NULL_PTR, iPtr, iRetType, vParamTypes)
End Function
Public Function CreateFromDLLFuncByName(ByVal dll as string, ByVal name as string, ...)
set CreateFromFunctionPointer = CreateFromObjectOffset(NULL_PTR, iPtr, iRetType, vParamTypes)
End Function
Public Function CreateFromDLLFuncByIndex(ByVal dll as string, ByVal idx as Long, ...)
set CreateFromFunctionPointer = CreateFromObjectOffset(NULL_PTR, iPtr, iRetType, vParamTypes)
End Function
'@protected
Friend Sub protInit(ByVal iType as Long, vArgs() as variant)
This.iType = iType
This.args = vArgs
This.vBoundArgs = Null
End Sub
- Lingua principale
- VBA
- Stelle
- 412
- Fork
- 70
- Merge medio
- 16h 10m
- PR unite (30g)
- 3
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sancarn/stdVBA
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
-
Issues of stdRefArrayApertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
Tutte le issue di sancarn/stdVBA
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
localstack/localstack-mcp-server#112 ·
I maintainer di solito rispondono entro 1 giorno
-
`strTranspose` renames a key with its mode written out (dorian, minor, ...) as if it were majorAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
srikanth235/centraid#1155 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
project-codeflare/codeflare-sdk#1195 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement nav-pilot
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno