bool RDORuntime::equal(const LPRDORuntime& pOther) const { if (pOther->m_resourceListByID.size() != m_resourceListByID.size()) return false; const std::size_t size = m_resourceListByID.size(); for (std::size_t i = 0; i < size; ++i) { if (m_resourceListByID.at(i) == LPRDOResource(NULL) && pOther->m_resourceListByID.at(i) != LPRDOResource(NULL)) return false; if (m_resourceListByID.at(i) != LPRDOResource(NULL) && pOther->m_resourceListByID.at(i) == LPRDOResource(NULL)) return false; if (m_resourceListByID.at(i) == LPRDOResource(NULL) && pOther->m_resourceListByID.at(i) == LPRDOResource(NULL)) continue; if (*pOther->m_resourceListByID.at(i).get() != *m_resourceListByID.at(i).get()) return false; } return true; }
// -------------------------------------------------------------------------------- // -------------------- RDOFunCalcNotExist // -------------------------------------------------------------------------------- RDOValue RDOFunCalcNotExist::doCalc(const LPRDORuntime& pRuntime) { bool res = true; RDORuntime::ResCIterator end = pRuntime->getResType(m_nResType)->res_end(); for (RDORuntime::ResCIterator it = pRuntime->getResType(m_nResType)->res_begin(); it != end && res; it++) { if (*it == LPRDOResource(NULL)) continue; pRuntime->pushGroupFunc(*it); if (m_pCondition->calcValue(pRuntime).getAsBool()) res = false; pRuntime->popGroupFunc(); } return RDOValue(res); }
// -------------------------------------------------------------------------------- // -------------------- RDOFunCalcForAll // -------------------------------------------------------------------------------- RDOValue RDOFunCalcForAll::doCalc(const LPRDORuntime& pRuntime) { bool first_found = false; bool res = true; RDORuntime::ResCIterator end = pRuntime->getResType(m_nResType)->res_end(); for (RDORuntime::ResCIterator it = pRuntime->getResType(m_nResType)->res_begin(); it != end && res; it++) { if (*it == LPRDOResource(NULL)) continue; pRuntime->pushGroupFunc(*it); if (!m_pCondition->calcValue(pRuntime).getAsBool()) { res = false; } else if (!first_found) { first_found = true; } pRuntime->popGroupFunc(); } return RDOValue(first_found ? res : false); }
void RDORuntime::insertNewResource(const LPRDOResource& pResource) { ASSERT(pResource); if (pResource->getTraceID() >= m_resourceListByID.size()) { m_resourceListByID.resize(pResource->getTraceID() + 1, NULL); m_resourceListByID.at(pResource->getTraceID()) = pResource; } else { if (m_resourceListByID.at(pResource->getTraceID()) == LPRDOResource(NULL)) { m_resourceListByID.at(pResource->getTraceID()) = pResource; } else { error().push(SyntaxMessage( "Внутренняя ошибка: insertNewResource", rdo::FileType::PAT, 0, 0 )); } } #ifdef RDO_LIMIT_RES if (m_resourceListByID.size() >= 200) { error().push(SyntaxMessage( "Сработало лицензионное ограничение на количество ресурсов. Обратитесь за приобритением полной версии", rdo::FileType::PAT, 0, 0 )); } #endif }
LPRDOResource RDORuntime::getResourceByID(std::size_t resourceID) const { return resourceID != std::size_t(~0) && resourceID < m_resourceListByID.size() ? m_resourceListByID[resourceID] : LPRDOResource(NULL); }