Exemple #1
0
status_t 
Model::SetTo(const entry_ref *newRef, bool traverse, bool open, bool writable)
{
	delete fNode;
	fNode = NULL;
	DeletePreferredAppVolumeNameLinkTo();
	fIconFrom = kUnknownSource;
	fBaseType = kUnknownNode;
	fMimeType = "";

	BEntry tmpEntry(newRef, traverse);
	fStatus = tmpEntry.InitCheck();
	if (fStatus != B_OK)
		return fStatus;

	if (traverse)
		tmpEntry.GetRef(&fEntryRef);
	else
		fEntryRef = *newRef;

	fStatus = tmpEntry.GetStat(&fStatBuf);
	if (fStatus != B_OK)
		return fStatus;
	
	fStatus = OpenNode(writable);
	if (!open)
		CloseNode();
	
	return fStatus;
}
Exemple #2
0
Model::Model(const Model &cloneThis)
	:
	fEntryRef(cloneThis.fEntryRef),
	fMimeType(cloneThis.fMimeType),
	fPreferredAppName(NULL),
	fBaseType(cloneThis.fBaseType),
	fIconFrom(cloneThis.fIconFrom),
	fWritable(false),
	fNode(NULL)
{
	fStatBuf.st_dev = cloneThis.NodeRef()->device;
	fStatBuf.st_ino = cloneThis.NodeRef()->node;
	
	if (cloneThis.IsSymLink() && cloneThis.LinkTo())
		fLinkTo = new Model(*cloneThis.LinkTo());

	fStatus = OpenNode(cloneThis.IsNodeOpenForWriting());
	if (fStatus == B_OK) {
		ASSERT(fNode);
		fNode->GetStat(&fStatBuf);
		ASSERT(fStatBuf.st_dev == cloneThis.NodeRef()->device);
		ASSERT(fStatBuf.st_ino == cloneThis.NodeRef()->node);
	}
	if (!cloneThis.IsNodeOpen())
		CloseNode();
}
Exemple #3
0
status_t 
Model::SetTo(const node_ref *dirNode, const node_ref *nodeRef, const char *name,
	bool open, bool writable)
{
	delete fNode;
	fNode = NULL;
	DeletePreferredAppVolumeNameLinkTo();
	fIconFrom = kUnknownSource;
	fBaseType = kUnknownNode;
	fMimeType = "";

	fStatBuf.st_dev = nodeRef->device;
	fStatBuf.st_ino = nodeRef->node;
	fEntryRef.device = dirNode->device;
	fEntryRef.directory = dirNode->node;
	fEntryRef.name = strdup(name);

	BEntry tmpNode(&fEntryRef);
	fStatus = tmpNode.InitCheck();
	if (fStatus != B_OK)
		return fStatus;
	
	fStatus = tmpNode.GetStat(&fStatBuf);
	if (fStatus != B_OK)
		return fStatus;

	fStatus = OpenNode(writable);

	if (!open)
		CloseNode();
	
	return fStatus;
}
Exemple #4
0
void CAStar::VisitNextNode(CNode* Node)
{
	size_t l_BestNode = ExtractBestFNode();
	m_CurrentNode=m_OpenNodes[l_BestNode];
	CloseNode(l_BestNode);
	ProcesarVecinos(m_CurrentNode);
}
Exemple #5
0
Model::Model(const Model& other)
	:
	fEntryRef(other.fEntryRef),
	fMimeType(other.fMimeType),
	fPreferredAppName(NULL),
	fBaseType(other.fBaseType),
	fIconFrom(other.fIconFrom),
	fWritable(false),
	fNode(NULL),
	fLocalizedName(other.fLocalizedName),
	fHasLocalizedName(other.fHasLocalizedName),
	fLocalizedNameIsCached(other.fLocalizedNameIsCached)
{
	fStatBuf.st_dev = other.NodeRef()->device;
	fStatBuf.st_ino = other.NodeRef()->node;

	if (other.IsSymLink() && other.LinkTo())
		fLinkTo = new Model(*other.LinkTo());

	fStatus = OpenNode(other.IsNodeOpenForWriting());
	if (fStatus == B_OK) {
		ASSERT(fNode);
		fNode->GetStat(&fStatBuf);
		ASSERT(fStatBuf.st_dev == other.NodeRef()->device);
		ASSERT(fStatBuf.st_ino == other.NodeRef()->node);
	}
	if (!other.IsNodeOpen())
		CloseNode();
}
Exemple #6
0
//------------------------------------------------------------------------------
void XMLTreeWriter::Write ()
{
    OpenTree();

	cur = t->GetRoot();
        count = 0;

    while (cur)
    {
        if (cur->GetChild())
        {
             count++;
             OpenNode();
             NodeInfo();
                
            stk.push (cur);
            cur = cur->GetChild();
        }
        else
        {
            count++;
            OpenNode();
            NodeInfo();
            CloseNode();
            while (!stk.empty() && (cur->GetSibling() == NULL))
            {
                CloseNode();
                cur = stk.top();
                stk.pop();
            }
            if (stk.empty())
                cur = NULL;
            else
            {
                cur = cur->GetSibling();
            }
        }
    }
    CloseTree();

}
NS_IMETHODIMP
nsLoggingSink::CloseContainer(const nsHTMLTag aTag) {

  nsresult theResult=NS_OK;

  nsHTMLTag nodeType = nsHTMLTag(aTag);
  if ((nodeType >= eHTMLTag_unknown) &&
      (nodeType <= nsHTMLTag(NS_HTML_TAG_MAX))) {
    const PRUnichar* tag = nsHTMLTags::GetStringValue(nodeType);
    theResult = CloseNode(NS_ConvertUTF16toUTF8(tag).get());
  }
  else theResult= CloseNode("???");

  //then proxy the call to the real sink if you have one.
  if(mSink) {
    theResult=mSink->CloseContainer(aTag);
  }
  
  return theResult;

}
Exemple #8
0
bool 
Model::StatChanged()
{
	ASSERT(IsNodeOpen());
	mode_t oldMode = fStatBuf.st_mode;
	fStatus = fNode->GetStat(&fStatBuf);
	if (oldMode != fStatBuf.st_mode) {
		bool forWriting = IsNodeOpenForWriting();
		CloseNode();
		//SetupBaseType();
			// the node type can't change with a stat update...
		OpenNodeCommon(forWriting);
		return true;
	}
	return false;
}
Exemple #9
0
status_t 
Model::SetTo(const BEntry *entry, bool open, bool writable)
{
	delete fNode;
	fNode = NULL;
	DeletePreferredAppVolumeNameLinkTo();
	fIconFrom = kUnknownSource;
	fBaseType = kUnknownNode;
	fMimeType = "";

	fStatus = entry->GetRef(&fEntryRef);
	if (fStatus != B_OK)
		return fStatus;
	
	fStatus = entry->GetStat(&fStatBuf);
	if (fStatus != B_OK)
		return fStatus;
	
	fStatus = OpenNode(writable);
	if (!open)
		CloseNode();
	
	return fStatus;
}