9 #include <QJsonDocument>
10 #include <QJsonObject>
19 * \brief 単語間のリンクを表現するクラスです。
21 * 原単語と訳単語の多対多のリンクを表現します。
26 typedef std::shared_ptr<WordLink> pointer;
27 typedef QList<Text::pointer> storage_type;
30 enum : int { Source, Target, };
34 WordLink(int place, Text::pointer word);
38 void append(int place, Text::pointer word);
39 void remove(int place, Text::pointer word);
41 bool is_valid() const;
42 bool is_empty() const;
43 bool contains(int place, Text::pointer word);
44 int size(int place) const;
46 storage_type* sources();
47 storage_type* targets();
49 QString debug_dump() const;
51 static pointer create();
52 static pointer create(int place, Text::pointer word);
55 storage_type m_sources;
56 storage_type m_targets;
60 * \brief 単語間のリンクを作成・保持するクラスです。
62 * 複数の単語間リンクを保持するコンテナとしての機能を持ちます。
63 * 現在編集中の単語間リンクを明示する機能があります。
65 * ある特定の単語間リンクを編集するには、start()を呼び出し編集を開始し、
66 * append()呼び出しによってリンクへ単語を追加し、
67 * commit()呼び出しによって編集を終了します。
72 typedef QList<WordLink::pointer> storage_type;
73 typedef storage_type::iterator iterator;
74 typedef storage_type::const_iterator const_iterator;
81 void append(int place, Text::pointer word);
82 void remove(int place, Text::pointer word);
83 void toggle(int place, Text::pointer word);
85 WordLink::pointer current();
87 WordLink::pointer find(Text::pointer word);
88 WordLink::pointer find(int place, Text::pointer word);
90 int index_of(WordLink::pointer link) const;
95 QString debug_dump() const;
98 WordLink::pointer m_current_link;