Ejemplo n.º 1
0
uv_err_t UVDBFDObject::init(UVDData *data)
{
	std::string file;
	UVDDataFile *dataFile = NULL;
	uv_err_t rc = UV_ERR_GENERAL;

	uv_assert_ret(data);
	if( typeid(*data) != typeid(UVDDataFile) )
	{
		return UV_DEBUG(UV_ERR_NOTSUPPORTED);
	}

	uv_assert_err(UVDObject::init(data));

	dataFile = (UVDDataFile *)data;
	file = dataFile->m_sFile;

	//FIXME: make default bfd architecture a command line option
	m_bfd = bfd_openr(file.c_str(), "default");
	if( m_bfd == NULL )
	{
		printf_error("Could not open file <%s>\n", file.c_str());
		rc = UV_DEBUG(UV_ERR_GENERAL);
		goto error;
	}

	//Needs to be an object or an archive
	if( !bfd_check_format(m_bfd, bfd_object)
			&& !bfd_check_format(m_bfd, bfd_archive) )
	{
		bfd_close(m_bfd);
		rc = UV_DEBUG(UV_ERR_NOTSUPPORTED);
		goto error;
	}
	
	//TODO: we should build the section table
	uv_assert_err(rebuildSections());

	return UV_ERR_OK;

error:
	m_data = NULL;
	return UV_DEBUG(rc);
}
Ejemplo n.º 2
0
void
JunctionRoadItem::init()
{
    // JunctionEditor //
    //
    junctionEditor_ = dynamic_cast<JunctionEditor *>(getProjectGraph()->getProjectWidget()->getProjectEditor());
    if (!junctionEditor_)
    {
        qDebug("Warning 1007041414! JunctionRoadItem not created by an JunctionEditor");
    }

    // Parent //
    //
    parentJunctionRoadSystemItem_->addRoadItem(this);

    // JunctionSection Items //
    //
    rebuildSections(true);
}