From a861a7b4696e0ffd4be73c63d7ed3611e461b1c1 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 23 May 2017 14:37:27 -0700 Subject: Remove useless CBC_SymbolShapeHint. Mark some methods as virtual/override in formerly CBC_SymbolShapeHint derived classes. Change-Id: Ia6d83e0b2c63c8fb440bc1d5beb258a796e1d42f Reviewed-on: https://pdfium-review.googlesource.com/5738 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- BUILD.gn | 1 - .../datamatrix/BC_DataMatrixSymbolInfo144.cpp | 2 +- fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h | 2 +- fxbarcode/datamatrix/BC_DataMatrixWriter.cpp | 3 +-- fxbarcode/datamatrix/BC_EncoderContext.h | 6 ++--- fxbarcode/datamatrix/BC_HighLevelEncoder.h | 4 ++-- fxbarcode/datamatrix/BC_SymbolInfo.h | 6 ++--- fxbarcode/datamatrix/BC_SymbolShapeHint.cpp | 26 ---------------------- fxbarcode/datamatrix/BC_SymbolShapeHint.h | 14 ++++-------- 9 files changed, 14 insertions(+), 50 deletions(-) delete mode 100644 fxbarcode/datamatrix/BC_SymbolShapeHint.cpp diff --git a/BUILD.gn b/BUILD.gn index 53f4644fc1..debeab988e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1303,7 +1303,6 @@ if (pdf_enable_xfa) { "fxbarcode/datamatrix/BC_HighLevelEncoder.h", "fxbarcode/datamatrix/BC_SymbolInfo.cpp", "fxbarcode/datamatrix/BC_SymbolInfo.h", - "fxbarcode/datamatrix/BC_SymbolShapeHint.cpp", "fxbarcode/datamatrix/BC_SymbolShapeHint.h", "fxbarcode/datamatrix/BC_TextEncoder.cpp", "fxbarcode/datamatrix/BC_TextEncoder.h", diff --git a/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp b/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp index c0994af6e0..122932179b 100644 --- a/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp +++ b/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp @@ -30,7 +30,7 @@ CBC_DataMatrixSymbolInfo144::CBC_DataMatrixSymbolInfo144() CBC_DataMatrixSymbolInfo144::~CBC_DataMatrixSymbolInfo144() {} -int32_t CBC_DataMatrixSymbolInfo144::getInterleavedBlockCount() { +int32_t CBC_DataMatrixSymbolInfo144::getInterleavedBlockCount() const { return 10; } diff --git a/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h b/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h index 18ef979141..0a1c529bb2 100644 --- a/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h +++ b/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h @@ -14,7 +14,7 @@ class CBC_DataMatrixSymbolInfo144 : public CBC_SymbolInfo { CBC_DataMatrixSymbolInfo144(); ~CBC_DataMatrixSymbolInfo144() override; - int32_t getInterleavedBlockCount(); + int32_t getInterleavedBlockCount() const override; }; #endif // FXBARCODE_DATAMATRIX_BC_DATAMATRIXSYMBOLINFO144_H_ diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp index 075449377f..0177053941 100644 --- a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp +++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp @@ -115,8 +115,7 @@ uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents, if (outWidth < 0 || outHeight < 0) return nullptr; - CBC_SymbolShapeHint::SymbolShapeHint shape = - CBC_SymbolShapeHint::FORCE_SQUARE; + SymbolShapeHint shape = FORCE_SQUARE; CFX_WideString ecLevel; int32_t e = BCExceptionNO; CFX_WideString encoded = diff --git a/fxbarcode/datamatrix/BC_EncoderContext.h b/fxbarcode/datamatrix/BC_EncoderContext.h index e2259334e8..6cb2b42fa9 100644 --- a/fxbarcode/datamatrix/BC_EncoderContext.h +++ b/fxbarcode/datamatrix/BC_EncoderContext.h @@ -12,12 +12,12 @@ class CBC_SymbolInfo; -class CBC_EncoderContext : public CBC_SymbolShapeHint { +class CBC_EncoderContext { public: CBC_EncoderContext(const CFX_WideString& msg, const CFX_WideString& ecLevel, int32_t& e); - ~CBC_EncoderContext() override; + ~CBC_EncoderContext(); void setSymbolShape(SymbolShapeHint shape); void setSkipAtEnd(int32_t count); @@ -34,7 +34,6 @@ class CBC_EncoderContext : public CBC_SymbolShapeHint { void updateSymbolInfo(int32_t len, int32_t& e); void resetSymbolInfo(); - public: CFX_WideString m_msg; CFX_WideString m_codewords; int32_t m_pos; @@ -44,7 +43,6 @@ class CBC_EncoderContext : public CBC_SymbolShapeHint { private: int32_t getTotalMessageCharCount(); - private: SymbolShapeHint m_shape; int32_t m_skipAtEnd; }; diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/fxbarcode/datamatrix/BC_HighLevelEncoder.h index 46789d6f52..cfcca18e2b 100644 --- a/fxbarcode/datamatrix/BC_HighLevelEncoder.h +++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.h @@ -19,10 +19,10 @@ #define EDIFACT_ENCODATION 4 #define BASE256_ENCODATION 5 -class CBC_HighLevelEncoder : public CBC_SymbolShapeHint { +class CBC_HighLevelEncoder { public: CBC_HighLevelEncoder(); - ~CBC_HighLevelEncoder() override; + ~CBC_HighLevelEncoder(); std::vector& getBytesForMessage(CFX_WideString msg); static CFX_WideString encodeHighLevel(CFX_WideString msg, diff --git a/fxbarcode/datamatrix/BC_SymbolInfo.h b/fxbarcode/datamatrix/BC_SymbolInfo.h index 18d7b68f09..7b536eccc7 100644 --- a/fxbarcode/datamatrix/BC_SymbolInfo.h +++ b/fxbarcode/datamatrix/BC_SymbolInfo.h @@ -11,14 +11,14 @@ #include "core/fxcrt/fx_system.h" #include "fxbarcode/datamatrix/BC_SymbolShapeHint.h" -class CBC_SymbolInfo : public CBC_SymbolShapeHint { +class CBC_SymbolInfo { public: CBC_SymbolInfo(int32_t dataCapacity, int32_t errorCodewords, int32_t matrixWidth, int32_t matrixHeight, int32_t dataRegions); - ~CBC_SymbolInfo() override; + virtual ~CBC_SymbolInfo(); static void Initialize(); static void Finalize(); @@ -41,7 +41,7 @@ class CBC_SymbolInfo : public CBC_SymbolShapeHint { int32_t getSymbolWidth() const; int32_t getSymbolHeight() const; int32_t getCodewordCount() const; - int32_t getInterleavedBlockCount() const; + virtual int32_t getInterleavedBlockCount() const; int32_t getDataLengthForInterleavedBlock(int32_t index) const; int32_t getErrorLengthForInterleavedBlock(int32_t index) const; diff --git a/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp b/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp deleted file mode 100644 index 294580bb5a..0000000000 --- a/fxbarcode/datamatrix/BC_SymbolShapeHint.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -// Original code is licensed as follows: -/* - * Copyright 2007 Jeremias Maerki. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "fxbarcode/datamatrix/BC_SymbolShapeHint.h" - -CBC_SymbolShapeHint::CBC_SymbolShapeHint() {} -CBC_SymbolShapeHint::~CBC_SymbolShapeHint() {} diff --git a/fxbarcode/datamatrix/BC_SymbolShapeHint.h b/fxbarcode/datamatrix/BC_SymbolShapeHint.h index 409ee05d75..3e93988d27 100644 --- a/fxbarcode/datamatrix/BC_SymbolShapeHint.h +++ b/fxbarcode/datamatrix/BC_SymbolShapeHint.h @@ -7,16 +7,10 @@ #ifndef FXBARCODE_DATAMATRIX_BC_SYMBOLSHAPEHINT_H_ #define FXBARCODE_DATAMATRIX_BC_SYMBOLSHAPEHINT_H_ -class CBC_SymbolShapeHint { - public: - CBC_SymbolShapeHint(); - virtual ~CBC_SymbolShapeHint(); - - enum SymbolShapeHint { - FORCE_NONE, - FORCE_SQUARE, - FORCE_RECTANGLE, - }; +enum SymbolShapeHint { + FORCE_NONE, + FORCE_SQUARE, + FORCE_RECTANGLE, }; #endif // FXBARCODE_DATAMATRIX_BC_SYMBOLSHAPEHINT_H_ -- cgit v1.2.3