예제 #1
0
파일: configitem.cpp 프로젝트: ryoon/eCos
// Change version (of a package)
bool ecConfigItem::ChangeVersion(const wxString &strVersion)
{
    bool rc=FALSE;
    CdlPackage package=dynamic_cast<CdlPackage>(GetCdlItem());
    wxASSERT(package != 0);
    const CdlValuable valuable = GetCdlValuable();
    wxASSERT (valuable != 0);
    const wxString strMacroName(GetMacro());
    if (strVersion != valuable->get_value ().c_str ()) { // if the wrong version is loaded
        // TRACE (wxT("Changing package %s to version '%s'\n"), strMacroName, strVersion);
        try {
            wxGetApp().GetConfigToolDoc()->GetCdlConfig()->change_package_version (package, ecUtils::UnicodeToStdStr (strVersion), ecConfigToolDoc::CdlParseErrorHandler, ecConfigToolDoc::CdlParseWarningHandler);
            rc=TRUE;
        }
        catch (CdlStringException exception) {
            wxString msg;
            msg.Printf(wxT("Error changing package %s to version '%s':\n\n%s"), (const wxChar*) strMacroName, (const wxChar*) strVersion, (const wxChar*) wxString (exception.get_message ().c_str ())) ;
            wxMessageBox(msg);
        }
        catch (...) {
            wxString msg;
            msg.Printf(wxT("Error changing package %s to version '%s'"), (const wxChar*) strMacroName, (const wxChar*) strVersion) ;
            wxMessageBox(msg);
        }
    }
    return rc;
}
예제 #2
0
파일: configitem.cpp 프로젝트: ryoon/eCos
const wxString ecConfigItem::StringValue (CdlValueSource source /* = CdlValueSource_Current */ ) const
{
    //	wxASSERT (!IsPackage()); // not a package item
    const CdlValuable valuable = GetCdlValuable();
    wxASSERT (valuable);
    wxString strValue (wxT(""));
    
    switch (valuable->get_flavor ())
    {
    case CdlValueFlavor_Data:
    case CdlValueFlavor_BoolData:
    case CdlValueFlavor_None: // a package
        if (m_optionType == ecLong)
            strValue = ecUtils::IntToStr (Value (), wxGetApp().GetSettings().m_bHex);
        else if (m_optionType == ecDouble)
            strValue = ecUtils::DoubleToStr (DoubleValue ());
        else
            strValue = valuable->get_value (source).c_str ();
        break;
        
    default:
        wxASSERT (0); // specified flavor not supported
    }
    
    return strValue;
}