| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,98 @@ |
| 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 "flashitem.h" |
|
| 13 |
+ |
|
| 14 |
+/** |
|
| 15 |
+ * Constructor for creating a Flash item |
|
| 16 |
+ * |
|
| 17 |
+ * @param line Line number in the source file |
|
| 18 |
+ * @param name Name of the const data |
|
| 19 |
+ * @param valueList List of const data which will be stored in the Flash |
|
| 20 |
+ */ |
|
| 21 |
+FlashItem::FlashItem(int line, const QString &name, const QList<QString> &valueList) |
|
| 22 |
+{
|
|
| 23 |
+ this->line = line; |
|
| 24 |
+ this->name = name; |
|
| 25 |
+ |
|
| 26 |
+ this->valueList = valueList; |
|
| 27 |
+ this->address = 0; |
|
| 28 |
+} |
|
| 29 |
+ |
|
| 30 |
+/** |
|
| 31 |
+ * Get the line number where the const data occurred |
|
| 32 |
+ * |
|
| 33 |
+ * @return Line number in the source file |
|
| 34 |
+ */ |
|
| 35 |
+int FlashItem::getLine() const |
|
| 36 |
+{
|
|
| 37 |
+ return(this->line); |
|
| 38 |
+} |
|
| 39 |
+ |
|
| 40 |
+/** |
|
| 41 |
+ * Get the name of the const data |
|
| 42 |
+ * |
|
| 43 |
+ * @return Name of the const data |
|
| 44 |
+ */ |
|
| 45 |
+const QString &FlashItem::getName() const |
|
| 46 |
+{
|
|
| 47 |
+ return(this->name); |
|
| 48 |
+} |
|
| 49 |
+ |
|
| 50 |
+/** |
|
| 51 |
+ * Get the list of the const data in a raw form |
|
| 52 |
+ * |
|
| 53 |
+ * @return List of the const data in a raw form |
|
| 54 |
+ */ |
|
| 55 |
+const QList<QString> &FlashItem::getValueList() const |
|
| 56 |
+{
|
|
| 57 |
+ return(this->valueList); |
|
| 58 |
+} |
|
| 59 |
+ |
|
| 60 |
+/** |
|
| 61 |
+ * Get the size of the const data |
|
| 62 |
+ * |
|
| 63 |
+ * @return Size of the const data |
|
| 64 |
+ */ |
|
| 65 |
+int FlashItem::getDataSize() const |
|
| 66 |
+{
|
|
| 67 |
+ return(this->dataVector.size()); |
|
| 68 |
+} |
|
| 69 |
+ |
|
| 70 |
+/** |
|
| 71 |
+ * Get the list of the const data in a binary form |
|
| 72 |
+ * |
|
| 73 |
+ * @return List of the const data in a binary form |
|
| 74 |
+ */ |
|
| 75 |
+QVector<unsigned char> &FlashItem::getDataVector() |
|
| 76 |
+{
|
|
| 77 |
+ return(this->dataVector); |
|
| 78 |
+} |
|
| 79 |
+ |
|
| 80 |
+/** |
|
| 81 |
+ * Set the address in the memory |
|
| 82 |
+ * |
|
| 83 |
+ * @param address Address in the memory |
|
| 84 |
+ */ |
|
| 85 |
+void FlashItem::setAddress(unsigned int address) |
|
| 86 |
+{
|
|
| 87 |
+ this->address = address; |
|
| 88 |
+} |
|
| 89 |
+ |
|
| 90 |
+/** |
|
| 91 |
+ * Get the address in the memory |
|
| 92 |
+ * |
|
| 93 |
+ * @return Address in the memory |
|
| 94 |
+ */ |
|
| 95 |
+unsigned int FlashItem::getAddress() const |
|
| 96 |
+{
|
|
| 97 |
+ return(this->address); |
|
| 98 |
+} |