Пример #1
0
void Nepomuk::Annotation::create( Resource res )
{
    kDebug() << res.resourceUri();
    // call a protected method to be open for future extensions at
    // this place.
    doCreate( res );
}
Пример #2
0
 void NewGame::onKeyDown(Event::Keyboard* event)
 {
     switch (event->keyCode())
     {
         case SDLK_ESCAPE:
         case SDLK_b:
             doBack();
             break;
         case SDLK_t:
             doBeginGame();
             break;
         case SDLK_c:
             doCreate();
             break;
         case SDLK_m:
             doEdit();
             break;
         case SDLK_LEFT:
             doPrev();
             break;
         case SDLK_RIGHT:
             doNext();
             break;
     }
 }
Пример #3
0
/// Returns the Id of the loaded model.
Id Shell::doLoadModel( const string& fileName, const string& modelPath, const string& solverClass )
{
    ifstream fin( fileName.c_str() );
    if ( !fin )
    {
        LOG( moose::failed, "Shell::doLoadModel: could not open file " << fileName );
        return Id();
    }

    string modelName;
    Id parentId;

    if ( !( findModelParent ( cwe_, modelPath, parentId, modelName ) ) )
        return Id();

    string line;
    switch ( findModelType( fileName, fin, line ) )
    {
    case DOTP:
    {
        ReadCell rc;
        return rc.read( fileName, modelName, parentId );
        return Id();
    }
    case SWC:
    {
        LOG( moose::info, "In doLoadModel for SWC" );
        ReadSwc rs( fileName );
        Id model = parentId;
        if ( !parentId.element()->cinfo()->isA( "Neuron" ) )
        {
            model = doCreate( "Neuron", parentId, modelName, 1 );
        }
        rs.build( model, 0.5e-3, 1.0, 1.0, 0.01 );
        return model;
    }
    case KKIT:
    {
        string sc = solverClass;
        ReadKkit rk;
        Id ret = rk.read( fileName, modelName, parentId, sc);
        return ret;
    }
    break;
    case CSPACE:
    {
        string sc = solverClass;
        ReadCspace rc;
        Id ret = rc.readModelString( line, modelName, parentId, sc);
        rc.makePlots( 1.0 );
        return ret;
    }
    case UNKNOWN:
    default:
        cout << "Error: Shell::doLoadModel: File type of '" <<
             fileName << "' is unknown\n";
    }
    return Id();
}
Пример #4
0
Id Shell::create(string type, string name, unsigned int numData
        , NodePolicy nodePolicy, unsigned int preferredNode 
        ) 
{
    if(name.size() == 0)
        return doCreate(type, Id(), name, numData, nodePolicy, preferredNode);

    string::size_type pos = name.find_last_of('/');
    string parentPath = name.substr(0, pos);
    ObjId parentObj = ObjId(parentPath);
    //cerr << "info: Creating Obj with parent : " << parentObj << endl;
    Id id = doCreate(type, parentObj, name.substr(pos+1)
            , numData, nodePolicy, preferredNode
            );
    //cerr << "    ++ with id " << id << endl;
    return id;
}
Пример #5
0
bool BaseFile::create(const std::string & filename)
{
	if(!doCreate(filename)) return false;
	
	setFileName(filename);
	setOpened();
	return true;
}
Пример #6
0
tpGLRenderSurfaceWin32::tpGLRenderSurfaceWin32( tpRenderSurfaceTraits* traits )
:    _handle(0),
	_dc(0),
	_context(0),
	_instance(0),
	tpRenderSurface( traits )	
{
	doCreate();
}
Пример #7
0
void context::init( HWND hwnd )
{
	precondition( _hrc == nullptr, "expect uninitialized context" );
	_hdc = GetDC( hwnd );
	_hrc = doCreate( _hdc, coreContext );

	wglMakeCurrent( _hdc, _hrc );

	if ( !gl3wIsSupported( 3, 3 ) )
		throw_runtime( "OpenGL 3.3 not supported" );
}
Пример #8
0
  Component* ComponentFactory::create(const tnt::Compident& ci,
    const tnt::Urlmapper& um, tnt::Comploader& cl)
  {
    if (theComponent == 0)
    {
      doConfigure(TntConfig::it());
      theComponent = doCreate(ci, um, cl);
    }

    return theComponent;
  }
Пример #9
0
 AppLauncher& AppLauncher::create(const UknString& cfgname) {
     if(!mInited) {
         mist::File::DeleteFile(L"ukn_log.txt");
         mInited = true;
     
         Context::Instance().loadCfgFile(cfgname);
         doCreate();
     } else {
         MIST_THROW_EXCEPTION(L"app already created");
     }
     return *this;
 }
nsFont::nsFont(const wxFont& font, int size)
{
	// wxInitAllImageHandlers();
	m_imaData       = 0;
	m_offset        = 0;
	m_tex           = 0;
	m_width         = 2;
	m_height        = 2;
	m_baseHeight    = 2;
	m_res           = size;
	m_font          = font;
	doCreate();
}
Пример #11
0
 AppLauncher& AppLauncher::create(const ContextCfg& cfg) {
     if(!mInited) {
         mist::File::DeleteFile(L"ukn_log.txt");
         mInited = true;
     
         Context::Instance().setCfg(cfg);
         
         FrameCounter::Instance().setDesiredFps(cfg.desired_fps);
         doCreate();
     } else {
         MIST_THROW_EXCEPTION(L"app already created");
     }
     return *this;
 }
Пример #12
0
/**
	@brief Implement the class-specific methods.
	@param ctx Pointer to the method context.
	@return Zero if successful, or -1 if not.

	Branch on the method type: create, retrieve, update, delete, search, or id_list.

	The method parameters and the type of value returned to the client depend on the method
	type.
*/
int dispatchCRUDMethod( osrfMethodContext* ctx ) {

	// Get the method type, then can branch on it
	osrfHash* method_meta = (osrfHash*) ctx->method->userData;
	const char* methodtype = osrfHashGet( method_meta, "methodtype" );

	if( !strcmp( methodtype, "create" ))
		return doCreate( ctx );
	else if( !strcmp(methodtype, "retrieve" ))
		return doRetrieve( ctx );
	else if( !strcmp(methodtype, "update" ))
		return doUpdate( ctx );
	else if( !strcmp(methodtype, "delete" ))
		return doDelete( ctx );
	else if( !strcmp(methodtype, "search" ))
		return doSearch( ctx );
	else if( !strcmp(methodtype, "id_list" ))
		return doIdList( ctx );
	else {
		osrfAppRespondComplete( ctx, NULL );      // should be unreachable...
		return 0;
	}
}
    void addPart(const char *partname, const char *xml, unsigned updateFlags, StringArray &filesNotFound)
    {
        init();

        if (!pmExisting)
        {
            doCreate(partname, xml, updateFlags, filesNotFound);
            return;
        }

        createPart(partname, xml);

        VStringBuffer xpath("Part[@id='%s']", partname);
        IPropertyTree *existingPart = pmExisting->queryPropTree(xpath);
        if (existingPart && !checkFlag(PKGADD_SEG_REPLACE))
            throw MakeStringException(PKG_NAME_EXISTS, "Package Part %s already exists, remove, or specify 'delete previous'", partname);

        cloneDfsInfo(updateFlags, filesNotFound);

        if (existingPart)
            pmExisting->removeTree(existingPart);

        pmExisting->addPropTree("Part", pmPart.getClear());
    }
Пример #14
0
 void NewGame::onCreateButtonClick(Event::Mouse* event)
 {
     doCreate();
 }
 void create(const char *partname, const char *xml, unsigned updateFlags, StringArray &filesNotFound)
 {
     init();
     doCreate(partname, xml, updateFlags, filesNotFound);
 }
Пример #16
0
void main()
{
    doCreate();
    Cashier();
    Exit(0);
}
Пример #17
0
bool CHistoryManager::doDelete(	SAction* action, bool redo )
{	
	return doCreate( action, !redo );
}
Пример #18
0
bool CHistoryManager::redo()
{
	if ( m_redoAction.size() == 0 )	
		return false;	

	getIView()->getDocument()->clearSelect();		

	m_disable = true;

	HistoryAction lastAction = m_redoAction.back();
	SAction* action;

	bool isFailed = false;

	HistoryAction::iterator i = lastAction.begin(), end = lastAction.end();
	while ( i != end )
	{
		action = &(*i);

		if ( action->actionType == CHistoryManager::CreateObject )
		{		
			if ( doCreate( action, true ) == false )
			{
				isFailed = true;
				break;
			}
		}
		
		if ( action->actionType == CHistoryManager::DeleteObject )
		{
			if ( doDelete( action, true ) == false )
			{
				isFailed = true;
				break;
			}
		}
		
		if ( action->actionType == CHistoryManager::ModifyObject )
		{			
			if ( doModify( action, true ) == false )
			{
				isFailed = true;
				break;
			}
		}

		++i;
	}

	if ( isFailed == true )
	{
		m_redoAction.clear();
		m_undoAction.clear();
		return false;
	}
	else
	{
		m_undoAction.push_back( lastAction );
		m_redoAction.pop_back();		
	}


	// update box
	getIView()->setObjectProperty( NULL );
	m_disable = false;

	return true;
}
Пример #19
0
bool CHistoryManager::undo()
{
	if ( m_undoAction.size() == 0 )
		return false;	

	getIView()->getDocument()->clearSelect();		

	m_disable = true;

	HistoryAction lastAction = m_undoAction.back();
	SAction* action;

	bool isFailed = false;	
	
	int nAction = lastAction.size();
	for ( int iAction = nAction - 1; iAction >= 0; iAction-- )
	{
		action = &lastAction[iAction];

		if ( action->actionType == CHistoryManager::CreateObject )
		{
			if ( doCreate( action ) == false )
			{
				isFailed = true;
				break;
			}
		}
		
		if ( action->actionType == CHistoryManager::DeleteObject )
		{
			if ( doDelete( action ) == false )
			{
				isFailed = true;
				break;
			}
		}
		
		if ( action->actionType == CHistoryManager::ModifyObject )
		{
			if ( doModify( action ) == false )
			{
				isFailed = true;
				break;
			}
		}
	}

	if ( isFailed == true )
	{				
		m_redoAction.clear();
		m_undoAction.clear();
	}
	else
	{
		m_redoAction.push_back( lastAction );
		m_undoAction.pop_back();
	}
	
	getIView()->setObjectProperty( NULL );
	m_disable = false;

	return true;
}