Ejemplo n.º 1
0
const string Package::Authors() const
{
    // TODO: handle localization
    AttributionList authors = AuthorNames();
    if ( authors.size() == 1 )
        return authors[0];
    else if ( authors.size() == 2 )
        return _Str(authors[0], " and ", authors[1]);
    
    std::stringstream ss;
    auto pos = authors.begin();
    auto last = pos + (authors.size() - 1);
    while ( pos != last )
    {
        ss << *(pos++) << ", ";
    }
    
    ss << "and " << *last;
    return string(ss.str());
}
Ejemplo n.º 2
0
const string Package::Contributors(bool localized) const
{
    // TODO: handle localization of the word 'and'
    AttributionList contributors = ContributorNames(localized);
    if ( contributors.empty() )
        return string::EmptyString;
    if ( contributors.size() == 1 )
        return contributors[0];
    else if ( contributors.size() == 2 )
        return _Str(contributors[0], " and ", contributors[1]);
    
    std::stringstream ss;
    auto pos = contributors.begin();
    auto last = pos + (contributors.size() - 1);
    while ( pos != last )
    {
        ss << *(pos++) << ", ";
    }
    
    ss << "and " << *last;
    return string(ss.str());
}