From 4b9d69806c30775f55563e72b0842daa06483f99 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Fri, 26 Jan 2018 17:11:51 +0000 Subject: Clean up construction of CFX_Barcode Because certain enum values can cause the initialization of the class to fail there is a seperate init method from the constructor. This CL is converting the code to use a standard factory pattern for this, instead of the existing implementation. Change-Id: Ia2293ce94ad0db5862db9796aeb8a224fd2b45f9 Reviewed-on: https://pdfium-review.googlesource.com/24230 Reviewed-by: Henrique Nakashima Commit-Queue: Ryan Harrison --- xfa/fwl/cfx_barcode.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xfa/fwl/cfx_barcode.h') diff --git a/xfa/fwl/cfx_barcode.h b/xfa/fwl/cfx_barcode.h index eec4648e82..a5f0513241 100644 --- a/xfa/fwl/cfx_barcode.h +++ b/xfa/fwl/cfx_barcode.h @@ -22,10 +22,9 @@ class CFX_Matrix; class CFX_Barcode { public: - CFX_Barcode(); ~CFX_Barcode(); - bool Create(BC_TYPE type); + static std::unique_ptr Create(BC_TYPE type); BC_TYPE GetType(); bool Encode(const WideStringView& contents); @@ -56,6 +55,8 @@ class CFX_Barcode { bool SetTruncated(bool truncated); private: + CFX_Barcode(); + std::unique_ptr m_pBCEngine; }; -- cgit v1.2.3