Skip to content

Factor out base class for structs / classes with cType#983

Merged
johnhaley81 merged 1 commit intonodegit:masterfrom
srajko:wrapper-base-class
Apr 11, 2016
Merged

Factor out base class for structs / classes with cType#983
johnhaley81 merged 1 commit intonodegit:masterfrom
srajko:wrapper-base-class

Conversation

@srajko
Copy link
Copy Markdown
Collaborator

@srajko srajko commented Apr 6, 2016

Starts towards more code sharing between the struct_* and class_* combyne templates - I needed this to make the new memory management code available to structs (it was only implemented for classes initially). There is probably more code that could be pulled in down the line but I wanted to keep this minimal for what I needed.

This leans more heavily on C++ templates than NodeGit code typically does, so this is something to consider - if needed I can probably get similar code sharing via combyne partial templates but I'd prefer to use language features when reasonable. v8 and Nan do use C++ templates / traits classes in similar ways, so at least it's not a completely new pattern to the project.

See code / commit comments for more details on the changes.

@srajko srajko force-pushed the wrapper-base-class branch 9 times, most recently from 7e88272 to daa9317 Compare April 9, 2016 00:30
- Separated cpyFunction from dupFunction in descriptor (since semantics are different - only affects git_oid)
- Added a {{ cppFunctionName }}Traits class to start leaning more on C++ templates where possible
- Assigning `free` as `freeFunctionName` for structs (since that was the previous behavior)
- Extracting a number of variables and methods from class_ and struct_ combyne templates into a base class (mostly dealing with construction / destruction and memory management).  This is to extend the memory management coverage that was implemented for class_ types to struct_ types.  I tried to maintain a similar .h / .cc separation that we had before.
@srajko srajko force-pushed the wrapper-base-class branch from daa9317 to e15808a Compare April 9, 2016 00:40
@srajko srajko changed the title [WIP] Factor out base class for structs / classes with cType Factor out base class for structs / classes with cType Apr 10, 2016
@johnhaley81
Copy link
Copy Markdown
Collaborator

👍

@johnhaley81 johnhaley81 merged commit b342f01 into nodegit:master Apr 11, 2016
@johnhaley81 johnhaley81 deleted the wrapper-base-class branch April 11, 2016 14:52
@tbranyen
Copy link
Copy Markdown
Member

I much prefer keeping Combyne usage to a minimal, 👍 for language features.

@johnhaley81
Copy link
Copy Markdown
Collaborator

A lot of it is navigating the treacherous world of "What does gcc/MSBUILD support in C++99/C++11".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants