void
AttributesImpl::addAttribute(
			const XMLCh*	uri,
			const XMLCh*	localName,
			const XMLCh*	name,
			const XMLCh*	type,
			const XMLCh*	value)
{
	assert(name != 0);
	assert(type != 0);
	assert(value != 0);

	typedef AttributeVectorEntry::XMLChVectorType	XMLChVectorType;

	if (m_attributesVector.capacity() == 0)
	{
		m_attributesVector.reserve(eDefaultVectorSize);
	}

    typedef XalanMemMgrAutoPtr<AttributeVectorEntryExtended,true> AutoPtr;

	AutoPtr	theEntry(getMemoryManager(), getNewEntry(name, type, value, uri, localName));

	// Add the new one.
	m_attributesVector.push_back(theEntry.get());

	theEntry.release();
}
示例#2
0
Task* TaskFS::FileToTask(entry_ref theEntryRef)
{
	Task*	newTask		=new Task();
	//needed for the "attribute stuff
	BFile	theFile(&theEntryRef,B_READ_ONLY);
	//needed to get out the name
	BEntry	theEntry(&theEntryRef);
	
	bool	completed;
	char	name[B_FILE_NAME_LENGTH];
	BString	taskListID;
	BString	notes;
	uint32	priority;
	time_t	due;
	BString	id;
	BString	url;	
	
	//maby do a check if everything went ok and only if so set the values
	theFile.ReadAttr("META:completed",B_BOOL_TYPE, 0, &completed, sizeof(completed));
	theEntry.GetName(name);
	theFile.ReadAttrString("META:tasks",&taskListID);
	theFile.ReadAttrString("META:notes",&notes);
	theFile.ReadAttr("META:priority", B_UINT32_TYPE, 0, &priority, sizeof(priority));
	theFile.ReadAttr("META:due", B_TIME_TYPE, 0, &due, sizeof(due));
	theFile.ReadAttrString("META:task_id", &id);
	theFile.ReadAttrString("META:task_url",&url);
	
	//** find TaskList from ID//
	
	TaskList *newTaskList = new TaskList("");
	newTaskList->SetID(taskListID);
	newTask->Complete(completed);
	newTask->SetTitle(BString(name));
	newTask->SetTaskList(newTaskList);
	newTask->SetNotes(notes);
	newTask->SetPriority(priority);
	newTask->SetDueTime(due);
	newTask->SetID(id);
	newTask->SetURL(url);
	BMessage *msg = new BMessage();
	msg->AddPointer("task",newTask);
	Looper()->SendNotices(ADD_TASK,msg);
	return newTask;
}