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

Make QgsVectorDataProvider::fields() return a copy #3292

Closed
wants to merge 1 commit into from

Conversation

nyalldawson
Copy link
Collaborator

Implements a QGIS 3.0 TODO

Since QgsFields objects are implicitly shared, returning a copy helps simplify and make code more robust. This change only affects third party c++ providers, and does not affect PyQGIS scripts.

@nyalldawson nyalldawson added the API Break! Breaks stable API. Proceed with extreme caution!! label Jul 10, 2016
@rouault
Copy link
Contributor

rouault commented Jul 10, 2016

What is the rationale for all the flelds[i] --> fields.at( i ) changes ? I personaly find the array notation more usual and readable.

@nyalldawson
Copy link
Collaborator Author

What is the rationale for all the flelds[i] --> fields.at( i ) changes ? I personaly find the array notation more usual and readable.

[] has non-const version which forces a detach from the shared copy. Since c++ will always call the non-const version when it can, this is inefficient. .at() is always const, so it's safe to call without any risk of detachment.

It's the same with QList, QVector, etc.

@@ -16,6 +16,17 @@ with too big impact should be deferred to a major version release.

This page tries to maintain a list with incompatible changes that happened in previous releases.

\section qgis_api_break_3_0 QGIS 3.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't doxygen allow markdown?

I just find markdown a lot more readable than HTML ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure - that document already uses HTML, which is why I just followed along...

@nyalldawson nyalldawson force-pushed the fields branch 3 times, most recently from 48686e5 to 01d7faa Compare July 11, 2016 01:06
@nyalldawson
Copy link
Collaborator Author

Any objections if I merge?

After I push all this i'll update the doxy file to convert it to markdown

@nyalldawson
Copy link
Collaborator Author

Manually pushed as e683101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Break! Breaks stable API. Proceed with extreme caution!!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants