void tst_QAtomicIntegerXX::assign()
{
    QFETCH(LargeInt, value);

    QAtomicInteger<T> atomic(value);
    QAtomicInteger<T> copy;
    copy = atomic;
    QCOMPARE(copy.load(), atomic.load());

    QAtomicInteger<T> copy2;
    copy2 = atomic;  // operator=(const QAtomicInteger &)
    QCOMPARE(copy2.load(), atomic.load());

    QAtomicInteger<T> copy2bis;
    copy2bis = atomic.load(); // operator=(T)
    QCOMPARE(copy2bis.load(), atomic.load());

    // move
    QAtomicInteger<T> copy3;
    copy3 = qMove(copy);
    QCOMPARE(copy3.load(), atomic.load());

    QAtomicInteger<T> copy4;
    copy4 = qMove(copy2);
    QCOMPARE(copy4.load(), atomic.load());
}
Exemple #2
0
void tst_QPen::move_assign()
{
    QPen p1(Qt::black), p2(Qt::white);

    // check that moving does the right thing:
    p2 = qMove(p1); // could be move or copy assignment, so don't check p1's state
    QCOMPARE(p2.color(), QColor(Qt::black));

    // check that move-assigned-from QPen p1 can still be used, albeit
    // with undocumented state (it's p2's original state):
    QVERIFY(p1.style() != Qt::NoPen);

    // check that moved-from QPen p1 can still be safely copied:
    const QPen p3 = p1;

    // check that moved-from QPen p1 can still be safely assigned to:
    const QPen p4(Qt::yellow);
    p1 = p4;
    QCOMPARE(p1.color(), QColor(Qt::yellow));

    // check that moved-from QPens p2, p3 can still be safely destroyed:
    QPen p5;
    p5 = qMove(p2);

    // intentionally no more statements beyond this point
}
void tst_QPalette::moveSemantics()
{
#ifdef Q_COMPILER_RVALUE_REFS
    QPalette src(Qt::red), dst;
    const QPalette control = src;
    QVERIFY(src != dst);
    QCOMPARE(src, control);
    QVERIFY(!dst.isCopyOf(src));
    QVERIFY(!dst.isCopyOf(control));
    dst = qMove(src); // move assignment
    QVERIFY(!dst.isCopyOf(src)); // isCopyOf() works on moved-from palettes, too
    QVERIFY(dst.isCopyOf(control));
    QCOMPARE(dst, control);
    src = control; // check moved-from 'src' can still be assigned to (doesn't crash)
    QVERIFY(src.isCopyOf(dst));
    QVERIFY(src.isCopyOf(control));
    QPalette dst2(qMove(src)); // move construction
    QVERIFY(!src.isCopyOf(dst));
    QVERIFY(!src.isCopyOf(dst2));
    QVERIFY(!src.isCopyOf(control));
    QCOMPARE(dst2, control);
    QVERIFY(dst2.isCopyOf(dst));
    QVERIFY(dst2.isCopyOf(control));
    // check moved-from 'src' can still be destroyed (doesn't crash)
#else
    QSKIP("Compiler doesn't support C++11 move semantics");
#endif
}
bool OsmAnd::MapRendererKeyedSymbolsResource::uploadToGPU()
{
    bool ok;
    bool anyUploadFailed = false;

    const auto link_ = link.lock();
    const auto collection = static_cast<MapRendererKeyedResourcesCollection*>(&link_->collection);

    QHash< std::shared_ptr<MapSymbol>, std::shared_ptr<const GPUAPI::ResourceInGPU> > uploaded;
    for (const auto& symbol : constOf(_sourceData->symbolsGroup->symbols))
    {
        // Prepare data and upload to GPU
        std::shared_ptr<const GPUAPI::ResourceInGPU> resourceInGPU;
        ok = resourcesManager->uploadSymbolToGPU(symbol, resourceInGPU);

        // If upload have failed, stop
        if (!ok)
        {
            LogPrintf(LogSeverityLevel::Error, "Failed to upload keyed symbol");

            anyUploadFailed = true;
            break;
        }

        // Mark this symbol as uploaded
        uploaded.insert(symbol, qMove(resourceInGPU));
    }

    // If at least one symbol failed to upload, consider entire tile as failed to upload,
    // and unload its partial GPU resources
    if (anyUploadFailed)
    {
        uploaded.clear();

        return false;
    }

    // All resources have been uploaded to GPU successfully by this point
    _retainableCacheMetadata = _sourceData->retainableCacheMetadata;
    _sourceData.reset();

    for (const auto& entry : rangeOf(constOf(uploaded)))
    {
        const auto& symbol = entry.key();
        auto& resource = entry.value();

        // Unload GPU data from symbol, since it's uploaded already
        resourcesManager->releaseGpuUploadableDataFrom(symbol);

        // Move reference
        _resourcesInGPU.insert(symbol, qMove(resource));
    }

    return true;
}
Exemple #5
0
OSMAND_CORE_API QString OSMAND_CORE_CALL OsmAnd::ICU::transliterateToLatin(
    const QString& input,
    const bool keepAccentsAndDiacriticsInInput /*= true*/,
    const bool keepAccentsAndDiacriticsInOutput /*= true*/)
{
    QString output;
    UErrorCode icuError = U_ZERO_ERROR;
    bool ok = true;

    const auto pAnyToLatinTransliterator = g_pIcuAnyToLatinTransliterator->clone();
    if (pAnyToLatinTransliterator == nullptr || U_FAILURE(icuError))
    {
        LogPrintf(LogSeverityLevel::Error, "ICU error: %d", icuError);
        if (pAnyToLatinTransliterator != nullptr)
            delete pAnyToLatinTransliterator;
        return input;
    }

    // Transliterate from any to latin
    UnicodeString icuString(reinterpret_cast<const UChar*>(input.unicode()), input.length());
    pAnyToLatinTransliterator->transliterate(icuString);
    output = qMove(QString(reinterpret_cast<const QChar*>(icuString.getBuffer()), icuString.length()));

    // If input and output differ at this point or accents/diacritics should be converted,
    // normalize the output again
    if ((input.compare(output, Qt::CaseInsensitive) != 0 || !keepAccentsAndDiacriticsInInput) && !keepAccentsAndDiacriticsInOutput)
    {
        const auto pIcuAccentsAndDiacriticsConverter = g_pIcuAccentsAndDiacriticsConverter->clone();
        ok = pIcuAccentsAndDiacriticsConverter != nullptr && U_SUCCESS(icuError);
        if (ok)
        {
            pIcuAccentsAndDiacriticsConverter->transliterate(icuString);
            output = qMove(QString(reinterpret_cast<const QChar*>(icuString.getBuffer()), icuString.length()));
        }

        if (pIcuAccentsAndDiacriticsConverter != nullptr)
            delete pIcuAccentsAndDiacriticsConverter;
    }
    
    if (pAnyToLatinTransliterator != nullptr)
        delete pAnyToLatinTransliterator;

    if (!ok)
    {
        LogPrintf(LogSeverityLevel::Error, "ICU error: %d", icuError);
        return input;
    }
    return output;
}
std::shared_ptr<OsmAnd::ObfDataInterface> OsmAnd::ObfsCollection_P::obtainDataInterface() const
{
    // Check if sources were invalidated
    if (_collectedSourcesInvalidated.loadAcquire() > 0)
        collectSources();

    // Create ObfReaders from collected sources
    QList< std::shared_ptr<const ObfReader> > obfReaders;
    {
        QReadLocker scopedLocker(&_collectedSourcesLock);

        for(const auto& collectedSources : constOf(_collectedSources))
        {
            obfReaders.reserve(obfReaders.size() + collectedSources.size());
            for(const auto& obfFile : constOf(collectedSources))
            {
                std::shared_ptr<const ObfReader> obfReader(new ObfReader(obfFile));
                if (!obfReader->isOpened() || !obfReader->obtainInfo())
                    continue;
                obfReaders.push_back(qMove(obfReader));
            }
        }
    }

    return std::shared_ptr<ObfDataInterface>(new ObfDataInterface(obfReaders));
}
OsmAnd::ObfsCollection::SourceOriginId OsmAnd::ObfsCollection_P::addDirectory(const QDir& dir, bool recursive)
{
    QWriteLocker scopedLocker(&_sourcesOriginsLock);

    const auto allocatedId = _lastUnusedSourceOriginId++;
    auto sourceOrigin = new DirectoryAsSourceOrigin();
    sourceOrigin->directory = dir;
    sourceOrigin->isRecursive = recursive;
    _sourcesOrigins.insert(allocatedId, qMove(std::shared_ptr<const SourceOrigin>(sourceOrigin)));

    _fileSystemWatcher->addPath(dir.canonicalPath());
    if (recursive)
    {
        QFileInfoList subdirs;
        Utilities::findDirectories(dir, QStringList() << QLatin1String("*"), subdirs, true);
        for(const auto& subdir : subdirs)
        {
            const auto canonicalPath = subdir.canonicalFilePath();
            sourceOrigin->watchedSubdirectories.insert(canonicalPath);
            _fileSystemWatcher->addPath(canonicalPath);
        }
    }

    invalidateCollectedSources();

    return allocatedId;
}
/*!
    \fn QVersionNumber QVersionNumber::fromString(const QString &string,
                                                  int *suffixIndex)

    Constructs a QVersionNumber from a specially formatted \a string of
    non-negative decimal numbers delimited by '.'.

    Once the numerical segments have been parsed, the remainder of the string
    is considered to be the suffix string.  The start index of that string will be
    stored in \a suffixIndex if it is not null.

    \snippet qversionnumber/main.cpp 3

    \sa isNull()
*/
QVersionNumber QVersionNumber::fromString(const QString &string, int *suffixIndex)
{
    QVector<int> seg;

    const QByteArray cString(string.toLatin1());

    const char *start = cString.constData();
    const char *end = start;
    const char *lastGoodEnd = start;
    const char *endOfString = cString.constData() + cString.size();

    do {
        bool ok = false;
        const qulonglong value = qstrtoull(start, &end, 10, &ok);
        if (!ok || value > qulonglong(std::numeric_limits<int>::max()))
            break;
        seg.append(int(value));
        start = end + 1;
        lastGoodEnd = end;
    } while (start < endOfString && (end < endOfString && *end == '.'));

    if (suffixIndex)
        *suffixIndex = int(lastGoodEnd - cString.constData());

    return QVersionNumber(qMove(seg));
}
Exemple #9
0
bool OsmAnd::MapStyle_P::registerRule( MapStyleRulesetType type, const std::shared_ptr<MapStyleRule>& rule )
{
    MapStyleValue tagData;
    if(!rule->getAttribute(_builtinValueDefs->INPUT_TAG, tagData))
    {
        OsmAnd::LogPrintf(OsmAnd::LogSeverityLevel::Error, "Attribute tag should be specified for root filter");
        return false;
    }

    MapStyleValue valueData;
    if(!rule->getAttribute(_builtinValueDefs->INPUT_VALUE, valueData))
    {
        OsmAnd::LogPrintf(OsmAnd::LogSeverityLevel::Error, "Attribute tag should be specified for root filter");
        return false;
    }

    uint64_t id = encodeRuleId(tagData.asSimple.asUInt, valueData.asSimple.asUInt);

    auto insertedRule = rule;
    auto& ruleset = obtainRulesRef(type);
    auto itPrevious = ruleset.constFind(id);
    if(itPrevious != ruleset.cend())
    {
        // all root rules should have at least tag/value
        insertedRule = createTagValueRootWrapperRule(id, *itPrevious);
        insertedRule->_d->_ifElseChildren.push_back(rule);
    }

    ruleset.insert(id, qMove(insertedRule));

    return true;
}
Exemple #10
0
void MachineModel::specialMoveY(const float& y, const float& feed)
{
  FloatPoint sp = localPosition;
  sp.y = y;
  sp.f = feed;
  qMove(sp);
}
bool OsmAnd::MapRendererTiledResourcesCollection::updateCollectionSnapshot() const
{
    const auto invalidatesDiscarded = _collectionSnapshotInvalidatesCount.fetchAndAddOrdered(0);
    if (invalidatesDiscarded == 0)
        return true;

    // Copy from original storage to temp storage
    Storage storageCopy;
    {
        if (!_collectionLock.tryLockForRead())
            return false;

        for (int zoomLevel = MinZoomLevel; zoomLevel <= MaxZoomLevel; zoomLevel++)
        {
            const auto& sourceStorageLevel = constOf(_storage)[zoomLevel];
            auto& targetStorageLevel = storageCopy[zoomLevel];

            targetStorageLevel = detachedOf(sourceStorageLevel);
        }

        _collectionLock.unlock();
    }
    _collectionSnapshotInvalidatesCount.fetchAndAddOrdered(-invalidatesDiscarded);

    // Copy from temp storage to snapshot
    {
        QWriteLocker scopedLocker(&_snapshot->_lock);

        _snapshot->_storage = qMove(storageCopy);
    }

    return true;
}
Exemple #12
0
void OsmAnd::ICU::initialize()
{
    // Initialize ICU
    UErrorCode icuError = U_ZERO_ERROR;
    g_IcuData = qMove(std::unique_ptr<QByteArray>(new QByteArray(EmbeddedResources::decompressResource(QLatin1String("icu4c/icu-data-l.dat")))));
    udata_setCommonData(g_IcuData->constData(), &icuError);
    if (U_FAILURE(icuError))
    {
        LogPrintf(LogSeverityLevel::Error, "Failed to initialize ICU data: %d", icuError);
        return;
    }
    u_init(&icuError);
    if (U_FAILURE(icuError))
    {
        LogPrintf(LogSeverityLevel::Error, "Failed to initialize ICU: %d", icuError);
        return;
    }

    // Allocate resources:
    g_pIcuAnyToLatinTransliterator = Transliterator::createInstance(UnicodeString("Any-Latin/BGN"), UTRANS_FORWARD, icuError);
    if (U_FAILURE(icuError))
        LogPrintf(LogSeverityLevel::Error, "Failed to create global ICU Any-to-Latin transliterator: %d", icuError);

    icuError = U_ZERO_ERROR;
    g_pIcuAccentsAndDiacriticsConverter = Transliterator::createInstance(UnicodeString("NFD; [:Mn:] Remove; NFC"), UTRANS_FORWARD, icuError);
    if (U_FAILURE(icuError))
        LogPrintf(LogSeverityLevel::Error, "Failed to create global ICU accents&diacritics converter: %d", icuError);

    icuError = U_ZERO_ERROR;
    g_pIcuWordBreakIterator = BreakIterator::createWordInstance(Locale::getRoot(), icuError);
    if (U_FAILURE(icuError))
        LogPrintf(LogSeverityLevel::Error, "Failed to create global ICU word break iterator: %d", icuError);
}
Exemple #13
0
OSMAND_CORE_API QString OSMAND_CORE_CALL OsmAnd::ICU::transliterateToLatin(const QString& input)
{
    QString output;
    UErrorCode icuError = U_ZERO_ERROR;
    bool ok = true;

    const auto pTransliterator = g_pIcuTransliterator->clone();
    if(pTransliterator == nullptr || !U_SUCCESS(icuError))
    {
        LogPrintf(LogSeverityLevel::Error, "ICU error: %d", icuError);
        if(pTransliterator != nullptr)
            delete pTransliterator;
        return input;
    }

    UnicodeString icuString(reinterpret_cast<const UChar*>(input.unicode()), input.length());
    pTransliterator->transliterate(icuString);
    output = qMove(QString(reinterpret_cast<const QChar*>(icuString.getBuffer()), icuString.length()));

    if(pTransliterator != nullptr)
        delete pTransliterator;

    if(!ok)
    {
        LogPrintf(LogSeverityLevel::Error, "ICU error: %d", icuError);
        return input;
    }
    return output;
}
Exemple #14
0
void MachineModel::specialMoveZ(const float& z, const float& feed)
{
  FloatPoint sp = localPosition;
  sp.z = z; 
  sp.f = feed;
  qMove(sp);
}
Exemple #15
0
void TexturePacker::pack()
{
    QString basepath = Project::getActiveProject().getImagePath();

    SpriteArray sprites, usedSprites;
    recurseDirectory(sprites, basepath);

    SpriteAtlas& atlas = Project::getActiveProject().getSpriteAtlas();
    atlas.clear();

    do
    {
        MaxRectsAlgorithm maxrects(2046, 2046);
        maxrects.insert(sprites, usedSprites);

        if ( !usedSprites.isEmpty() )
        {
            SpriteSheet sheet = createSpriteSheet(usedSprites);
            atlas.append(qMove(sheet));

            usedSprites.clear();
        }
    }
    while ( !sprites.isEmpty() );

    atlas.save(Project::getActiveProject().getTileAtlasPath());
}
QList< std::shared_ptr<const OsmAnd::Road> > OsmAnd::CachingRoadLocator_P::findRoadsInArea(
    const PointI position31,
    const double radiusInMeters,
    const RoutingDataLevel dataLevel) const
{
    QList< std::shared_ptr<const Road> > roadsInBBox;

    const auto bbox31 = (AreaI)Utilities::boundingBox31FromAreaInMeters(radiusInMeters, position31);
    const auto obfDataInterface = owner->obfsCollection->obtainDataInterface(bbox31);
    QList< std::shared_ptr<const ObfRoutingSectionReader::DataBlock> > referencedCacheEntries;
    obfDataInterface->loadRoads(
        dataLevel,
        &bbox31,
        &roadsInBBox,
        nullptr,
        nullptr,
        &_cache,
        &referencedCacheEntries,
        nullptr,
        nullptr);

    {
        QMutexLocker scopedLocker(&_referencedDataBlocksMapMutex);

        for (auto& referencedBlock : referencedCacheEntries)
            _referencedDataBlocksMap[referencedBlock.get()].push_back(qMove(referencedBlock));
    }

    return RoadLocator::findRoadsInArea(roadsInBBox, position31, radiusInMeters);
}
Exemple #17
0
void MachineModel::specialMoveX(const float& x, const float& feed)
{
  FloatPoint sp = localPosition;
  sp.x = x;
  sp.f = feed;
  qMove(sp);
}
void OsmAnd::ObfPoiSectionReader_P::readCategory( const ObfReader_P& reader, const std::shared_ptr<AmenityCategory>& category )
{
    const auto cis = reader.getCodedInputStream().get();

    for(;;)
    {
        const auto tag = cis->ReadTag();
        switch(gpb::internal::WireFormatLite::GetTagFieldNumber(tag))
        {
        case 0:
            if (!ObfReaderUtilities::reachedDataEnd(cis))
                return;

            return;
        case OBF::OsmAndCategoryTable::kCategoryFieldNumber:
            ObfReaderUtilities::readQString(cis, category->_name);
            break;
        case OBF::OsmAndCategoryTable::kSubcategoriesFieldNumber:
            {
                QString name;
                if (ObfReaderUtilities::readQString(cis, name))
                    category->_subcategories.push_back(qMove(name));
            }
            break;
        default:
            ObfReaderUtilities::skipUnknownField(cis, tag);
            break;
        }
    }
}
void OsmAnd::ObfRoutingSectionReader_P::readBorderLinePoints(
    const std::unique_ptr<ObfReader_P>& reader,
    QList< std::shared_ptr<const ObfRoutingBorderLinePoint> >* resultOut /*= nullptr*/,
    IQueryFilter* filter /*= nullptr*/,
    std::function<bool (const std::shared_ptr<const ObfRoutingBorderLinePoint>&)> visitor /*= nullptr*/
    )
{
    auto cis = reader->_codedInputStream.get();

    PointI location;
    gpb::uint64 id;

    for(;;)
    {
        auto tag = cis->ReadTag();
        switch(gpb::internal::WireFormatLite::GetTagFieldNumber(tag))
        {
        case 0:
            return;
        case OBF::OsmAndRoutingIndex_RouteBorderPointsBlock::kXFieldNumber:
            cis->ReadVarint32(reinterpret_cast<gpb::uint32*>(&location.x));
            break;
        case OBF::OsmAndRoutingIndex_RouteBorderPointsBlock::kYFieldNumber:
            cis->ReadVarint32(reinterpret_cast<gpb::uint32*>(&location.y));
            break;
        case OBF::OsmAndRoutingIndex_RouteBorderPointsBlock::kBaseIdFieldNumber:
            cis->ReadVarint64(&id);
            break;
        case OBF::OsmAndRoutingIndex_RouteBorderPointsBlock::kPointsFieldNumber:
            {
                gpb::uint32 length;
                cis->ReadVarint32(&length);
                auto oldLimit = cis->PushLimit(length);

                const std::shared_ptr<ObfRoutingBorderLinePoint> point(new ObfRoutingBorderLinePoint());
                readBorderLinePoint(reader, point);

                cis->PopLimit(oldLimit);

                point->_id += id;
                point->_location += location;
                id = point->_id;
                location = point->_location;

                bool valid = true;
                if(filter)
                    valid = filter->acceptsPoint(point->location);
                if(valid && visitor)
                    valid = visitor(point);
                if(valid && resultOut)
                    resultOut->push_back(qMove(point));
            }
            break;
        default:
            ObfReaderUtilities::skipUnknownField(cis, tag);
            break;
        }
    }
}
bool OsmAnd::ResolvedMapStyle_P::mergeAndResolveParameters()
{
    // Process styles chain in direct order, to exclude redefined parameters
    auto citUnresolvedMapStyle = iteratorOf(owner->unresolvedMapStylesChain);
    while (citUnresolvedMapStyle.hasNext())
    {
        const auto& unresolvedMapStyle = citUnresolvedMapStyle.next();

        for (const auto& unresolvedParameter : constOf(unresolvedMapStyle->parameters))
        {
            const auto nameId = resolveStringIdInLUT(unresolvedParameter->name);
            auto& resolvedParameter = _parameters[nameId];

            // Skip already defined parameters
            if (resolvedParameter)
                continue;

            // Resolve possible values
            QList<MapStyleConstantValue> resolvedPossibleValues;
            for (const auto& possibleValue : constOf(unresolvedParameter->possibleValues))
            {
                MapStyleConstantValue resolvedPossibleValue;
                if (!parseConstantValue(possibleValue, unresolvedParameter->dataType, false, resolvedPossibleValue))
                {
                    LogPrintf(LogSeverityLevel::Error,
                        "Failed to parse '%s' as possible value for '%s' (%s)",
                        qPrintable(possibleValue),
                        qPrintable(unresolvedParameter->name),
                        qPrintable(unresolvedParameter->title));
                    return false;
                }

                resolvedPossibleValues.push_back(qMove(resolvedPossibleValue));
            }

            // Create new resolved parameter
            const std::shared_ptr<Parameter> newResolvedParameter(new Parameter(
                unresolvedParameter->title,
                unresolvedParameter->description,
                unresolvedParameter->category,
                nameId,
                unresolvedParameter->dataType,
                resolvedPossibleValues));
            resolvedParameter = newResolvedParameter;

            // Register parameter as value definition
            const auto newValueDefId = _valuesDefinitions.size();
            const std::shared_ptr<ParameterValueDefinition> inputValueDefinition(new ParameterValueDefinition(
                newValueDefId,
                unresolvedParameter->name,
                newResolvedParameter));
            _valuesDefinitions.push_back(inputValueDefinition);
            _valuesDefinitionsIndicesByName.insert(unresolvedParameter->name, newValueDefId);
        }
    }

    return true;
}
Exemple #21
0
int SettingApp::readDefualtWidthIndent()
{
    m_setting->beginGroup("settingSeptember");
        m_setting->beginGroup("defaultWidthIndent");
            int indent = m_setting->value("indent").toInt();
        m_setting->endGroup();
    m_setting->endGroup();
    return qMove(indent);
}
Exemple #22
0
int SettingApp::readDefualtWidthTab()
{
    m_setting->beginGroup("settingSeptember");
        m_setting->beginGroup("defaultWidthTab");
            int tab = m_setting->value("tab").toInt();
        m_setting->endGroup();
    m_setting->endGroup();
    return qMove(tab);
}
Exemple #23
0
QString SettingApp::readDefaultSettingKey(const QString& group, const QString& name)
{
    beginDefaultSchemeSettingKey();
        m_setting->beginGroup(group);
            QString key = m_setting->value(name).toString();
        m_setting->endGroup();
    endSetting();
    return qMove(key);
}
Exemple #24
0
QColor SettingApp::readDefaultSearchTextColorSettingSeptember()
{
    beginDefaultColorSettingSeptember();
        m_setting->beginGroup("searchTextColor");
            QColor color = qvariant_cast<QColor>(m_setting->value("searchText"));
        m_setting->endGroup();
    endSetting();
    return qMove(color);
}
Exemple #25
0
QColor SettingApp::readDefaultCurrentLineColorSettingSeptember()
{
    beginColorSettingSeptember();
        m_setting->beginGroup("currentLineColor");
            QColor color = qvariant_cast<QColor>(m_setting->value("currentLine"));
        m_setting->endGroup();
    endSetting();
    return qMove(color);
}
Exemple #26
0
bool SettingApp::readWarningChangeFileSeptember()
{
    m_setting->beginGroup("settingSeptember");
        m_setting->beginGroup("warningChangeFile");
            bool value = m_setting->value("changeFile").toBool();
        m_setting->endGroup();
    m_setting->endGroup();
    return qMove(value);
}
void tst_QAtomicIntegerXX::copy()
{
    QFETCH(LargeInt, value);

    QAtomicInteger<T> atomic(value);
    QAtomicInteger<T> copy(atomic);
    QCOMPARE(copy.load(), atomic.load());

    QAtomicInteger<T> copy2 = atomic;
    QCOMPARE(copy2.load(), atomic.load());

    // move
    QAtomicInteger<T> copy3(qMove(copy));
    QCOMPARE(copy3.load(), atomic.load());

    QAtomicInteger<T> copy4 = qMove(copy2);
    QCOMPARE(copy4.load(), atomic.load());
}
Exemple #28
0
QString SettingApp::readCurrentSchemeSettingSeptember()
{
    m_setting->beginGroup("settingSeptember");
        m_setting->beginGroup("currentScheme");
            QString current = m_setting->value("name").toString();
        m_setting->endGroup();
    m_setting->endGroup();
    return qMove(current);
}
Exemple #29
0
QPair<QColor, QFont::Weight> SettingApp::readDefaultNumberQssSeptember()
{
    beginDefaultQssSettingSeptember();
        m_setting->beginGroup("numberQss");
            QPair<QColor, QFont::Weight> pair = { qvariant_cast<QColor>(m_setting->value("color")),
                                                  static_cast<QFont::Weight>(m_setting->value("weight").toInt()) };
        m_setting->endGroup();
    endSetting();
    return qMove(pair);
}
void OsmAnd::ObfRoutingSectionReader_P::readBorderBoxLinesHeaders(const std::unique_ptr<ObfReader_P>& reader,
    QList< std::shared_ptr<const ObfRoutingBorderLineHeader> >* resultOut /*= nullptr*/,
    IQueryFilter* filter /*= nullptr*/,
    std::function<bool (const std::shared_ptr<const ObfRoutingBorderLineHeader>&)> visitor /*= nullptr*/)
{
    auto cis = reader->_codedInputStream.get();
    for(;;)
    {
        auto tag = cis->ReadTag();
        switch(gpb::internal::WireFormatLite::GetTagFieldNumber(tag))
        {
        case 0:
            return;
        case OBF::OsmAndRoutingIndex_RouteBorderBox::kBorderLinesFieldNumber:
            {
                auto offset = cis->CurrentPosition();
                gpb::uint32 length;
                cis->ReadVarint32(&length);
                auto oldLimit = cis->PushLimit(length);

                const std::shared_ptr<ObfRoutingBorderLineHeader> line(new ObfRoutingBorderLineHeader());
                readBorderLineHeader(reader, line, offset);

                cis->PopLimit(oldLimit);

                bool isValid = true;
                if(filter)
                {
                    if(line->_x2present)
                        isValid = filter->acceptsArea(AreaI(line->_x, line->_y, line->_x2, line->_y));
                    else
                        isValid = false;
                    /*FIXME: borders approach
                    else if(ln.hasToy())
                        isValid = req.intersects(ln.getX(), ln.getY(), ln.getX(), ln.getToy());*/
                }
                if(isValid)
                {
                     if(!visitor || (visitor && visitor(line)))
                     {
                         if(resultOut)
                             resultOut->push_back(qMove(line));
                     }
                }
            }
            break;
        case OBF::OsmAndRoutingIndex_RouteBorderBox::kBlocksFieldNumber:
            return;
        default:
            ObfReaderUtilities::skipUnknownField(cis, tag);
            break;
        }
    }
}