Beispiel #1
0
XMLTag* XMLTag::GetEmbeddedTagByNameAndAttr(const char* tagName, const char* attrName, const char* attrValue, const UInt32 index)
{
    if (fEmbeddedTags.GetLength() <= index)
        return NULL;
    
    XMLTag* result = NULL;
    UInt32 curIndex = 0;
    for (OSQueueIter iter(&fEmbeddedTags); !iter.IsDone(); iter.Next())
    {
        XMLTag* temp = (XMLTag*)iter.GetCurrent()->GetEnclosingObject();
        if (!strcmp(temp->GetTagName(), tagName) && (temp->GetAttributeValue(attrName) != NULL) && 
            (!strcmp(temp->GetAttributeValue(attrName), attrValue)))
        {
            if (curIndex == index)
            {
                result = temp;
                break;
            }
                
            curIndex++;
        }
    }
    
    return result;
}
Beispiel #2
0
void RCFSourceInfo::ParseRelayDestinations(XMLTag* relayTag)
{
	// parse the NAME attribute of the relay tag and store it in the relayname attribute
	char* name = relayTag->GetAttributeValue("NAME");
	if (name != NULL)
	{
		fName = new char[::strlen(name) + 1];
		::strcpy(fName, name);
	}

	UInt32 numTags = relayTag->GetNumEmbeddedTags();
	AllocateOutputArray(numTags);   // not all these are relay tags, but most are

	// Now actually go through and figure out what to put into these OutputInfo structures,
	// based on what's on the relay_destination line
	fNumOutputs = 0;
	for (UInt32 y = 0; y < numTags; y++)
	{
		XMLTag* destTag = relayTag->GetEmbeddedTagByNameAndAttr("OBJECT", "CLASS", "destination", y);
		if (destTag == NULL)
			return;

		char* destType = destTag->GetAttributeValue("TYPE");
		if (destType == NULL)
			return;

		if (!strcmp(destType, "udp_destination"))
			ParseDestination(destTag, y);
		else if (!strcmp(destType, "announced_destination"))
			ParseAnnouncedDestination(destTag, y);

		fNumOutputs++;
	}
}