From 35b9b903daee88dea0e5efd9c0622cf09f177534 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Wed, 4 Mar 2015 21:25:28 +0100 Subject: Added getFieldDescriptor method with numeric index --- src/core/model/Ontology.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/core/model/Ontology.hpp b/src/core/model/Ontology.hpp index 079640c..8d6e596 100644 --- a/src/core/model/Ontology.hpp +++ b/src/core/model/Ontology.hpp @@ -669,6 +669,7 @@ public: * FieldDescriptor is not registered at this Descriptor. */ ssize_t getFieldDescriptorIndex(Handle fd) const; + /** * Returns the FieldDescriptor with the given name. * @@ -680,6 +681,23 @@ public: Rooted getFieldDescriptor( const std::string &name = DEFAULT_FIELD_NAME) const; + + /** + * Returns the FieldDescriptor with the given index. + * + * @param index the index of the field that should be retrieved. + + * @return the FieldDescriptor with the given index or a nullptr if no + * such FieldDescriptor was found. + */ + Rooted getFieldDescriptor(size_t index) const + { + if (index < fieldDescriptors.size()) { + return fieldDescriptors[index]; + } + return nullptr; + } + /** * This returns true if this Descriptor has a FieldDescriptor with the * given name. -- cgit v1.2.3