CMiniLexicon::FindMajorSignatures(): use log file routines
[linguistica.git] / Linker.h
blob07484955e6b39a0964e6991f41d4e22dab75d463
1 // Compound interfix type for compound discovery and display
2 // Copyright © 2009 The University of Chicago
3 #ifndef LINKER_H
4 #define LINKER_H
6 // See the CLexicon class in Lexicon.h for an overview of compound discovery.
8 #include "Affix.h"
9 #include <q3listview.h>
10 #include <QList>
12 class CLParse;
13 class CMiniLexicon;
14 class CLinker;
15 class CCompound;
17 class CLinkerListViewItem : public Q3ListViewItem {
18 CLinker* m_linker;
19 QMap<QString, QString>* m_filter;
20 public:
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);
30 // copy.
32 CLinkerListViewItem(const CLinkerListViewItem& x)
33 : Q3ListViewItem(x),
34 m_linker(x.m_linker),
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;
41 return *this;
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;
58 public:
59 // construction/destruction.
61 explicit CLinker(CMiniLexicon* mini);
62 CLinker(const CStringSurrogate& text, CMiniLexicon* mini);
63 virtual ~CLinker();
65 // disable default-construction, copy
66 private:
67 CLinker();
68 CLinker(const CLinker& x);
69 CLinker& operator=(const CLinker& x);
70 public:
71 /// output to GUI
72 void ListDisplay(Q3ListView* parent,
73 QMap<QString, QString>* filter = 0);
75 // compound list.
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);
83 // compound count.
85 double GetCompoundCount() { return m_CompoundCount; }
86 void IncrementCompoundCount(double d = 1.0) { m_CompoundCount += d; }
88 // description length.
90 virtual double GetLengthOfPointerToMe();
93 #endif // LINKER_H