void CMyAxCtrl::OnResetState()
{
   ResetVersion(MAKELONG(_wVerMinor, _wVerMajor));
   ResetStockProps();

   // initialize custom properties here
}
Beispiel #2
0
CTextseq_id& CTextseq_id::Set
(const CTempString& acc_in,
 const CTempString& name_in,
 int                version,
 const CTempString& release_in,
 bool               allow_dot_version)
{
    // Perform general sanity checks up front.
    if (version < 0) {
        NCBI_THROW(CSeqIdException, eFormat,
                   "Unexpected negative version " + NStr::IntToString(version)
                   + " for accession " + string(acc_in));
    }

    CTempString acc     =
        NStr::TruncateSpaces_Unsafe(acc_in,     NStr::eTrunc_Both);
    CTempString name    =
        NStr::TruncateSpaces_Unsafe(name_in,    NStr::eTrunc_Both);
    CTempString release =
        NStr::TruncateSpaces_Unsafe(release_in, NStr::eTrunc_Both);

    if (acc.empty()  &&  name.empty()) {
    }

    if (acc.empty()) {
        ResetAccession();
    } else {
        SIZE_TYPE idx = NPOS;

        if (allow_dot_version) {
            idx = acc.rfind('.');
        }

        if (idx == NPOS) {
            // no version within acc
            SetAccession(acc);

            // any standalone version is ok
            if (version > 0) {
                SetVersion(version); 
            } else {
                ResetVersion();
            }
        } else {
            // accession.version
            CTempString accession = acc.substr(0, idx);
            CTempString acc_ver   = acc.substr(idx + 1);
            int         ver       = NStr::StringToNonNegativeInt(acc_ver);
 
            if (ver <= 0) {
                NCBI_THROW(CSeqIdException, eFormat,
                           "Version embedded in accession " + string(acc)
                           + " is not a positive integer");
            } else if (version > 0  &&  ver != version) {
                NCBI_THROW(CSeqIdException, eFormat,
                           "Incompatible version " + NStr::IntToString(version)
                           + " supplied for accession " + string(acc));
            }
 
            SetAccession(accession);
            SetVersion(ver);
        }
    }

    if (name.empty()) {
        ResetName();
    } else {
        SetName(name);
    }

    if (acc.empty()  &&  name.empty()) {
        NCBI_THROW(CSeqIdException, eFormat,
                   "Accession and name missing for Textseq-id (but got"
                   " version " + NStr::IntToString(version) + ", release "
                   + string(release) + ')');
    } else if (release.empty()) {
        ResetRelease();
    } else {
        SetRelease(release);
    }
    return *this;
}