diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/model/Domain.cpp | 11 | ||||
| -rw-r--r-- | src/core/model/Domain.hpp | 10 | 
2 files changed, 21 insertions, 0 deletions
| diff --git a/src/core/model/Domain.cpp b/src/core/model/Domain.cpp index 20a9d42..806b9b8 100644 --- a/src/core/model/Domain.cpp +++ b/src/core/model/Domain.cpp @@ -265,6 +265,17 @@ ssize_t Descriptor::getFieldDescriptorIndex(Handle<FieldDescriptor> fd) const  	return -1;  } +Rooted<FieldDescriptor> Descriptor::getFieldDescriptor( +    const std::string &name) const +{ +	for (auto &fd : getFieldDescriptors()) { +		if (fd->getName() == name) { +			return fd; +		} +	} +	return nullptr; +} +  void Descriptor::addFieldDescriptor(Handle<FieldDescriptor> fd)  {  	// only add it if we need to. diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp index db3b9e6..24199b1 100644 --- a/src/core/model/Domain.hpp +++ b/src/core/model/Domain.hpp @@ -515,6 +515,16 @@ public:  	 *           FieldDescriptor is not registered at this Descriptor.  	 */  	ssize_t getFieldDescriptorIndex(Handle<FieldDescriptor> fd) const; +	/** +	 * Returns the FieldDescriptor with the given name. +	 * +	 * @param name the name of a FieldDescriptor. + +	 * @return     the FieldDescriptor with the given name or a nullptr if no +	 *             such FieldDescriptor was found. +	 */ +	Rooted<FieldDescriptor> getFieldDescriptor( +	    const std::string &name = DEFAULT_FIELD_NAME) const;  	/**  	 * This returns true if this Descriptor has a FieldDescriptor with the | 
