functionfind_childprivate
integer function find_child(list, parent, name, entity) result(found)
The child of parent named name, or 0.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| list | type(entity_list_t) | in | the entities | |
| parent | integer | in | the entity | |
| name | character(len=*) | in | the name, in lowercase | |
| entity | character(len=*) | in | the class, in lowercase |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| found | integer |
Calls
Source
Show the code
integer function find_child(list, parent, name, entity) result(found)
type(entity_list_t), intent(in) :: list !! the entities
integer, intent(in) :: parent !! the entity
character(len=*), intent(in) :: name !! the name, in lowercase
character(len=*), intent(in) :: entity !! the class, in lowercase
integer :: k
found = 0
associate (e => list%box(parent)%e)
do k = 1, size(e%children)
if (matches(list, e%children(k), name, entity)) then
found = e%children(k)
return
end if
end do
if (.not. allocated(e%more%inherited)) return
do k = 1, size(e%more%inherited)
if (matches(list, e%more%inherited(k), name, entity)) then
found = e%more%inherited(k)
return
end if
end do
end associate
end function find_child