示例#1
0
bool CCit_art::x_GetLabelV2(string* label, TLabelFlags flags,
                            const CCit_book& book)
{
    const CImprint& imp    = book.GetImp();
    int             prepub = imp.CanGetPrepub() ? imp.GetPrepub() : 0;
    string          year   = GetParenthesizedYear(imp.GetDate());

    MaybeAddSpace(label);

    if (prepub == CImprint::ePrepub_submitted
        ||  prepub == CImprint::ePrepub_other) {
        *label += "Unpublished " + year;
        return true;
    }

    string title = book.GetTitle().GetTitle();
    if (title.size() < 3) {
        *label += '.';
        return false;
    }

    *label += "(in) ";
    if (book.GetAuthors().GetLabel(label, flags, eLabel_V2)) {
        size_t n = book.GetAuthors().GetNameCount();
        if (n > 1) {
            *label += " (Eds.);";
        } else if (n == 1) {
            *label += " (Ed.);";
        }
        *label += '\n';
    }

    *label += NStr::ToUpper(title);

    const string* volume = imp.CanGetVolume() ? &imp.GetVolume() : NULL;
    if (HasText(volume)  &&  *volume != "0") {
        *label += ", Vol. " + *volume;
        if ((flags & fLabel_FlatNCBI) != 0) {
            NoteSup(label, imp);
        }
    }
    if (imp.CanGetPages()) {
        string pages = FixPages(imp.GetPages());
        if (HasText(pages)) {
            *label += ": " + pages;
        }
    }
    *label += ";\n";

    if (imp.CanGetPub()
        &&  imp.GetPub().GetLabel(label, flags, eLabel_V1)) { // sic
        // "V1" taken over by MakeAffilStr translation
        *label += ' ';
    }
    *label += year;

    if ((flags & fLabel_FlatNCBI) != 0
        &&  prepub == CImprint::ePrepub_in_press) {
        *label += " In press";
    }

    return true;
}
示例#2
0
// Based on FormatCitJour from the C Toolkit's api/asn2gnb5.c.
bool CCit_jour::GetLabelV2(string* label, TLabelFlags flags) const
{
    const CImprint& imp = GetImp();

    int prepub = imp.CanGetPrepub()    ? imp.GetPrepub()    : 0;
    int status = imp.CanGetPubstatus() ? imp.GetPubstatus() : 0;

    bool is_electronic = (status == ePubStatus_epublish
                          ||  status == ePubStatus_aheadofprint);

    const string* jtitle;
    try {
        jtitle = &GetTitle().GetTitle(CTitle::C_E::e_Iso_jta);
    } catch (CException&) {
        try {
            jtitle = &GetTitle().GetTitle();
            if (NStr::StartsWith(*jtitle, "(er)")) {
                is_electronic = true;
            }
            if ((flags & fLabel_ISO_JTA) != 0  &&  !is_electronic) {
                return false;
            }
        } catch (CException&) {
            jtitle = NULL;
        }
    }

    string year = GetParenthesizedYear(imp.GetDate());

    MaybeAddSpace(label);

    if (prepub == CImprint::ePrepub_submitted
        ||  prepub == CImprint::ePrepub_other) {
        *label += "Unpublished " + year;
        return true;
    }

    if (jtitle == NULL  ||  jtitle->size() < 3) {
        *label += '.';
        return false;
    }

    *label += *jtitle;

    const string* volume = imp.CanGetVolume() ? &imp.GetVolume() : NULL;
    string        pages  = imp.CanGetPages()  ? imp.GetPages()   : kEmptyStr;
    if ( !pages.empty()  &&  !is_electronic ) {
        pages = FixPages(pages);
    }

    if (HasText(volume)) {
        MaybeAddSpace(label);
        *label += *volume;
    }

    if ((flags & fLabel_FlatNCBI) != 0
        &&  (HasText(volume)  ||  HasText(pages))) {
        NoteSup(label, imp);
    }

    if ((flags & fLabel_FlatNCBI) != 0) {
        if (HasText(pages)) {
            *label += ", " + pages;
        }
    } else if ((flags & fLabel_FlatEMBL) != 0) {
        if (HasText(pages)) {
            *label += ':' + pages;
        } else if (prepub == CImprint::ePrepub_in_press  ||  !HasText(volume)) {
            MaybeAddSpace(label);
            *label += "0:0-0";
        }
    }

    *label += ' ' + year;
    
    if ((flags & fLabel_FlatNCBI) != 0) {
        if (prepub == CImprint::ePrepub_in_press
            ||  (status == ePubStatus_aheadofprint  &&  !HasText(pages))) {
            MaybeAddSpace(label);
            *label += "In press";
        }
    }

    return true;
}