コード例 #1
0
    shared_ptr<ObjectClassBody> ContextBuilder::buildClass(
        const shared_ptr<ClassDeclaration> &classDeclaration) {
        ClassName className(classDeclaration->getName());

        std::map<PropertyName, ClassName> properties;
        for (auto elem : classDeclaration->getProperties()) {
            properties[PropertyName(elem.first)] = ClassName(elem.second);
        }

        std::map<MethodName, std::shared_ptr< MethodBody >> methods;
        for (auto elem : classDeclaration->getMethods()) {
            methods[MethodName(elem->getName())] = buildMethod(elem);
        }

        auto parentClass = classTable->getClass(
            ClassName(classDeclaration->getParentName())
        );

        return std::make_shared< ClassBody >(
            className,
            properties,
            methods,
            parentClass
        );
    }
コード例 #2
0
LRESULT CImpactCtrl::OnOpenInstance(WPARAM wparm, LPARAM lparm) {
	CResultEntity* pEntity = (CResultEntity*)lparm;
	if(pEntity!=NULL) {
		CString* fName = pEntity->getFile();
		int		 nLine = pEntity->getLine();

		CString MethodName("OpenFile"); // We will run OpenFile method of the Editor integrator
		DISPID accessID;                // IDispatch id for the AccessSync command
		HRESULT hresult;

		// if there is no editor integrator assigned to this control, we will be unable to
		// evaluate this function.
		if(m_EditorCtrl==NULL) return 0;

		// Trying to receve method ID from it's name.
		BSTR methodBSTR=MethodName.AllocSysString();
		hresult = m_EditorCtrl->GetIDsOfNames(IID_NULL,&methodBSTR, 
                                              1,LOCALE_SYSTEM_DEFAULT,&accessID);

		// Interface doesn't support OpenFile method
		if(hresult!=S_OK) return 0;
		::SysFreeString(methodBSTR);

		// Converting command into new OEM string wich will be passed into OLE automation.
		// We will free when pushing into the stack
		BSTR file_name = fName->AllocSysString();

		// Creating parameter structure - only one parameter will be passed as 
		// argument - command string
		DISPPARAMS cmdParamStruct; 
		cmdParamStruct.rgvarg              = new VARIANT[2];
		cmdParamStruct.rgvarg[1].vt        = VT_BSTR;
		cmdParamStruct.rgvarg[1].bstrVal   = file_name;
		cmdParamStruct.rgvarg[0].vt        = VT_I4;			
		cmdParamStruct.rgvarg[0].lVal	   = nLine;
		cmdParamStruct.cArgs               = 2;
		cmdParamStruct.cNamedArgs		   = 0;

		// This will show the argument with an error
		unsigned int argWithError;
		// Remote command execution
		hresult = m_EditorCtrl->Invoke(accessID,
                                   IID_NULL,
                                   LOCALE_SYSTEM_DEFAULT,
                                   DISPATCH_METHOD,
                                   &cmdParamStruct,
                                   NULL,
                                   NULL,
                                   &argWithError);

		delete[] cmdParamStruct.rgvarg;
		::SysFreeString(file_name);
	}
	return 0;
}
コード例 #3
0
    void LexerTermBuilder::visitMethodInvocation(
        const MethodInvocation *invocation) {
        MethodArguments args = buildArgsList(invocation->getArgs());
        invocation->getTerm()->accept(this);

        this->term = std::make_shared< Invocation >(
            this->term,
            MethodName(invocation->getName()),
            args
        );
    }
コード例 #4
0
//---------------------------------------------------------------------------
// Executes Access command and returns a result:
//   If a result starts with 'Error:' - it means some error has occurred and 
//              rest of the strind is the error description
//   Otherwise its the command result
//---------------------------------------------------------------------------
CString CImpactCtrl::ExecCommand(CString &command)
{
    CString MethodName("AccessSync"); // We will run AccessSync method of the DataSource
    DISPID accessID;                  // IDispatch id for the AccessSync command
    HRESULT hresult;

    // if there is no data source assigned to this control, we will be unable to
    // evaluate this function.
	if(m_DataSource==NULL) return m_cszError + CString(" No data source - can't evaluate a command");

    // Trying to receve method ID from it's name.
    BSTR methodBSTR=MethodName.AllocSysString();
    hresult = m_DataSource->GetIDsOfNames(IID_NULL,&methodBSTR, 
                                              1,LOCALE_SYSTEM_DEFAULT,&accessID);

    // Interface doesn't support AccessSync method
    if(hresult!=S_OK) return m_cszError + CString(" data source does not support AccessSync method");
	::SysFreeString(methodBSTR);

    // Converting command into new OEM string wich will be passed into OLE automation.
    // We will free when pushing into the stack
    BSTR access_call = command.AllocSysString();

    // Creating parameter structure - only one parameter will be passed as argument - command string
    DISPPARAMS cmdParamStruct; 
    cmdParamStruct.rgvarg              = new VARIANT;
    cmdParamStruct.rgvarg[0].vt        = VT_BSTR | VT_BYREF; // we will pass it as BSTR reference
    cmdParamStruct.rgvarg[0].pbstrVal  = &access_call;
    cmdParamStruct.cArgs               = 1;
    cmdParamStruct.cNamedArgs=0;

    // Results will be inserted into VARIANT union
    VARIANT resBSTR;
    // This will show the argument with an error
    unsigned int argWithError;
    // Remote command execution
    hresult = m_DataSource->Invoke(accessID,
                                   IID_NULL,
                                   LOCALE_SYSTEM_DEFAULT,
                                   DISPATCH_METHOD,
                                   &cmdParamStruct,
                                   &resBSTR,
                                   NULL,
                                   &argWithError);
    delete cmdParamStruct.rgvarg;
	::SysFreeString(access_call);

    CString szResult;
    if(hresult!=S_OK) szResult = m_cszError + " Command '" + command + "' failed.\n";
    szResult += resBSTR.bstrVal;
    return szResult;
}
コード例 #5
0
ファイル: Channel.cpp プロジェクト: BrandonHe/hmi_sdk
void Channel::onRequest(Json::Value &request)
{
    int  id = request["id"].asInt();
    Json::Value method =request["method"];
    std::string ref= MethodName(getChannelName(),method);
    if(m_StaticResult.isMember(ref)){
        sendResult(id,ref);
    }
    else
    {
      LOGE("%s.%s NOT use",getChannelName().c_str(),ref.c_str());
    }
}
コード例 #6
0
ファイル: Base.cpp プロジェクト: BoostedColliderAnalysis/BoCA
bool Base::Cut(TMVA::Reader const& reader, double eff) const
{
    INFO(Name());
//     std::lock_guard<std::mutex> guard(ReaderBase::mutex_);
    return const_cast<TMVA::Reader&>(reader).EvaluateMVA(MethodName(), eff);  // const cast is necessary because TMVA is not using const getters
}
コード例 #7
0
ファイル: Base.cpp プロジェクト: BoostedColliderAnalysis/BoCA
std::string Base::WeightName() const
{
    INFO0;
    return Name() + "_" + MethodName() + "." + WeightFileExtension();
}