1 // Compound interfix type for compound discovery and display
2 // Copyright © 2009 The University of Chicago
6 // See the CLexicon class in Lexicon.h for an overview of compound discovery.
9 #include <q3listview.h>
17 class CLinkerListViewItem
: public Q3ListViewItem
{
19 QMap
<QString
, QString
>* m_filter
;
21 // construction/destruction.
23 explicit CLinkerListViewItem(Q3ListView
* parent
= 0,
24 QString linker_text
= QString(), CLinker
* linker
= 0,
25 QMap
<QString
, QString
>* filter
= 0);
26 explicit CLinkerListViewItem(Q3ListViewItem
* parent
,
27 QString linker_text
= QString(), CLinker
* linker
= 0,
28 QMap
<QString
, QString
>* filter
= 0);
32 CLinkerListViewItem(const CLinkerListViewItem
& x
)
35 m_filter(x
.m_filter
) { }
36 CLinkerListViewItem
& operator=(const CLinkerListViewItem
& x
)
38 Q3ListViewItem::operator=(x
);
39 m_linker
= x
.m_linker
;
40 m_filter
= x
.m_filter
;
44 // Qt3 list view item interface.
46 virtual QString
text(int column_index
) const;
47 virtual QString
key(int column
, bool ascending
) const;
49 // underlying linker object.
51 CLinker
* GetLinker() const { return m_linker
; }
52 void SetLinker(CLinker
* pLinker
) { m_linker
= pLinker
; }
55 class CLinker
: public CAffix
{
56 double m_CompoundCount
;
57 QList
<CCompound
*>* m_CompoundPtrList
;
59 // construction/destruction.
61 explicit CLinker(CMiniLexicon
* mini
);
62 CLinker(const CStringSurrogate
& text
, CMiniLexicon
* mini
);
65 // disable default-construction, copy
68 CLinker(const CLinker
& x
);
69 CLinker
& operator=(const CLinker
& x
);
72 void ListDisplay(Q3ListView
* parent
,
73 QMap
<QString
, QString
>* filter
= 0);
77 CCompound
* GetAtCompound(int i
) { return m_CompoundPtrList
->at(i
); }
78 int GetNumberOfCompounds() { return m_CompoundPtrList
->count(); }
79 void ClearCompoundPtrList();
80 void AddCompound(CCompound
* compound
);
81 void RemoveCompound(CCompound
* compound
);
85 double GetCompoundCount() { return m_CompoundCount
; }
86 void IncrementCompoundCount(double d
= 1.0) { m_CompoundCount
+= d
; }
88 // description length.
90 virtual double GetLengthOfPointerToMe();