Exemple #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);
}
Exemple #2
0
bool CCit_art::GetLabelV1(string* label, TLabelFlags flags) const
{
    const CCit_jour*  journal = 0;
    const CCit_book*  book = 0;
    const CImprint*   imprint = 0;
    const CAuth_list* authors = 0;
    const CTitle*     title = 0;
    const string*     titleunique = 0;
    if ( IsSetAuthors() ) {
        authors = &GetAuthors();
    }
    if ( IsSetTitle() ) {
        titleunique = &GetTitle().GetTitle();
    }
    switch ( GetFrom().Which() ) {
    case C_From::e_Journal:
        journal = &GetFrom().GetJournal();
        imprint = &journal->GetImp();
        title = &journal->GetTitle();
        break;
    case C_From::e_Book:
        book = &GetFrom().GetBook();
        imprint = &book->GetImp();
        if (!authors) {
            authors = &book->GetAuthors();
        }
        break;
    case C_From::e_Proc:
        book = &GetFrom().GetProc().GetBook();
        imprint = &book->GetImp();
        if (!authors) {
            authors = &book->GetAuthors();
        }
    default:
        break;
    }
    return x_GetLabelV1(label, (flags & fLabel_Unique) != 0, authors, imprint,
                        title, book, journal, 0, 0, titleunique);
}   
Exemple #3
0
bool CId_pat::GetLabelV1(string* label, TLabelFlags) const
{
    return x_GetLabelV1(label, false, 0, 0, 0, 0, 0,
                        &GetCountry(), &GetSomeNumber());
}
Exemple #4
0
bool CCit_jour::GetLabelV1(string* label, TLabelFlags) const
{
    return x_GetLabelV1(label, false, 0, &GetImp(), &GetTitle(), 0, this);
}