Changeset View
Changeset View
Standalone View
Standalone View
src/kalziumnumerationtype.cpp
Show All 34 Lines | |||||
35 | { | 35 | { | ||
36 | static KalziumNumerationTypeFactory kntf; | 36 | static KalziumNumerationTypeFactory kntf; | ||
37 | return &kntf; | 37 | return &kntf; | ||
38 | } | 38 | } | ||
39 | 39 | | |||
40 | KalziumNumerationType* KalziumNumerationTypeFactory::build(int id) const | 40 | KalziumNumerationType* KalziumNumerationTypeFactory::build(int id) const | ||
41 | { | 41 | { | ||
42 | if ((id < 0) || (id >= m_numerations.count())) { | 42 | if ((id < 0) || (id >= m_numerations.count())) { | ||
43 | return 0; | 43 | return nullptr; | ||
44 | } | 44 | } | ||
45 | 45 | | |||
46 | return m_numerations.at(id); | 46 | return m_numerations.at(id); | ||
47 | } | 47 | } | ||
48 | 48 | | |||
49 | KalziumNumerationType* KalziumNumerationTypeFactory::build(const QByteArray& id) const | 49 | KalziumNumerationType* KalziumNumerationTypeFactory::build(const QByteArray& id) const | ||
50 | { | 50 | { | ||
51 | for (int i = 0; i < m_numerations.count(); ++i) { | 51 | for (int i = 0; i < m_numerations.count(); ++i) { | ||
52 | if (m_numerations.at(i)->name() == id) { | 52 | if (m_numerations.at(i)->name() == id) { | ||
53 | return m_numerations.at(i); | 53 | return m_numerations.at(i); | ||
54 | } | 54 | } | ||
55 | } | 55 | } | ||
56 | 56 | | |||
57 | // not found | 57 | // not found | ||
58 | return 0; | 58 | return nullptr; | ||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | QStringList KalziumNumerationTypeFactory::numerations() const | 61 | QStringList KalziumNumerationTypeFactory::numerations() const | ||
62 | { | 62 | { | ||
63 | QStringList l; | 63 | QStringList l; | ||
64 | for (int i = 0; i < m_numerations.count(); ++i) { | 64 | for (int i = 0; i < m_numerations.count(); ++i) { | ||
65 | l << m_numerations.at(i)->description(); | 65 | l << m_numerations.at(i)->description(); | ||
66 | } | 66 | } | ||
67 | return l; | 67 | return l; | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | 70 | | |||
71 | KalziumNumerationType* KalziumNumerationType::instance() | 71 | KalziumNumerationType* KalziumNumerationType::instance() | ||
72 | { | 72 | { | ||
73 | return 0; | 73 | return nullptr; | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | KalziumNumerationType::KalziumNumerationType() | 76 | KalziumNumerationType::KalziumNumerationType() | ||
77 | { | 77 | { | ||
78 | } | 78 | } | ||
79 | 79 | | |||
80 | KalziumNumerationType::~KalziumNumerationType() | 80 | KalziumNumerationType::~KalziumNumerationType() | ||
81 | { | 81 | { | ||
▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines |