コード例 #1
0
void ClassWizardDlg::OnOKClick(wxCommandEvent& WXUNUSED(event))
{
    // Reset
    m_Header         = XRCCTRL(*this, "txtHeader", wxTextCtrl)->GetValue();
    m_Implementation = XRCCTRL(*this, "txtImplementation", wxTextCtrl)->GetValue();

    // obtain variable for easy reference
    m_Name      = XRCCTRL(*this, "txtName", wxTextCtrl)->GetValue();
    m_Arguments = XRCCTRL(*this, "txtArguments", wxTextCtrl)->GetValue();
    // Error check
    if (m_Name.IsEmpty())
    {
        cbMessageBox(_T("Please specify a class name to continue."),
                     _T("Error"), wxOK | wxICON_ERROR, this);
        return;
    }
    // Extract namespaces from class name
    wxStringTokenizer tkz(m_Name, _T("::"));
    m_Name = wxEmptyString;
    while ( tkz.HasMoreTokens() )
    {
        // Store the old "class name" as (another) namespace
        if (!m_Name.IsEmpty())
        {
            m_NameSpaces.Add(m_Name);
        }
        // Stor the new "class name" as true class name
        m_Name = tkz.GetNextToken();
    }

    m_HasDestructor     = XRCCTRL(*this, "chkHasDestructor", wxCheckBox)->GetValue();
    m_VirtualDestructor = XRCCTRL(*this, "chkVirtualDestructor", wxCheckBox)->GetValue();
    m_HasCopyCtor       = XRCCTRL(*this, "chkHasCopyCtor", wxCheckBox)->GetValue();
    m_HasAssignmentOp   = XRCCTRL(*this, "chkHasAssignmentOp", wxCheckBox)->GetValue();
    if (!m_HasDestructor)
    {
        m_VirtualDestructor = false; // Fix error
    }

    m_Inherits         = XRCCTRL(*this, "chkInherits", wxCheckBox)->GetValue();
    m_Ancestor         = XRCCTRL(*this, "txtInheritance", wxTextCtrl)->GetValue();
    m_AncestorFilename = XRCCTRL(*this, "txtInheritanceFilename", wxTextCtrl)->GetValue();
    m_AncestorScope    = XRCCTRL(*this, "cmbInheritanceScope", wxComboBox)->GetValue();
    if (m_Ancestor.IsEmpty())
        m_Inherits = false; // Fix error

    m_Documentation = XRCCTRL(*this, "chkDocumentation", wxCheckBox)->GetValue();

    m_AddPathToProject = XRCCTRL(*this, "chkAddPathToProject", wxCheckBox)->GetValue();
    m_UseRelativePath  = XRCCTRL(*this, "chkRelativePath", wxCheckBox)->GetValue();
    m_CommonDir        = XRCCTRL(*this, "chkCommonDir", wxCheckBox)->GetValue();
    if (m_CommonDir)
    {
        m_IncludeDir = XRCCTRL(*this, "txtCommonDir", wxTextCtrl)->GetValue();
        m_ImplDir    = XRCCTRL(*this, "txtCommonDir", wxTextCtrl)->GetValue();
    }
    else
    {
        m_IncludeDir = XRCCTRL(*this, "txtIncludeDir", wxTextCtrl)->GetValue();
        m_ImplDir    = XRCCTRL(*this, "txtImplDir", wxTextCtrl)->GetValue();
    }

    m_GuardBlock = XRCCTRL(*this, "chkGuardBlock", wxCheckBox)->GetValue();
    m_GuardWord  = XRCCTRL(*this, "txtGuardBlock", wxTextCtrl)->GetValue();
    if (m_GuardWord.IsEmpty())
    {
        m_GuardBlock = false; // Fix error
    }

    m_GenerateImplementation = XRCCTRL(*this, "chkImplementation", wxCheckBox)->GetValue();
    m_HeaderInclude          = XRCCTRL(*this, "txtHeaderInclude", wxTextCtrl)->GetValue();

    // Common stuff
    bool usestabs = Manager::Get()->GetConfigManager(_T("editor"))->ReadBool(_T("/use_tab"),    false);
    int  tabsize  = Manager::Get()->GetConfigManager(_T("editor"))->ReadInt(_T("/tab_size"),    4);

    m_TabStr = usestabs ? wxString(_T("\t")) : wxString(_T(' '), tabsize);
    m_EolStr = GetEOLStr();

    // actual file creation starts here
    bool success = DoHeader();
    if (success)
    {
        if (m_GenerateImplementation)
            success = DoImpl();
    }

    if (success)
        EndModal(wxID_OK);
}
コード例 #2
0
ファイル: robot.cpp プロジェクト: rodrigobmg/v-engine
///**********************************************************************///
///                       class implement begin                          ///
///**********************************************************************///
void Action::Do()
{
	Tick();
	DoImpl();
	Tock();
}
コード例 #3
0
	MethodStubbingProgress<R, arglist...>&
	Throw(const Quantifier<E>& q) {
		const E& value = q.value;
		auto method = [value](const arglist&...)->R {throw value;};
		return DoImpl(new Repeat<R, arglist...>(method, q.quantity));
	}
コード例 #4
0
	MethodStubbingProgress<R, arglist...>&
	Return(const Quantifier<R>& q) {
		const R& value = q.value;
		auto method = [value](const arglist&...)->R {return value;};
		return DoImpl(new Repeat<R, arglist...>(method, q.quantity));
	}
コード例 #5
0
	virtual void AlwaysDo(std::function<R(arglist&...)> method) {
		DoImpl(new RepeatForever<R, arglist...>(method));
	}
コード例 #6
0
	MethodStubbingProgress<R, arglist...>&
	Do(const Quantifier<F>& q) {
		return DoImpl(new Repeat<R, arglist...>(q.value, q.quantity));
	}
コード例 #7
0
	virtual MethodStubbingProgress<R, arglist...>&
	Do(std::function<R(arglist&...)> method) {
		return DoImpl(new Repeat<R, arglist...>(method));
	}