diff options
Diffstat (limited to 'xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp')
-rw-r--r-- | xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp | 42 |
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; } |