1// Aseprite Document Library
2// Copyright (C) 2019 Igara Studio S.A.
3// Copyright (C) 2001-2015 David Capello
4//
5// This file is released under the terms of the MIT license.
6// Read LICENSE.txt for more information.
7
8#ifndef DOC_TAGS_H_INCLUDED
9#define DOC_TAGS_H_INCLUDED
10#pragma once
11
12#include "base/disable_copying.h"
13#include "doc/frame.h"
14#include "doc/object_id.h"
15
16#include <string>
17#include <vector>
18
19namespace doc {
20
21 class Tag;
22 class Sprite;
23
24 class Tags {
25 typedef std::vector<Tag*> List;
26
27 public:
28 typedef List::iterator iterator;
29 typedef List::const_iterator const_iterator;
30
31 Tags(Sprite* sprite);
32 ~Tags();
33
34 Sprite* sprite() { return m_sprite; }
35
36 void add(Tag* tag);
37 void remove(Tag* tag);
38
39 Tag* getByName(const std::string& name) const;
40 Tag* getById(const ObjectId id) const;
41
42 iterator begin() { return m_tags.begin(); }
43 iterator end() { return m_tags.end(); }
44 const_iterator begin() const { return m_tags.begin(); }
45 const_iterator end() const { return m_tags.end(); }
46
47 std::size_t size() const { return m_tags.size(); }
48 bool empty() const { return m_tags.empty(); }
49
50 Tag* innerTag(const frame_t frame) const;
51 Tag* outerTag(const frame_t frame) const;
52
53 private:
54 Sprite* m_sprite;
55 List m_tags;
56
57 DISABLE_COPYING(Tags);
58 };
59
60} // namespace doc
61
62#endif
63