diff options
author | tsepez <tsepez@chromium.org> | 2016-04-28 14:56:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-28 14:56:27 -0700 |
commit | aef780db30c434e1d681d81852fb13160e72ed1e (patch) | |
tree | 24810c630b3b27649c0dd856d795c0069ca5bcd6 /xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.h | |
parent | 8e957baa851aed4b02511d04a66c0f95387d1e10 (diff) | |
download | pdfium-aef780db30c434e1d681d81852fb13160e72ed1e.tar.xz |
Replace CFX_PtrArray with typesafe CFX_ArrayTemplate, part 4
Review-Url: https://codereview.chromium.org/1932703003
Diffstat (limited to 'xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.h')
-rw-r--r-- | xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.h | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.h b/xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.h index 9e8e801d8e..74433cc4f2 100644 --- a/xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.h +++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixVersion.h @@ -13,14 +13,11 @@ class CBC_DataMatrixVersion; class ECB { public: - ECB(int32_t count, int32_t dataCodewords) { - m_count = count; - m_dataCodewords = dataCodewords; - } - - int32_t GetCount() { return m_count; } + ECB(int32_t count, int32_t dataCodewords) + : m_count(count), m_dataCodewords(dataCodewords) {} - int32_t GetDataCodewords() { return m_dataCodewords; } + int32_t GetCount() const { return m_count; } + int32_t GetDataCodewords() const { return m_dataCodewords; } private: int32_t m_count; @@ -29,30 +26,27 @@ class ECB { class ECBlocks { public: - ECBlocks(int32_t ecCodewords, ECB* ecBlocks) { - m_ecCodewords = ecCodewords; - m_ecBlocks.Add(ecBlocks); + ECBlocks(int32_t ecCodewords, ECB* ecBlocks) : m_ecCodewords(ecCodewords) { + m_ecBlocksArray.Add(ecBlocks); } - ECBlocks(int32_t ecCodewords, ECB* ecBlocks1, ECB* ecBlocks2) { - m_ecCodewords = ecCodewords; - m_ecBlocks.Add(ecBlocks1); - m_ecBlocks.Add(ecBlocks2); + ECBlocks(int32_t ecCodewords, ECB* ecBlocks1, ECB* ecBlocks2) + : m_ecCodewords(ecCodewords) { + m_ecBlocksArray.Add(ecBlocks1); + m_ecBlocksArray.Add(ecBlocks2); } + ~ECBlocks() { - for (int32_t i = 0; i < m_ecBlocks.GetSize(); i++) { - delete (ECB*)m_ecBlocks[i]; - } - m_ecBlocks.RemoveAll(); + for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); i++) + delete m_ecBlocksArray[i]; } int32_t GetECCodewords() { return m_ecCodewords; } - - const CFX_PtrArray& GetECBlocks() { return m_ecBlocks; } + const CFX_ArrayTemplate<ECB*>& GetECBlocks() { return m_ecBlocksArray; } private: int32_t m_ecCodewords; - CFX_PtrArray m_ecBlocks; + CFX_ArrayTemplate<ECB*> m_ecBlocksArray; }; class CBC_DataMatrixVersion { |