Exemplo n.º 1
0
bool CCit_gen::GetLabelV1(string* label, TLabelFlags flags) const
{
    bool unique = (flags & fLabel_Unique) != 0;

    if (IsSetSerial_number()) {
        *label += "[" + NStr::IntToString(GetSerial_number()) + "]";
    }
    if (IsSetMuid()) {
        *label += "NLM" + NStr::IntToString(GetMuid());
    }

    string date;
    string* date_ptr = 0;
    if ( IsSetDate() ) {
        date_ptr = &date;
        GetDate().GetDate(date_ptr, true);
    }

    const string* title2 = 0;
    const string* titleunique = 0;
    bool unpublished = false;
    const CTitle* title = IsSetJournal() ? &GetJournal() : 0;
    const CAuth_list* authors = IsSetAuthors() ? &GetAuthors() : 0;
    const string* volume = IsSetVolume() ? &GetVolume() : 0;
    const string* issue = IsSetIssue() ? &GetIssue() : 0;
    const string* pages = IsSetPages() ? &GetPages() : 0;

    if (IsSetCit()) {
        if ( NStr::EqualNocase( GetCit(), "Unpublished") ) {
            unpublished = true;
        } else if (!title) {
            title2 = &GetCit();
        }
    }
    if (IsSetTitle()) {
        titleunique = &GetTitle();
    } else if (title2) {
        titleunique = title2;
    } else if (!title && IsSetCit()) {
        titleunique = &GetCit();
    }
    if (!title && !authors && !IsSetTitle() && !volume &&
        !pages && !issue) {
        titleunique = 0;
        if (IsSetCit()) {
            string cit(GetCit());
            if (!unique) {
                try {
                    cit.resize(cit.find_last_of('|'));
                } catch(length_error&) {}
            }   
            *label += cit;
        }
        return true;
    }

    return x_GetLabelV1(label, unique,
        authors, 0, title, 0, 0, 0, title2, titleunique,
        date_ptr, volume, issue, pages, unpublished);
}
Exemplo n.º 2
0
bool CGB_block::IsEmpty(void) const
{
    if (!IsSetDate()
        && !IsSetDiv()
        && !IsSetEntry_date()
        && !IsSetExtra_accessions()
        && !IsSetKeywords()
        && !IsSetOrigin()
        && !IsSetSource()
        && !IsSetTaxonomy()) {
        return true;
    } else {
        return false;
    }
}