summaryrefslogtreecommitdiffstats
path: root/sync/api/attachments/attachment_metadata.h
blob: 43343dbdfe6d4c80fe1571b4543c2a89d1fdd39f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_METADATA_H_
#define SYNC_API_ATTACHMENTS_ATTACHMENT_METADATA_H_

#include <stddef.h>

#include <vector>

#include "sync/api/attachments/attachment_id.h"
#include "sync/base/sync_export.h"

namespace syncer {

// This class represents immutable Attachment metadata.
//
// It is OK to copy and return AttachmentMetadata by value.
class SYNC_EXPORT AttachmentMetadata {
 public:
  AttachmentMetadata(const AttachmentId& id, size_t size);
  ~AttachmentMetadata();

  // Default copy and assignment are welcome.

  // Returns this attachment's id.
  const AttachmentId& GetId() const;

  // Returns this attachment's size in bytes.
  size_t GetSize() const;

 private:
  // TODO(maniscalco): Reconcile AttachmentMetadata and
  // AttachmentId. AttachmentId knows the size of the attachment so
  // AttachmentMetadata may not be necessary (crbug/465375).
  AttachmentId id_;
  size_t size_;
};

typedef std::vector<syncer::AttachmentMetadata> AttachmentMetadataList;

}  // namespace syncer

#endif  // SYNC_API_ATTACHMENTS_ATTACHMENT_METADATA_H_