コード例 #1
0
ファイル: Directory.cpp プロジェクト: marcomagdy/aws-sdk-cpp
        Aws::Map<Aws::String, DirectoryEntry> DirectoryTree::Diff(DirectoryTree& other)
        {
            Aws::Map<Aws::String, DirectoryEntry> thisEntries;
            auto thisTraversal = [&thisEntries](const DirectoryTree*, const DirectoryEntry& entry)
            {
                thisEntries[entry.relativePath] = entry;
                return true;
            };

            Aws::Map<Aws::String, DirectoryEntry> otherEntries;
            auto otherTraversal = [&thisEntries, &otherEntries](const DirectoryTree*, const DirectoryEntry& entry)
            {
                auto thisEntry = thisEntries.find(entry.relativePath);
                if (thisEntry != thisEntries.end())
                {
                    thisEntries.erase(entry.relativePath);
                }
                else
                {
                    otherEntries[entry.relativePath] = entry;
                }

                return true;
            };

            TraverseDepthFirst(thisTraversal);
            other.TraverseDepthFirst(otherTraversal);

            thisEntries.insert(otherEntries.begin(), otherEntries.end());
            return thisEntries;
        }
コード例 #2
0
AttributeValue& AttributeValue::AddMEntry(const Aws::String& key, const std::shared_ptr<AttributeValue>& value)
{
    if (!m_value)
    {
        Aws::Map<Aws::String, const std::shared_ptr<AttributeValue>> map;
        auto kvp = std::pair<Aws::String, const std::shared_ptr<AttributeValue>>(key, value);
        map.insert(map.begin(), kvp);
        m_value = Aws::MakeShared<AttributeValueMap>("AttributeValue", map);
    }
    else
    {
        m_value->AddMEntry(key, value);
    }

    return *this;
}