Esempio n. 1
0
void XMLReader::ResetToBeginning()
{
	while (nodeStack.top() != highLevelNode)
	{
		nodeStack.pop();
	}

	SetTopNode();//indicate current node (should always be high level node by this point)
}
Esempio n. 2
0
bool XMLReader::MoveToPrevSiblingNode()
{
	XMLNode sibling = topNode->previous_sibling();

	if(sibling)
	{
		//Set the top of the stack to the sibling so if we go into children, 
		//when we pop we are at last used sibling
		nodeStack.top() = sibling; 

		SetTopNode(sibling);
	}
	return sibling != NULL;
}
Esempio n. 3
0
bool XMLReader::MoveToChildNode()
{
	XMLNode child = topNode->first_node();//Grab the child

	if(child)//If valid
	{
		//Add to stack and save the top
		nodeStack.push(child);
		SetTopNode();
	}

	//Return that its not null
	return child != NULL;
}
Esempio n. 4
0
void wxTreeLayout::DoLayout(wxDC& dc, long topId)
{
    if (topId != wxID_ANY)
        SetTopNode(topId);

    long actualTopId = GetTopNode();
    long id = actualTopId;
    while (id != wxID_ANY)
    {
        SetNodeX(id, 0);
        SetNodeY(id, 0);
        ActivateNode(id, false);
        id = GetNextNode(id);
    }
    m_lastY = m_topMargin;
    m_lastX = m_leftMargin;
    CalcLayout(actualTopId, 0, dc);
}
Esempio n. 5
0
bool XMLReader::OpenFile(std::string fileName)
{
	try
	{
		xmlFile = new XMLFile(fileName.c_str());
	}
	//Only check for exception because Bad Alloc and Runtime Error inherit from exception and we aren't doing
	//any special per-case error handling
	catch(std::exception e)
	{
#ifdef _DEBUG
		Ogre::LogManager::getSingletonPtr()->getDefaultLog()->logMessage(e.what(), Ogre::LML_CRITICAL);
#endif // _DEBUG

		if(xmlFile)
		{
			delete xmlFile;
			xmlFile = NULL;
		}
		return false;
	}

	if(xmlFile)
		if(xmlFile->size() > 0 && xmlFile->data())
		{
			try
			{
				xmlDocument = new XMLDocument();
				//Parse no data nodes so that children will equal NULL if there are no children (otherwise blank nodes are created 
				//for nodes without children)
				xmlDocument->parse<rapidxml::parse_no_data_nodes>(xmlFile->data());
			}
			//We only check for exception because rapid xml Parse Error inherits std::exception and
			//we don't need special per-case error handling
			catch(rapidxml::parse_error e)
			{
#ifdef _DEBUG
				Ogre::LogManager::getSingletonPtr()->getDefaultLog()->logMessage(std::string("XML Reader Open File Error: ").append(e.what()), Ogre::LML_CRITICAL);
#endif // _DEBUG
				if(xmlDocument)
				{
					delete xmlDocument;
					xmlDocument = NULL;
				}

				if(xmlFile)
				{
					delete xmlFile;
					xmlFile = NULL;
				}

				return false;
			}
			
			rootNode = xmlDocument->first_node();//if everything loaded, set the root node
			highLevelNode = rootNode->first_node();//if everything loaded, set the first node under the root
			
			//Add both to the stack
			nodeStack.push(rootNode);
			nodeStack.push(highLevelNode);

			SetTopNode();
			
			return true;
		}

	return false;
}