summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-28 14:56:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-28 14:56:27 -0700
commitaef780db30c434e1d681d81852fb13160e72ed1e (patch)
tree24810c630b3b27649c0dd856d795c0069ca5bcd6 /xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
parent8e957baa851aed4b02511d04a66c0f95387d1e10 (diff)
downloadpdfium-aef780db30c434e1d681d81852fb13160e72ed1e.tar.xz
Replace CFX_PtrArray with typesafe CFX_ArrayTemplate, part 4
Review-Url: https://codereview.chromium.org/1932703003
Diffstat (limited to 'xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp')
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
index eb6d194b55..507c91878e 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
@@ -24,36 +24,40 @@
#include "xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h"
CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
- CBC_QRCoderECB* ecBlocks) {
- m_ecCodeWordsPerBlock = ecCodeWordsPerBlock;
- m_ecBlocks.Add(ecBlocks);
+ CBC_QRCoderECB* ecBlocks)
+ : m_ecCodeWordsPerBlock(ecCodeWordsPerBlock) {
+ m_ecBlocksArray.Add(ecBlocks);
}
+
CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
CBC_QRCoderECB* ecBlocks1,
- CBC_QRCoderECB* ecBlocks2) {
- m_ecCodeWordsPerBlock = ecCodeWordsPerBlock;
- m_ecBlocks.Add(ecBlocks1);
- m_ecBlocks.Add(ecBlocks2);
+ CBC_QRCoderECB* ecBlocks2)
+ : m_ecCodeWordsPerBlock(ecCodeWordsPerBlock) {
+ m_ecBlocksArray.Add(ecBlocks1);
+ m_ecBlocksArray.Add(ecBlocks2);
}
+
CBC_QRCoderECBlocks::~CBC_QRCoderECBlocks() {
- for (int32_t i = 0; i < m_ecBlocks.GetSize(); i++) {
- delete ((CBC_QRCoderECB*)(m_ecBlocks[i]));
- }
- m_ecBlocks.RemoveAll();
+ for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); i++)
+ delete m_ecBlocksArray[i];
}
-int32_t CBC_QRCoderECBlocks::GetECCodeWordsPerBlock() {
+
+int32_t CBC_QRCoderECBlocks::GetECCodeWordsPerBlock() const {
return m_ecCodeWordsPerBlock;
}
-int32_t CBC_QRCoderECBlocks::GetNumBlocks() {
+
+int32_t CBC_QRCoderECBlocks::GetNumBlocks() const {
int32_t total = 0;
- for (int32_t i = 0; i < m_ecBlocks.GetSize(); i++) {
- total += ((CBC_QRCoderECB*)(m_ecBlocks[i]))->GetCount();
- }
+ for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); i++)
+ total += m_ecBlocksArray[i]->GetCount();
+
return total;
}
-int32_t CBC_QRCoderECBlocks::GetTotalECCodeWords() {
+
+int32_t CBC_QRCoderECBlocks::GetTotalECCodeWords() const {
return m_ecCodeWordsPerBlock * GetNumBlocks();
}
-CFX_PtrArray* CBC_QRCoderECBlocks::GetECBlocks() {
- return &m_ecBlocks;
+
+CFX_ArrayTemplate<CBC_QRCoderECB*>* CBC_QRCoderECBlocks::GetECBlocks() {
+ return &m_ecBlocksArray;
}