当前位置: 首页>>代码示例>>C++>>正文


C++ PyList类代码示例

本文整理汇总了C++中PyList的典型用法代码示例。如果您正苦于以下问题:C++ PyList类的具体用法?C++ PyList怎么用?C++ PyList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PyList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Handle_DeleteBookmarks

PyResult BookmarkService::Handle_DeleteBookmarks(PyCallArgs &call)
{
    if ( !(call.tuple->GetItem( 0 )->IsList()) )
    {
		sLog.Error( "BookmarkService::Handle_DeleteBookmarks()", "%s: call.tuple is of the wrong type: '%s'.  Expected PyList type.", call.client->GetName(), call.tuple->TypeString() );
		return NULL;
    }

    PyList *list = call.tuple->GetItem( 0 )->AsList();
    uint32 i;
    uint32 bookmarkID;
    std::vector<unsigned long> bookmarkIDs;

    if( list->size() > 0 )
    {
        for(i=0; i<(list->size()); i++)
        {
            bookmarkID = call.tuple->GetItem( 0 )->AsList()->GetItem(i)->AsInt()->value();
            bookmarkIDs.push_back( bookmarkID );
        }

        m_db.DeleteBookmarksFromDatabase( call.client->GetCharacterID(),&bookmarkIDs );
    }
    else
    {
		sLog.Error( "BookmarkService::Handle_DeleteBookmarks()", "%s: call.tuple->GetItem( 0 )->AsList()->size() == 0.  Expected size >= 1.", call.client->GetName() );
		return NULL;
    }

    return(new PyNone());
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:31,代码来源:BookmarkService.cpp

示例2: lock

void XBPython::Process()
{
  if (m_bInitialized)
  {
    PyList tmpvec;
    CSingleLock lock(m_vecPyList);
    for (PyList::iterator it = m_vecPyList.begin(); it != m_vecPyList.end();)
    {
      if (it->bDone)
      {
        tmpvec.push_back(*it);
        it = m_vecPyList.erase(it);
        m_vecPyList.hadSomethingRemoved = true;
      }
      else
        ++it;
    }
    lock.Leave();

    //delete scripts which are done
    tmpvec.clear(); // boost releases the XBPyThreads which, if deleted, calls OnScriptFinalized

    CSingleLock l2(m_critSection);
    if(m_iDllScriptCounter == 0 && (XbmcThreads::SystemClockMillis() - m_endtime) > 10000 )
    {
      Finalize();
    }
  }
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:29,代码来源:XBPython.cpp

示例3: PyDict

PyObject *DBRowToRow(DBResultRow &row, const char *type)
{

    PyDict *args = new PyDict();
    PyObject *res = new PyObject( type, args );

    //list off the column names:
    uint32 cc = row.ColumnCount();
    PyList *header = new PyList(cc);
    args->SetItemString("header", header);

    for(uint32 r = 0; r < cc; r++) {
        header->SetItemString(r, row.ColumnName(r));
    }

    //lines:
    PyList *rowlist = new PyList(cc);
    args->SetItemString("line", rowlist);

    //add a line entry for the row:
    for(uint32 r = 0; r < cc; r++) {
        rowlist->SetItem(r, DBColumnToPyRep(row, r));
    }

    return res;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:26,代码来源:EVEDBUtils.cpp

示例4: PyTuple

PyTuple *DBResultToTupleSet(DBQueryResult &result) {
    uint32 cc = result.ColumnCount();
    if(cc == 0)
        return new PyTuple(0);

    uint32 r;

    PyTuple *res = new PyTuple(2);
    PyList *cols = new PyList(cc);
    PyList *reslist = new PyList();
    res->items[0] = cols;
    res->items[1] = reslist;

    //list off the column names:
    for(r = 0; r < cc; r++) {
        cols->SetItemString(r, result.ColumnName(r));
    }

    //add a line entry for each result row:
    DBResultRow row;
    while(result.GetRow(row)) {
        PyList *linedata = new PyList(cc);
        reslist->items.push_back(linedata);
        for(r = 0; r < cc; r++) {
            linedata->SetItem(r, DBColumnToPyRep(row, r));
        }
    }

    return res;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:30,代码来源:EVEDBUtils.cpp

示例5: return

PyTuple *DBResultToRowList(DBQueryResult &result, const char *type) {
    uint32 cc = result.ColumnCount();
    if(cc == 0)
        return(new PyTuple(0));
    uint32 r;

    PyTuple *res = new PyTuple(2);
    PyList *cols = new PyList(cc);
    PyList *reslist = new PyList();
    res->SetItem( 0, cols );
    res->SetItem( 1, reslist );

    //list off the column names:
    for(r = 0; r < cc; r++) {
        cols->SetItemString(r, result.ColumnName(r));
    }

    //add a line entry for each result row:
    DBResultRow row;
    while(result.GetRow(row)) {
        //this could be more efficient by not building the column list each time, but cloning it instead.
        PyObject *o = DBRowToRow(row, type);
        reslist->items.push_back(o);
    }

    return res;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:27,代码来源:EVEDBUtils.cpp

示例6: PyList

PyPackedRow* InventoryItem::GetItemRow() const
{
    PyList *keywords = new PyList();
    keywords->AddItem(new_tuple(new PyString("stacksize"), new PyToken("util.StackSize")));
    keywords->AddItem(new_tuple(new PyString("singleton"), new PyToken("util.Singleton")));

    DBRowDescriptor* header = new DBRowDescriptor(keywords);
    header->AddColumn( "itemID",     DBTYPE_I8 );
    header->AddColumn( "typeID",     DBTYPE_I4 );
    header->AddColumn( "ownerID",    DBTYPE_I4 );
    header->AddColumn( "locationID", DBTYPE_I8 );
    header->AddColumn( "flagID",     DBTYPE_I2 );
    header->AddColumn( "quantity",   DBTYPE_I4 );
    header->AddColumn( "groupID",    DBTYPE_I2 );
    header->AddColumn( "categoryID", DBTYPE_I4 );
    header->AddColumn( "customInfo", DBTYPE_STR );

    //header->AddColumn( "singleton",  DBTYPE_BOOL );
    //header->AddColumn( "stacksize" , DBTYPE_I4 );

    PyPackedRow* row = new PyPackedRow( header );
    GetItemRow( row );

    return row;
}
开发者ID:careysky,项目名称:evemu_server,代码行数:25,代码来源:InventoryItem.cpp

示例7: PyGet

void ItemAttributeMgr::Clear(Attr attr) {
    PyRep *oldValue = NULL;
    if(GetNotify() == true && !IsRechargable(attr)) {
        // get old value
        oldValue = PyGet(attr);
    }
    // clear the attribute
    EVEAdvancedAttributeMgr::Clear(attr);
    // delete the attribute from DB (no matter if it really is there)
    if(GetSave() == true) {
        m_factory.db().EraseAttribute(m_item.itemID(), attr);
    }
    if(GetNotify() == true) {
        std::map<Attr, TauCap>::const_iterator i = m_tauCap.find(attr);
        if(i != m_tauCap.end()) {
            // build the special list for rechargables
            PyList *l = new PyList;

            l->AddItem( PyGet( attr ) );
            l->AddItemLong( Win32TimeNow() );
            l->AddItem( _PyGet( GetReal( i->second.tau ) / 5.0 ) );
            l->AddItem( PyGet( i->second.cap ) );

            oldValue = l;
        }
        // send change
        _SendAttributeChange(attr, oldValue, new PyFloat(GetReal(attr)));
    }
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:29,代码来源:EVEAttributeMgr.cpp

示例8: DBResultToIntIntlistDict

/**
 * this function isn't used.
 */
void DBResultToIntIntlistDict( DBQueryResult &result, std::map<int32, PyRep *> &into ) {
    /* this builds a map from the int in result[0], to a list of each result[1]
     * which is has the same result[0]. This function assumes the result is
     * ORDER BY result[0]
     */
    uint32 last_key = 0xFFFFFFFF;

    PyList *l = NULL;

    DBResultRow row;
    while( result.GetRow( row ) )
    {
        uint32 k = row.GetUInt(0);
        if( k != last_key )
        {
            //watch for overwrite, no guarantee we are dealing with a key.
            std::map<int32, PyRep *>::iterator res = into.find(k);
            if( res != into.end() )
                //log an error or warning?
                PyDecRef( res->second );

            into[k] = l = new PyList();
            last_key = k;
        }

        l->AddItemInt( row.GetInt( 1 ) );
    }
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:31,代码来源:EVEDBUtils.cpp

示例9: PyTuple

PyTuple *Character::GetSkillQueue() {
    // return skills from skill queue
    PyList *list = new PyList;

    SkillQueue::iterator cur, end;
    cur = m_skillQueue.begin();
    end = m_skillQueue.end();
    for(; cur != end; cur++)
    {
        SkillQueue_Element el;

        el.typeID = cur->typeID;
        el.level = cur->level;

        list->AddItem( el.Encode() );
    }

	// now encapsulate it in a tuple with the free points
	PyTuple *tuple = new PyTuple(2);
	tuple->SetItem(0, list);
	// sending 0, as done on retail, doesn't fuck up calculation for some reason
	// so we can take the same shortcut here
	tuple->SetItem(1, new PyInt(0));

    return tuple;
}
开发者ID:Logomorph,项目名称:evemu_crucible,代码行数:26,代码来源:Character.cpp

示例10: Win32TimeNow

void Webifier::StopCycle(bool abort)
{
    double timeLeft = m_AMPC->GetRemainingCycleTimeMS();
    timeLeft /= 100;

    // Create Special Effect:
    m_Ship->GetPilot()->GetShipSE()->DestinyMgr()->SendSpecialEffect
    (
        m_Ship,
        m_Item->itemID(),
        m_Item->typeID(),
        m_targetID,
        0,
        "effect.decreaseTargetSpeed",
        0,
        0,
        0,
        timeLeft,
        0
     );

    // Create Destiny Updates:
    GodmaOther go;
        go.shipID = m_Ship->itemID();
        go.slotID = m_Item->flag();
        go.chargeTypeID = 0;

    GodmaEnvironment ge;
        ge.selfID = m_Item->itemID();
        ge.charID = m_Ship->ownerID();
        ge.shipID = go.shipID;
        ge.targetID = m_targetID;
        ge.other = go.Encode();
        ge.area = new PyList;
        ge.effectID = effectDecreaseTargetSpeed;

    Notify_OnGodmaShipEffect shipEff;
        shipEff.itemID = ge.selfID;
        shipEff.effectID = ge.effectID;
        shipEff.timeNow = Win32TimeNow();
        shipEff.start = 0;
        shipEff.active = 0;
        shipEff.environment = ge.Encode();
        shipEff.startTime = (shipEff.timeNow - (timeLeft * Win32Time_Second));
        shipEff.duration = timeLeft;
        shipEff.repeat = 0;
        shipEff.error = new PyNone;

    PyList* events = new PyList;
        events->AddItem(shipEff.Encode());

    Notify_OnMultiEvent multi;
        multi.events = events;

    PyTuple* tmp2 = multi.Encode();

    m_Ship->GetPilot()->SendNotification("OnMultiEvent", "clientID", &tmp2);
}
开发者ID:Vortex24,项目名称:evemu-Mainserver,代码行数:58,代码来源:Webifier.cpp

示例11: Win32TimeNow

void EnergyTurret::Deactivate() 
{
	Notify_OnGodmaShipEffect shipEff;
	shipEff.itemID = m_Item->itemID();
	shipEff.effectID = 10;
	shipEff.when = Win32TimeNow();
	shipEff.start = 0;
	shipEff.active = 0;

	PyList* env = new PyList;
	env->AddItem(new PyInt(shipEff.itemID));
	env->AddItem(new PyInt(m_Ship->ownerID()));
	env->AddItem(new PyInt(m_Ship->itemID()));
	env->AddItem(new PyInt(targetID));
	env->AddItem(new PyNone);
	env->AddItem(new PyNone);
	env->AddItem(new PyInt(10));

	shipEff.environment = env;
	shipEff.startTime = shipEff.when;
	shipEff.duration = 1584;
	shipEff.repeat = new PyInt(0);
	shipEff.randomSeed = new PyNone;
	shipEff.error = new PyNone;

	PyList* events = new PyList;
	events->AddItem(shipEff.Encode());

	Notify_OnMultiEvent multi;
	multi.events = events;

	PyTuple* tmp = multi.Encode();

	m_Ship->GetOperator()->SendDogmaNotification("OnMultiEvent", "clientID", &tmp);
}
开发者ID:B3N4K,项目名称:evemu_server,代码行数:35,代码来源:EnergyTurret.cpp

示例12: PyList

PyList *TargetManager::GetTargeters() const {
    PyList *result = new PyList();

    std::map<SystemEntity *, TargetedByEntry *>::const_iterator cur, end;
    cur = m_targetedBy.begin();
    end = m_targetedBy.end();
    for(; cur != end; cur++)
        result->AddItemInt( cur->first->GetID() );

    return result;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:11,代码来源:TargetManager.cpp

示例13: DoCycle

void MissileLauncher::StopCycle(bool abort)
{
	// Do one last cycle:
	DoCycle();

	Notify_OnGodmaShipEffect shipEff;
	shipEff.itemID = m_Item->itemID();
	shipEff.effectID = effectMissileLaunching;
	shipEff.when = Win32TimeNow();
	shipEff.start = 0;
	shipEff.active = 0;

	PyList* env = new PyList;
	env->AddItem(new PyInt(shipEff.itemID));
	env->AddItem(new PyInt(m_Ship->ownerID()));
	env->AddItem(new PyInt(m_Ship->itemID()));
	env->AddItem(new PyInt(m_targetID));
	env->AddItem(new PyNone);
	env->AddItem(new PyNone);
	env->AddItem(new PyInt(shipEff.effectID));

	shipEff.environment = env;
	shipEff.startTime = shipEff.when;
	shipEff.duration = 1.0;		//m_ActiveModuleProc->GetRemainingCycleTimeMS();		// At least, I'm assuming this is the remaining time left in the cycle
	shipEff.repeat = new PyInt(0);
	shipEff.randomSeed = new PyNone;
	shipEff.error = new PyNone;

	PyList* events = new PyList;
	events->AddItem(shipEff.Encode());

	Notify_OnMultiEvent multi;
	multi.events = events;

	PyTuple* tmp = multi.Encode();

	m_Ship->GetOperator()->SendDogmaNotification("OnMultiEvent", "clientID", &tmp);

	// Create Special Effect:
	m_Ship->GetOperator()->GetDestiny()->SendSpecialEffect
	(
		m_Ship,
		m_Item->itemID(),
		m_Item->typeID(),
		m_targetID,
		m_chargeRef->itemID(),
		"effects.MissileDeployment",
		1,
		0,
		0,
		1.0,
		0
	);

	m_ActiveModuleProc->DeactivateCycle();
}
开发者ID:Almamu,项目名称:evemu_server,代码行数:56,代码来源:MissileLauncher.cpp

示例14: assert

PyDict* CRowSet::_CreateKeywords(DBRowDescriptor* rowDesc)
{
	assert( rowDesc );

	PyDict* keywords = new PyDict;
	keywords->SetItemString( "header", rowDesc );

	uint32 cc = rowDesc->ColumnCount();
	PyList* columns = new PyList( cc );
	for( uint32 i = 0; i < cc; i++ )
		columns->SetItem( i,  new PyString( *rowDesc->GetColumnName( i ) ) );
	keywords->SetItemString( "columns", columns );

	return keywords;
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:15,代码来源:PyDatabase.cpp

示例15: DBRowDescriptor

PyList *DBResultToPackedRowList( DBQueryResult &result )
{
    DBRowDescriptor *header = new DBRowDescriptor( result );

    PyList *res = new PyList( result.GetRowCount() );

    DBResultRow row;
    for( uint32 i = 0; result.GetRow( row ); i++ )
    {
        res->SetItem( i, CreatePackedRow( row, header ) );
        PyIncRef( header );
    }

    PyDecRef( header );
    return res;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:16,代码来源:EVEDBUtils.cpp


注:本文中的PyList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。