equal
deleted
inserted
replaced
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 * Version : %version: 5 % |
16 * Version : %version: 6 % |
17 */ |
17 */ |
18 #include "bmhelper.h" |
18 #include "bmhelper.h" |
19 #include <QDebug> |
19 #include <QDebug> |
20 |
20 |
21 BMHelper::BMHelper(int totalSize) |
21 BMHelper::BMHelper(int totalSize) |
120 int BMHelper::totalSize() |
120 int BMHelper::totalSize() |
121 { |
121 { |
122 return mBuffer.count(); |
122 return mBuffer.count(); |
123 } |
123 } |
124 |
124 |
|
125 void BMHelper::resizeCache(int newSize) |
|
126 { |
|
127 int diff = totalSize() - newSize; |
|
128 |
|
129 while (diff != 0){ |
|
130 if (diff >0){ |
|
131 remove(mBuffer.count()-1); |
|
132 diff--; |
|
133 }else{ |
|
134 insert(mBuffer.count()); |
|
135 diff++; |
|
136 } |
|
137 } |
|
138 |
|
139 } |
|
140 |
125 void BMHelper::remove(int pos) |
141 void BMHelper::remove(int pos) |
126 { |
142 { |
127 if ( pos <0 || pos > mBuffer.count()){ |
143 if ( pos <0 || pos > mBuffer.count()){ |
128 return; |
144 return; |
129 } |
145 } |