Skip to content

Commit

Permalink
Feature field_name method
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkvdb committed May 6, 2024
1 parent b050e39 commit 3fcd426
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions gdalgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ int Feature::field_index(const std::string& name) const
return field_index(name.c_str());
}

std::string_view Feature::field_name(int index) const
{
return field_definition(index).name();
}

bool Feature::field_is_valid(int index) const noexcept
{
return _feature->IsFieldSetAndNotNull(index);
Expand Down
3 changes: 2 additions & 1 deletion include/infra/gdalgeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <optional>
#include <type_traits>
#include <unordered_map>
#include <variant>
#include <utility>
#include <variant>

class OGRSimpleCurve;
class OGRFieldDefn;
Expand Down Expand Up @@ -880,6 +880,7 @@ class Feature
int field_count() const;
int field_index(const char* name) const;
int field_index(const std::string& name) const;
std::string_view field_name(int index) const;
bool field_is_valid(int index) const noexcept;

FieldDefinitionRef field_definition(int index) const;
Expand Down

0 comments on commit 3fcd426

Please sign in to comment.