Esempio n. 1
0
LPIType RDOArrayType::type_cast(const LPIType& pFrom, const RDOParserSrcInfo& from_src_info, const RDOParserSrcInfo& to_src_info, const RDOParserSrcInfo& src_info) const
{
    ASSERT(pFrom);

    LPRDOArrayType pFromArrayType = pFrom.object_dynamic_cast<RDOArrayType>();
    if (pFromArrayType)
    {
        LPRDOArrayType pThisArrayType(const_cast<RDOArrayType*>(this));

        if (pThisArrayType->getItemType()->itype()->type_cast(pFromArrayType->getItemType()->itype(), pFromArrayType->src_info(), pThisArrayType->src_info(), pFromArrayType->src_info()))
        {
            // Это один и тот же тип
            return pThisArrayType;
        }

        parser::g_error().push_only(src_info,    rdo::format("Несоответствие размерности массива"));
        parser::g_error().push_only(to_src_info, rdo::format("См. тип: %s", to_src_info.src_text().c_str()));
        parser::g_error().push_done();
    }

    parser::g_error().push_only(src_info,    rdo::format("Ожидается тип массива, найдено: %s", from_src_info.src_text().c_str()));
    parser::g_error().push_only(to_src_info, rdo::format("См. тип: %s", to_src_info.src_text().c_str()));
    parser::g_error().push_done();

    return NULL;
}
Esempio n. 2
0
LPRDOValue RDOArrayType::value_cast(const LPRDOValue& pFrom, const RDOParserSrcInfo& to_src_info, const RDOParserSrcInfo& src_info) const
{
    ASSERT(pFrom);

    LPRDOArrayType pFromArrayType = pFrom->typeInfo()->itype().object_dynamic_cast<RDOArrayType>();
    if (pFromArrayType)
    {
        LPRDOArrayType  pThisArrayType(const_cast<RDOArrayType*>(this));
        LPRDOArrayValue pThisArrayValue = rdo::Factory<RDOArrayValue>::create(pThisArrayType);
        ASSERT(pThisArrayValue);

        rdo::runtime::LPRDOArrayValue pFromArrayValue = pFrom->get<RDOArrayValue>()->createRuntimeValue();
        ASSERT(pFromArrayValue);

        for (rdo::runtime::LPRDOArrayIterator it = pFromArrayValue->begin(); !it->equal(pFromArrayValue->end()); it->next())
        {
            LPRDOValue pItemValue = rdo::Factory<RDOValue>::create(it->getValue(), src_info, pThisArrayType->getItemType());
            ASSERT(pItemValue);
            pThisArrayValue->insertItem(pThisArrayType->getItemType()->itype()->value_cast(pItemValue, to_src_info, src_info));
        }
        return rdo::Factory<RDOValue>::create(pThisArrayType->typeInfo(), pThisArrayValue, pFrom->src_info());
    }

    parser::g_error().push_only(src_info,    rdo::format("Ожидается массив, найдено: %s", pFrom->src_text().c_str()));
    parser::g_error().push_only(to_src_info, rdo::format("См. тип: %s", to_src_info.src_text().c_str()));
    parser::g_error().push_done();

    return NULL;
}
Esempio n. 3
0
RDOPROCProcess::RDOPROCProcess(const RDOParserSrcInfo& info, const std::string& name, LPRDORTPResType transactType)
	: RDOParserSrcInfo(info        )
	, m_closed        (false       )
	, m_name          (name        )
	, m_transactType  (transactType)
{
	RDOParser::s_parser()->insertPROCProcess(this);
	m_pRuntime = rdo::Factory<rdo::runtime::RDOPROCProcess>::create(info.src_text(), RDOParser::s_parser()->runtime());
	ASSERT(m_pRuntime);
	m_pRuntime.object_dynamic_cast<ILogic>()->init(RDOParser::s_parser()->runtime());
}