~ubuntu-branches/ubuntu/trusty/mediascanner/trusty-proposed

« back to all changes in this revision

Viewing changes to src/mediascanner/mediaindex.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Jussi Pakkanen, Ubuntu daily release
  • Date: 2013-08-26 02:37:25 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130826023725-z652m072lnd9d5c7
Tags: 0.3.93+13.10.20130826-0ubuntu1
[ Jussi Pakkanen ]
* Compile with c++0x.
* Change boost::shared_ptrs to std::shared_ptrs where possible.
* Replace boost::noncopyable with the proper C++11 way.

[ Ubuntu daily release ]
* Automatic snapshot from revision 367

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
// Boost C++
44
44
#include <boost/bind.hpp>
45
 
#include <boost/foreach.hpp>
46
45
#include <boost/filesystem.hpp>
47
46
#include <boost/locale/format.hpp>
48
47
#include <boost/numeric/conversion/bounds.hpp>
234
233
 
235
234
// Returns true of the index got opened.
236
235
bool MediaIndex::is_open() const {
237
 
    return d->index_reader();
 
236
    return d->index_reader() != nullptr;
238
237
}
239
238
 
240
239
bool MediaIndex::is_current() const {
427
426
    Lucene::Collection<Lucene::IndexReaderPtr> children =
428
427
            Lucene::Collection<Lucene::IndexReaderPtr>::newInstance();
429
428
 
430
 
    BOOST_FOREACH (const MediaReaderMap::value_type &p, media_readers_) {
 
429
    for (const auto &p: media_readers_) {
431
430
        children.add(p.second);
432
431
    }
433
432
 
550
549
        }
551
550
 
552
551
        // Create sub indexes for each known media root.
553
 
        BOOST_FOREACH (const MediaRoot &root, d->root_manager_->media_roots()) {
 
552
        for (const auto &root: d->root_manager_->media_roots()) {
554
553
            const Lucene::IndexReaderPtr reader = OpenChildIndex(root);
555
554
 
556
555
            if (not reader) {
613
612
    // properties.
614
613
    // FIXME(M4): Find a way to avoid building this set.
615
614
    // Actually Lucene::FieldSelector should be the solution.
616
 
    BOOST_FOREACH (const Lucene::FieldablePtr field, document->getFields()) {
 
615
    for (const auto field: document->getFields()) {
617
616
        if (const Property &p = Property::FromFieldName(field->name()))
618
617
            fields.insert(p);
619
618
    }
632
631
    if (not document)
633
632
        return metadata;
634
633
 
635
 
    BOOST_FOREACH (const Property &property, fields) {
 
634
    for (const auto &property: fields) {
636
635
        if (property) {
637
636
            const Lucene::Collection<Lucene::FieldablePtr> fields =
638
637
                    document->getFieldables(property.field_name());
807
806
                boost::dynamic_pointer_cast<Lucene::BooleanQuery>(query);
808
807
 
809
808
        if (boolean_query) {
810
 
            BOOST_FOREACH (Lucene::BooleanClausePtr clause,
811
 
                           boolean_query->getClauses()) {
 
809
            for (auto clause: boolean_query->getClauses()) {
812
810
                const std::wstring occur = to_wstring(clause->getOccur());
813
811
                const std::wstring query_class =
814
812
                    clause->getQuery()->getClassName();