| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,231 @@ |
| 1 |
+/* |
|
| 2 |
+ * Author: Pawel Jablonski |
|
| 3 |
+ * E-mail: pj@xirx.net |
|
| 4 |
+ * WWW: xirx.net |
|
| 5 |
+ * GIT: git.xirx.net |
|
| 6 |
+ * |
|
| 7 |
+ * License: You can use this code however you like |
|
| 8 |
+ * but leave information about the original author. |
|
| 9 |
+ * Code is free for non-commercial and commercial use. |
|
| 10 |
+ */ |
|
| 11 |
+ |
|
| 12 |
+#include "datalist.h" |
|
| 13 |
+ |
|
| 14 |
+/** |
|
| 15 |
+ * Constructor for creating a data list |
|
| 16 |
+ * |
|
| 17 |
+ * @param mode Mode selection for how the application should be compiled and where in memory it will reside |
|
| 18 |
+ */ |
|
| 19 |
+DataList::DataList(DataList::Mode mode) |
|
| 20 |
+{
|
|
| 21 |
+ this->mode = mode; |
|
| 22 |
+} |
|
| 23 |
+ |
|
| 24 |
+/** |
|
| 25 |
+ * Get the mode |
|
| 26 |
+ * |
|
| 27 |
+ * @return Mode |
|
| 28 |
+ */ |
|
| 29 |
+DataList::Mode DataList::getMode() const |
|
| 30 |
+{
|
|
| 31 |
+ return(this->mode); |
|
| 32 |
+} |
|
| 33 |
+ |
|
| 34 |
+/** |
|
| 35 |
+ * Add an external code section to the data list |
|
| 36 |
+ * |
|
| 37 |
+ * @param codeSection External code section |
|
| 38 |
+ * |
|
| 39 |
+ * @return Status of adding the item |
|
| 40 |
+ */ |
|
| 41 |
+bool DataList::addExternalCodeSection(const QSharedPointer<CodeSection> &codeSection) |
|
| 42 |
+{
|
|
| 43 |
+ if(this->addGlobalCodeSection(codeSection)) |
|
| 44 |
+ {
|
|
| 45 |
+ this->externalCodeSectionList.append(codeSection); |
|
| 46 |
+ |
|
| 47 |
+ return(true); |
|
| 48 |
+ } |
|
| 49 |
+ |
|
| 50 |
+ return(false); |
|
| 51 |
+} |
|
| 52 |
+ |
|
| 53 |
+/** |
|
| 54 |
+ * Add an external RAM item to the data list |
|
| 55 |
+ * |
|
| 56 |
+ * @param ramItem External RAM item |
|
| 57 |
+ * |
|
| 58 |
+ * @return Status of adding the item |
|
| 59 |
+ */ |
|
| 60 |
+bool DataList::addExternalRamItem(const QSharedPointer<RamItem> &ramItem) |
|
| 61 |
+{
|
|
| 62 |
+ if(this->addGlobalRamItem(ramItem)) |
|
| 63 |
+ {
|
|
| 64 |
+ this->externalRamItemList.append(ramItem); |
|
| 65 |
+ |
|
| 66 |
+ return(true); |
|
| 67 |
+ } |
|
| 68 |
+ |
|
| 69 |
+ return(false); |
|
| 70 |
+} |
|
| 71 |
+ |
|
| 72 |
+/** |
|
| 73 |
+ * Add an external Flash item to the data list |
|
| 74 |
+ * |
|
| 75 |
+ * @param flashItem External Flash item |
|
| 76 |
+ * |
|
| 77 |
+ * @return Status of adding the item |
|
| 78 |
+ */ |
|
| 79 |
+bool DataList::addExternalFlashItem(const QSharedPointer<FlashItem> &flashItem) |
|
| 80 |
+{
|
|
| 81 |
+ if(this->addGlobalFlashItem(flashItem)) |
|
| 82 |
+ {
|
|
| 83 |
+ this->externalFlashItemList.append(flashItem); |
|
| 84 |
+ |
|
| 85 |
+ return(true); |
|
| 86 |
+ } |
|
| 87 |
+ |
|
| 88 |
+ return(false); |
|
| 89 |
+} |
|
| 90 |
+ |
|
| 91 |
+/** |
|
| 92 |
+ * Add a global code section to the data list |
|
| 93 |
+ * |
|
| 94 |
+ * @param codeSection Global code section |
|
| 95 |
+ * |
|
| 96 |
+ * @return Status of adding the item |
|
| 97 |
+ */ |
|
| 98 |
+bool DataList::addGlobalCodeSection(const QSharedPointer<CodeSection> &codeSection) |
|
| 99 |
+{
|
|
| 100 |
+ for(const QSharedPointer<CodeSection> &codeSectionFor : this->globalCodeSectionList) |
|
| 101 |
+ {
|
|
| 102 |
+ if(!codeSectionFor->getName().compare(codeSection->getName(), Qt::CaseInsensitive)) |
|
| 103 |
+ {
|
|
| 104 |
+ return(false); |
|
| 105 |
+ } |
|
| 106 |
+ } |
|
| 107 |
+ |
|
| 108 |
+ this->globalCodeSectionList.append(codeSection); |
|
| 109 |
+ |
|
| 110 |
+ return(true); |
|
| 111 |
+} |
|
| 112 |
+ |
|
| 113 |
+/** |
|
| 114 |
+ * Add a global RAM item to the data list |
|
| 115 |
+ * |
|
| 116 |
+ * @param ramItem Global RAM item |
|
| 117 |
+ * |
|
| 118 |
+ * @return Status of adding the item |
|
| 119 |
+ */ |
|
| 120 |
+bool DataList::addGlobalRamItem(const QSharedPointer<RamItem> &ramItem) |
|
| 121 |
+{
|
|
| 122 |
+ for(const QSharedPointer<RamItem> &ramItemFor : this->globalRamItemList) |
|
| 123 |
+ {
|
|
| 124 |
+ if(!ramItemFor->getName().compare(ramItem->getName(), Qt::CaseInsensitive)) |
|
| 125 |
+ {
|
|
| 126 |
+ return(false); |
|
| 127 |
+ } |
|
| 128 |
+ } |
|
| 129 |
+ |
|
| 130 |
+ for(const QSharedPointer<FlashItem> &flashItemFor : this->globalFlashItemList) |
|
| 131 |
+ {
|
|
| 132 |
+ if(!flashItemFor->getName().compare(ramItem->getName(), Qt::CaseInsensitive)) |
|
| 133 |
+ {
|
|
| 134 |
+ return(false); |
|
| 135 |
+ } |
|
| 136 |
+ } |
|
| 137 |
+ |
|
| 138 |
+ this->globalRamItemList.append(ramItem); |
|
| 139 |
+ |
|
| 140 |
+ return(true); |
|
| 141 |
+} |
|
| 142 |
+ |
|
| 143 |
+/** |
|
| 144 |
+ * Add a global Flash item to the data list |
|
| 145 |
+ * |
|
| 146 |
+ * @param flashItem Global Flash item |
|
| 147 |
+ * |
|
| 148 |
+ * @return Status of adding the item |
|
| 149 |
+ */ |
|
| 150 |
+bool DataList::addGlobalFlashItem(const QSharedPointer<FlashItem> &flashItem) |
|
| 151 |
+{
|
|
| 152 |
+ for(const QSharedPointer<FlashItem> &flashItemFor : this->globalFlashItemList) |
|
| 153 |
+ {
|
|
| 154 |
+ if(!flashItemFor->getName().compare(flashItem->getName(), Qt::CaseInsensitive)) |
|
| 155 |
+ {
|
|
| 156 |
+ return(false); |
|
| 157 |
+ } |
|
| 158 |
+ } |
|
| 159 |
+ |
|
| 160 |
+ for(const QSharedPointer<RamItem> &ramItemFor : this->globalRamItemList) |
|
| 161 |
+ {
|
|
| 162 |
+ if(!ramItemFor->getName().compare(flashItem->getName(), Qt::CaseInsensitive)) |
|
| 163 |
+ {
|
|
| 164 |
+ return(false); |
|
| 165 |
+ } |
|
| 166 |
+ } |
|
| 167 |
+ |
|
| 168 |
+ this->globalFlashItemList.append(flashItem); |
|
| 169 |
+ |
|
| 170 |
+ return(true); |
|
| 171 |
+} |
|
| 172 |
+ |
|
| 173 |
+/** |
|
| 174 |
+ * Get the external code section list |
|
| 175 |
+ * |
|
| 176 |
+ * @return External code section list |
|
| 177 |
+ */ |
|
| 178 |
+QList<QSharedPointer<CodeSection>> &DataList::getExternalCodeSectionList() |
|
| 179 |
+{
|
|
| 180 |
+ return(this->externalCodeSectionList); |
|
| 181 |
+} |
|
| 182 |
+ |
|
| 183 |
+/** |
|
| 184 |
+ * Get the external RAM item list |
|
| 185 |
+ * |
|
| 186 |
+ * @return External RAM item list |
|
| 187 |
+ */ |
|
| 188 |
+QList<QSharedPointer<RamItem>> &DataList::getExternalRamItemList() |
|
| 189 |
+{
|
|
| 190 |
+ return(this->externalRamItemList); |
|
| 191 |
+} |
|
| 192 |
+ |
|
| 193 |
+/** |
|
| 194 |
+ * Get the external Flash item list |
|
| 195 |
+ * |
|
| 196 |
+ * @return External Flash item list |
|
| 197 |
+ */ |
|
| 198 |
+QList<QSharedPointer<FlashItem>> &DataList::getExternalFlashItemList() |
|
| 199 |
+{
|
|
| 200 |
+ return(this->externalFlashItemList); |
|
| 201 |
+} |
|
| 202 |
+ |
|
| 203 |
+/** |
|
| 204 |
+ * Get the global code section list |
|
| 205 |
+ * |
|
| 206 |
+ * @return Global code section list |
|
| 207 |
+ */ |
|
| 208 |
+QList<QSharedPointer<CodeSection>> &DataList::getGlobalCodeSectionList() |
|
| 209 |
+{
|
|
| 210 |
+ return(this->globalCodeSectionList); |
|
| 211 |
+} |
|
| 212 |
+ |
|
| 213 |
+/** |
|
| 214 |
+ * Get the global RAM item list |
|
| 215 |
+ * |
|
| 216 |
+ * @return Global RAM item list |
|
| 217 |
+ */ |
|
| 218 |
+QList<QSharedPointer<RamItem>> &DataList::getGlobalRamItemList() |
|
| 219 |
+{
|
|
| 220 |
+ return(this->globalRamItemList); |
|
| 221 |
+} |
|
| 222 |
+ |
|
| 223 |
+/** |
|
| 224 |
+ * Get the global Flash item list |
|
| 225 |
+ * |
|
| 226 |
+ * @return Global Flash item list |
|
| 227 |
+ */ |
|
| 228 |
+QList<QSharedPointer<FlashItem>> &DataList::getGlobalFlashItemList() |
|
| 229 |
+{
|
|
| 230 |
+ return(this->globalFlashItemList); |
|
| 231 |
+} |