const bool SyntaxNode::FindElements( Element::List& CLI_ExactList, Element::List& CLI_NearList, const char* const STR_Keyword ) const { // For each child... for ( Element::List::Iterator it = m_cliElements.GetIterator(); m_cliElements.IsValid(it); m_cliElements.MoveNext(it)) { if (const Element* const pcli_Element = m_cliElements.GetAt(it)) { if (0) {} else if (const SyntaxTag* const pcli_Tag = dynamic_cast<const SyntaxTag*>(pcli_Element)) { // Propagate call over child non hollow tag. if (! pcli_Tag->GetbHollow()) { if (! pcli_Tag->FindElements(CLI_ExactList, CLI_NearList, STR_Keyword)) { return false; } } } else if (const SyntaxRef* const pcli_Ref = dynamic_cast<const SyntaxRef*>(pcli_Element)) { // Propagate call over referenced tag. if (! pcli_Ref->GetTag().FindElements(CLI_ExactList, CLI_NearList, STR_Keyword)) { return false; } } else if (STR_Keyword == NULL) { // No keyword begun. // Retrieve all sub-elements. if (! CLI_NearList.AddTail(pcli_Element)) { GetTraces().Trace(INTERNAL_ERROR) << "SyntaxNode::FindElements(): Not enough space in CLI_ExactList." << endl; } } else { // A beginning of word has been given. const tk::String str_Keyword(MAX_WORD_LENGTH, STR_Keyword); if (const Param* const pcli_Param = dynamic_cast<const Param*>(pcli_Element)) { // If the child element is a parameter, check SetstrValue() works for it. if (str_Keyword != "\n") { if (pcli_Param->SetstrValue(str_Keyword)) { if (! CLI_NearList.AddTail(pcli_Param)) { GetTraces().Trace(INTERNAL_ERROR) << "SyntaxNode::FindElements(): Not enough space in CLI_ExactList." << endl; } if (! CLI_ExactList.AddTail(pcli_Param)) { GetTraces().Trace(INTERNAL_ERROR) << "SyntaxNode::FindElements(): Not enough space in CLI_ExactList." << endl; } } } } else if (pcli_Element->GetKeyword().SubString(0, str_Keyword.GetLength()) == str_Keyword) { // Check the beginning of the word for other elements. if (! CLI_NearList.AddTail(pcli_Element)) { GetTraces().Trace(INTERNAL_ERROR) << "SyntaxNode::FindElements(): Not enough space in CLI_ExactList." << endl; } if (str_Keyword.GetLength() == pcli_Element->GetKeyword().GetLength()) { if (! CLI_ExactList.AddTail(pcli_Element)) { GetTraces().Trace(INTERNAL_ERROR) << "SyntaxNode::FindElements(): Not enough space in CLI_ExactList." << endl; } } } } } } return true; }