summaryrefslogtreecommitdiff
path: root/src/SSystem/SComponent/c_tree_iter.cpp
blob: 9446dbd52c639e5774ff2124637c5b159cc8c99c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
 * c_tree_iter.cpp
 *
 */

#include "SSystem/SComponent/c_tree_iter.h"
#include "SSystem/SComponent/c_list.h"
#include "SSystem/SComponent/c_list_iter.h"
#include "SSystem/SComponent/c_tree.h"
#include <types.h>

int cTrIt_Method(node_lists_tree_class* tree, cNdIt_MethodFunc method, void* data) {
    node_list_class* list = tree->mpLists;
    int i = tree->mNumLists;
    int ret = 1;
    while (i-- > 0) {
        if (cLsIt_Method(list++, method, data) == 0)
            ret = 0;
    }
    return ret;
}

void* cTrIt_Judge(node_lists_tree_class* tree, cNdIt_JudgeFunc judge, void* data) {
    node_list_class* list = tree->mpLists;
    int i = tree->mNumLists;
    void* pJudgeRet;

    while (i-- > 0) {
        pJudgeRet = cLsIt_Judge(list++, judge, data);
        if (pJudgeRet != NULL)
            return pJudgeRet;
    }

    return NULL;
}