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