Skip to content

Commit

Permalink
Make enum more like struct
Browse files Browse the repository at this point in the history
  • Loading branch information
melonedo committed Aug 31, 2021
1 parent aaeb1d3 commit 756d2fe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/generator/jltypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ end
JuliaCrecord() = JuliaCrecord(Symbol())
JuliaCrecord(x::AbstractString) = JuliaCrecord(Symbol(x), getNullCursor())

struct JuliaCenum <: AbstractJuliaType
struct JuliaCenum{T<:CLCursor} <: AbstractJuliaType
sym::Symbol
cursor::T
end
JuliaCenum() = JuliaCenum(Symbol())
JuliaCenum(x::AbstractString) = JuliaCenum(Symbol(x))
JuliaCenum(x::AbstractString) = JuliaCenum(Symbol(x), getNullCursor())

struct JuliaCtypedef <: AbstractJuliaType
sym::Symbol
Expand Down Expand Up @@ -151,7 +152,10 @@ end
tojulia(x::CLInvalid) = JuliaUnknown(x)
tojulia(x::CLFunctionProto) = JuliaCfunction(spelling(getTypeDeclaration(x)))
tojulia(x::CLFunctionNoProto) = JuliaCfunction(spelling(getTypeDeclaration(x)))
tojulia(x::CLEnum) = JuliaCenum(spelling(getTypeDeclaration(x)))
function tojulia(x::CLEnum)
c = getTypeDeclaration(x)
JuliaCenum(Symbol(spelling(c)), c)
end
function tojulia(x::CLRecord)
c = getTypeDeclaration(x)
JuliaCrecord(Symbol(spelling(c)), c)
Expand Down

0 comments on commit 756d2fe

Please sign in to comment.