Esempio n. 1
0
AcceptedLedgerTx::AcceptedLedgerTx (Ledger::ref ledger,
    STTx::ref txn, TER result)
    : mLedger (ledger)
    , mTxn (txn)
    , mResult (result)
    , mAffected (txn->getMentionedAccounts ())
{
    buildJson ();
}
Esempio n. 2
0
AcceptedLedgerTx::AcceptedLedgerTx (Ledger::ref ledger,
    STTx::ref txn, TransactionMetaSet::ref met)
    : mLedger (ledger)
    , mTxn (txn)
    , mMeta (met)
    , mAffected (met->getAffectedAccounts ())
{
    mResult = mMeta->getResultTER ();
    buildJson ();
}
Esempio n. 3
0
AcceptedLedgerTx::AcceptedLedgerTx (Ledger::ref ledger, SerialIter& sit)
    : mLedger (ledger)
{
    // VFALCO This is making a needless copy
    auto const vl = sit.getVL();
    SerialIter txnIt (make_Slice(vl));

    mTxn =      std::make_shared<STTx> (std::ref (txnIt));
    mRawMeta =  sit.getVL ();
    mMeta =     std::make_shared<TransactionMetaSet> (mTxn->getTransactionID (),
        ledger->getLedgerSeq (), mRawMeta);
    mAffected = mMeta->getAffectedAccounts ();
    mResult =   mMeta->getResultTER ();
    buildJson ();
}
Esempio n. 4
0
void TriggerMng::parse(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCocoNode *pCocoNode)
{
    CCLOG("%s", triggerMngVersion());
    
    int count = pCocoNode[13].GetChildNum();
    stExpCocoNode *pTriggersArray = pCocoNode[13].GetChildArray(pCocoLoader);

#if CC_ENABLE_SCRIPT_BINDING
    ScriptEngineProtocol* engine = ScriptEngineManager::getInstance()->getScriptEngine();
    bool useBindings = engine != nullptr;
    
    if (useBindings)
    {
        if (count > 0 )
        {
            rapidjson::Document document;
            buildJson(document, pCocoLoader, pCocoNode);
            rapidjson::StringBuffer buffer;
            rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
            document.Accept(writer);
            
            engine->parseConfig(ScriptEngineProtocol::ConfigType::COCOSTUDIO, buffer.GetString());
        }
    }
    else
#endif // #if CC_ENABLE_SCRIPT_BINDING
    {
        for (int i = 0; i < count; ++i)
        {
            TriggerObj *obj = TriggerObj::create();
            obj->serialize(pCocoLoader, &pTriggersArray[i]);
            _triggerObjs.insert(std::pair<unsigned int, TriggerObj*>(obj->getId(), obj));
            obj->retain();
        }
    }
}
Esempio n. 5
0
void RoundConfig::saveJsonFile(std::string path) const {
  Json::Value obj = buildJson();
  cleanJsonVal(obj);
  writeJsonFile(path, obj);
}