Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

styles converter transparency fix and code modernisation #93

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

loebl
Copy link

@loebl loebl commented Apr 20, 2018

This pull request contains the following changes:

  • Fix transparency import for IfcSurfaceStyleShading: Transparency was only read from SurfaceStyleRendering, although it is earlier available in SurfaceStyleShading
  • Replace various variable declarations with auto. Makes the lines a bit shorter
  • Declare functions only used inside the class as private
  • Change out parameters to return statements in a few functions

If you only want the fix separately, I can put it in an isolated pull request.

@ifcquery
Copy link
Owner

ifcquery commented Apr 23, 2018

Thanks for the pull request. However, heavy usage of the auto keyword is a different coding style, that I don't really like too much. Mostly I actually prefer the explicit datatype. You can see more clearly what it is, and jump more easily to the class definition in case you want to look at the attributes for example.
Like in this example, I would prefer the first one:
shared_ptr<IfcComplexProperty> complex_property = dynamic_pointer_cast...
auto const complex_property = dynamic_pointer_cast...

It is a bit more text, but it makes it better readable.
A search in the project where certain classes are used, is also easier with explicit data types. There are tons of reasons I like it more.

An std::vector as return value could cause some copy operations. I prefer to pass a reference as parameter.

I'm aware that loops can be written like for( auto node : vec_nodes ). But I don't really use it any more because when debugging, you never know in which round you are.

If you agree, I would like to keep the pull request open and take some parts of it in the future.

@loebl
Copy link
Author

loebl commented Apr 24, 2018

sure, no problem

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.

2 participants