Ejemplo n.º 1
0
bool MAPS::OpenMap(HWND hMaps, const char* fileName)
{
	MapNode* newMap = new MapNode;

	if ( newMap->map.LoadFile(fileName) )
	{
		if ( newMap->map.setHandle( AddMDIChild(hMaps, fileName) ) )
		{
			SetWindowText(newMap->map.getHandle(), fileName);
			PushNode(newMap);
			Focus(newMap->map.getHandle());
			curr->Scroll(SCROLL_X|SCROLL_Y);
			curr->Redraw(true);
			return true;
		} 
		else
		{
			delete newMap;
			Error("Failed to create MDI Child Window!");
		}
	}
	else
	{
		delete newMap;
		Error(LastError);
	}

	return false;
}
void CreateRegexTree(std::string regex)
{
	Node *auxNode;
	regexTree = NULL;
	for (int i = 0; i < regex.length(); i++)
	{
		auxNode = new Node;
		auxNode->value = regex[i];
		auxNode->left = NULL;
		auxNode->right = NULL;
		auxNode->next = NULL;

		if (regex[i] == '.' || regex[i] == '|')
		{
			auxNode->right = PopNode();
			auxNode->left = PopNode();
		}
		else if (regex[i] == '*')
		{
			auxNode->left = PopNode();
			auxNode->right = NULL;
		}
		PushNode(auxNode);
	}
}
Ejemplo n.º 3
0
bool MAPS::NewMap(u16 width, u16 height, u16 tileset, u32 terrain, u32 triggers, HWND hMaps)
{
	MapNode* newMap = new MapNode;
	
	if ( newMap->map.CreateNew(width, height, tileset, terrain, triggers) )
	{
		char title[256] = { "Untitled" };
		if ( UntitledNumber > 0 )
			sprintf_s(title, 256, "Untitled %d", UntitledNumber);

		if ( newMap->map.setHandle(AddMDIChild(hMaps, title)) )
		{
			curr = &newMap->map;
			UntitledNumber++;
			PushNode(newMap);
			Focus(newMap->map.getHandle());
			curr->Redraw(true);
			return true;
		}
		else
		{
			delete newMap;
			Error("Failed to create MDI Child Window!");
		}
	}
	else
	{
		CHKD_ERR("Failed to create scenario file!\n\nError in %s\n\n%s", LastErrorLoc, LastError);
		Error(LastError);
	}

	return false;
}
Ejemplo n.º 4
0
NS_IMETHODIMP
inDeepTreeWalker::NextSibling(nsIDOMNode **_retval)
{
  *_retval = nullptr;
  if (!mCurrentNode) {
    return NS_OK;
  }

  NS_ASSERTION(mStack.Length() > 0, "Should have things in mStack");

  if (mStack.Length() == 1) {
    // No next sibling
    return NS_OK;
  }

  DeepTreeStackItem& parent = mStack.ElementAt(mStack.Length()-2);
  nsCOMPtr<nsIDOMNode> nextSibling;
  parent.kids->Item(parent.lastIndex, getter_AddRefs(nextSibling));
  if (!nextSibling) {
    return NS_OK;
  }

  // Our mStack's topmost element is our current node. Since we're trying to
  // change that to the next sibling, pop off the current node, and push
  // the new one.
  mStack.RemoveElementAt(mStack.Length() - 1);
  parent.lastIndex++;
  PushNode(nextSibling);
  nextSibling.forget(_retval);
  return NS_OK;
}
Ejemplo n.º 5
0
NS_IMETHODIMP
inDeepTreeWalker::Init(nsIDOMNode* aRoot, uint32_t aWhatToShow)
{
  mRoot = aRoot;
  mWhatToShow = aWhatToShow;
  
  PushNode(aRoot);

  return NS_OK;
}
Ejemplo n.º 6
0
Archivo: prob_1.c Proyecto: rohandev/C
main() {
	struct node * HEADL1 = NULL;
	struct node * HEADL2 = NULL;

	PushNode(&HEADL1,9);
	PushNode(&HEADL1,7);
	PushNode(&HEADL1,5);
	PushNode(&HEADL1,2);
	PushNode(&HEADL1,1);
	PrintList(HEADL1);

	PushNode(&HEADL2,8);
	PushNode(&HEADL2,4);
	PushNode(&HEADL2,3);
	PrintList(HEADL2);

	struct node* dummyHEAD = NULL;
	dummyHEAD = MergeTwoSortedList(HEADL1, HEADL2);
	PrintList(dummyHEAD);
}
Ejemplo n.º 7
0
NS_IMETHODIMP
inDeepTreeWalker::FirstChild(nsIDOMNode **_retval)
{
  *_retval = nullptr;
  if (!mCurrentNode) {
    return NS_OK;
  }

  DeepTreeStackItem& top = mStack.ElementAt(mStack.Length() - 1);
  nsCOMPtr<nsIDOMNode> kid;
  top.kids->Item(0, getter_AddRefs(kid));
  if (!kid) {
    return NS_OK;
  }
  top.lastIndex = 1;
  PushNode(kid);
  kid.forget(_retval);
  return NS_OK;
}
Ejemplo n.º 8
0
//moves onto the next element (either a value or list). If the current
//element is a list, it will be searched through recursively. Calling this continually
//will iterate through all elements in the tree. Returns NULL if no more
CLTANode* CLTANodeIterator::NextElement()
{
	//sanity checks
	ASSERT(GetHead());

	//get the current element

	CLTANode* pCurr = NULL;

	if(GetElementIndex() < GetHead()->GetNumElements())
	{
		pCurr = GetHead()->GetElement(GetElementIndex());
	}
	else
	{
		//pop the stack if we can
		if(m_nStackPos == 0)
		{
			//we can't pop!
			return NULL;
		}

		//pop the node
		PopNode();

		return NextElement();
	}

	//okay, we have successfully found an item, we need to move onto the next one

	SetElementIndex(GetElementIndex() + 1);

	//if the current is a list, we need to pop into it
	if(pCurr->IsList())
	{
		PushNode(pCurr);
	}

	return pCurr;
}
Ejemplo n.º 9
0
void CJsonNode::PushNull()
{
    PushNode(new SJsonFixedSizeNodeImpl);
}
Ejemplo n.º 10
0
void CJsonNode::PushBoolean(bool value)
{
    PushNode(new SJsonFixedSizeNodeImpl(value));
}
Ejemplo n.º 11
0
void CJsonNode::PushNumber(CJsonNode::TNumber value)
{
    PushNode(new SJsonFixedSizeNodeImpl(value));
}
Ejemplo n.º 12
0
void CJsonNode::PushString(const string& value)
{
    PushNode(new SJsonStringNodeImpl(value));
}