~michihenning/storage-framework/no-boost-with-remote-client

« back to all changes in this revision

Viewing changes to include/unity/storage/qt/client/Item.h

  • Committer: Michi Henning
  • Date: 2016-06-21 09:00:56 UTC
  • mfrom: (10.1.34 add_tests)
  • Revision ID: michi.henning@canonical.com-20160621090056-89bbdmj5yq3o5v0s
Merged add_tests branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#pragma once
2
2
 
3
 
#include <unity/storage/common/common.h>
 
3
#include <unity/storage/common.h>
 
4
#include <unity/storage/visibility.h>
4
5
 
5
6
#include <QDateTime>
6
7
#pragma GCC diagnostic push
33
34
/**
34
35
\brief Base class for files and directories.
35
36
*/
36
 
class Item
 
37
class UNITY_STORAGE_EXPORT Item
37
38
{
38
39
public:
39
 
    ~Item();
40
 
    Item(Item const&) = delete;
41
 
    Item& operator=(Item const&) = delete;
 
40
    /// @cond
 
41
    virtual ~Item();
 
42
    /// @endcond
 
43
 
42
44
    Item(Item&&);
43
45
    Item& operator=(Item&&);
44
46
 
 
47
    /**
 
48
    \brief Convenience type definition.
 
49
    */
45
50
    typedef std::shared_ptr<Item> SPtr;
46
51
 
47
52
    /**
65
70
    Root* root() const;
66
71
 
67
72
    /**
 
73
    \brief Returns the type of the item.
 
74
    */
 
75
    ItemType type() const;
 
76
 
 
77
    /**
68
78
    \brief Returns metadata for the item.
69
79
 
70
 
    \warning The returned metadata is specific to the storage backend. Do not use this method
71
 
    for generic applications that must work with arbitrary backends.
72
 
    TODO: Needs a lot more doc. Should we provide this method at all?
 
80
    TODO: Needs a lot more doc. Explain standard and provider-specific metadata.
73
81
    */
74
 
    QFuture<QVariantMap> metadata() const;
 
82
    QVariantMap metadata() const;
75
83
 
76
84
    /**
77
85
    \brief Returns the time at which the item was last modified.
78
86
    */
79
 
    QFuture<QDateTime> last_modified_time() const;
80
 
 
81
 
    /**
82
 
    \brief Returns the type of the item.
83
 
    */
84
 
    unity::storage::common::ItemType type() const;
 
87
    QDateTime last_modified_time() const;
 
88
 
 
89
    /**
 
90
    \brief Returns a list of parent folders of this item.
 
91
    \return A vector of parents. For a root, the returned vector is empty.
 
92
    */
 
93
    QFuture<QVector<std::shared_ptr<Folder>>> parents() const;
 
94
 
 
95
    /**
 
96
    \brief Returns the native identities of the parents of this item.
 
97
    \return A vector of parent identities. For a root, the returned vector is empty.
 
98
    */
 
99
    QVector<QString> parent_ids() const;
85
100
 
86
101
    /**
87
102
    \brief Copies this item.
109
124
    */
110
125
    QFuture<void> destroy();
111
126
 
 
127
    bool equal_to(Item::SPtr const& other) const noexcept;
 
128
 
112
129
protected:
113
130
    Item(internal::ItemImpl* p);
114
131
 
115
 
    std::unique_ptr<internal::ItemImpl> p_;
 
132
    std::shared_ptr<internal::ItemImpl> p_;
116
133
};
117
134
 
118
135
}  // namespace client