-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
OGRGeometry: Add BufferEx method #9924
Conversation
I'm not sure of the cleanest way to handle this. I guess I could expose
|
try | ||
{ | ||
std::size_t end; | ||
int nQuadSegs = std::stoi(pszValue, &end, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter parsing/validation is really verbose and makes me wonder if I'm missing something like std::optional<int> CPLReadInt(std::string_view)
or bool CPLReadInt(const char*, int*)
.
std::from_chars
is the best solution I've found but I recently ran into problems with it being unsupported on recent versions of Apple clang.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::from_chars
is the best solution I've found but I recently ran into problems with it being unsupported on recent versions of Apple clang.
well, it is now a requirement since it is used in apps/argparse/argparse.hpp
Otherwise, I wouldn't care much about validating that the provided string is in range and would just blindly use atoi() . We do that almost everywhere....
yeah, we have a similar issue with Feature::SetField(). One solution might be, for Python, to expose different SWIG method names for the 2 forms of Buffer, and have a Python method in swig/include/python/ogr_python.i that redirects to the appropriate one. |
try | ||
{ | ||
std::size_t end; | ||
int nQuadSegs = std::stoi(pszValue, &end, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::from_chars
is the best solution I've found but I recently ran into problems with it being unsupported on recent versions of Apple clang.
well, it is now a requirement since it is used in apps/argparse/argparse.hpp
Otherwise, I wouldn't care much about validating that the provided string is in range and would just blindly use atoi() . We do that almost everywhere....
I guess the alternative is to disable kwargs for this function, which breaks the usage
That doesn't bother me, especially with "quadsecs" being a typo, but I'm fine to go either way. |
That would be fine too |
What does this PR do?
Adds an
OGRGeometry::BufferEx
method to allow passing key/value options.What are related issues/pull requests?
#8132
Tasklist