summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/cbc_onecode.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-06-06 12:57:44 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-06 12:57:44 -0700
commit52d78564a61fad5d435f3c95a3a6c0df142e50cf (patch)
tree209840b7f578c0e35722984b789a2e9e84d5d428 /xfa/fxbarcode/cbc_onecode.cpp
parentfe433f15d60f92ccde7a928160c2e7cc77dcb8bf (diff)
downloadpdfium-52d78564a61fad5d435f3c95a3a6c0df142e50cf.tar.xz
Clean up C-Style casts in CBC_CodeBase and subclasses
Make the parent class own the reader/writer via unique_ptrs. De-virtualize some methods with no overrides. Review-Url: https://codereview.chromium.org/2037573005
Diffstat (limited to 'xfa/fxbarcode/cbc_onecode.cpp')
-rw-r--r--xfa/fxbarcode/cbc_onecode.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/xfa/fxbarcode/cbc_onecode.cpp b/xfa/fxbarcode/cbc_onecode.cpp
index f5e1a3960a..b435a59012 100644
--- a/xfa/fxbarcode/cbc_onecode.cpp
+++ b/xfa/fxbarcode/cbc_onecode.cpp
@@ -23,55 +23,57 @@
#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
-CBC_OneCode::CBC_OneCode() {}
+CBC_OneCode::CBC_OneCode(CBC_Reader* pReader, CBC_Writer* pWriter)
+ : CBC_CodeBase(pReader, pWriter) {}
CBC_OneCode::~CBC_OneCode() {}
FX_BOOL CBC_OneCode::CheckContentValidity(const CFX_WideStringC& contents) {
- if (m_pBCWriter)
- return ((CBC_OneDimWriter*)m_pBCWriter)->CheckContentValidity(contents);
- return FALSE;
+ return m_pBCWriter &&
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->CheckContentValidity(contents);
}
CFX_WideString CBC_OneCode::FilterContents(const CFX_WideStringC& contents) {
- CFX_WideString tmp;
if (!m_pBCWriter)
- return tmp;
- return ((CBC_OneDimWriter*)m_pBCWriter)->FilterContents(contents);
+ return CFX_WideString();
+ return static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->FilterContents(contents);
}
void CBC_OneCode::SetPrintChecksum(FX_BOOL checksum) {
if (m_pBCWriter)
- ((CBC_OneDimWriter*)m_pBCWriter)->SetPrintChecksum(checksum);
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
+ ->SetPrintChecksum(checksum);
}
void CBC_OneCode::SetDataLength(int32_t length) {
if (m_pBCWriter)
- ((CBC_OneDimWriter*)m_pBCWriter)->SetDataLength(length);
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetDataLength(length);
}
void CBC_OneCode::SetCalChecksum(FX_BOOL calc) {
if (m_pBCWriter)
- ((CBC_OneDimWriter*)m_pBCWriter)->SetCalcChecksum(calc);
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetCalcChecksum(calc);
}
FX_BOOL CBC_OneCode::SetFont(CFX_Font* cFont) {
if (m_pBCWriter)
- return ((CBC_OneDimWriter*)m_pBCWriter)->SetFont(cFont);
+ return static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFont(cFont);
return FALSE;
}
void CBC_OneCode::SetFontSize(FX_FLOAT size) {
if (m_pBCWriter)
- ((CBC_OneDimWriter*)m_pBCWriter)->SetFontSize(size);
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontSize(size);
}
void CBC_OneCode::SetFontStyle(int32_t style) {
if (m_pBCWriter)
- ((CBC_OneDimWriter*)m_pBCWriter)->SetFontStyle(style);
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontStyle(style);
}
void CBC_OneCode::SetFontColor(FX_ARGB color) {
if (m_pBCWriter)
- ((CBC_OneDimWriter*)m_pBCWriter)->SetFontColor(color);
+ static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())->SetFontColor(color);
}