Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h ('k') | xfa/fxbarcode/oned/BC_OnedCode128Writer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 // Original code is licensed as follows: 6 // Original code is licensed as follows:
7 /* 7 /*
8 * Copyright 2011 ZXing authors 8 * Copyright 2011 ZXing authors
9 * 9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * Licensed under the Apache License, Version 2.0 (the "License");
(...skipping 30 matching lines...) Expand all
41 '8', '9', '-', '$', '/', ':', '+', '.'}; 41 '8', '9', '-', '$', '/', ':', '+', '.'};
42 42
43 } // namespace 43 } // namespace
44 44
45 CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() { 45 CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() {
46 m_chStart = 'A'; 46 m_chStart = 'A';
47 m_chEnd = 'B'; 47 m_chEnd = 'B';
48 m_iWideNarrRatio = 2; 48 m_iWideNarrRatio = 2;
49 } 49 }
50 CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() {} 50 CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() {}
51 FX_BOOL CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) { 51 bool CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) {
52 for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { 52 for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) {
53 if (START_END_CHARS[i] == start) { 53 if (START_END_CHARS[i] == start) {
54 m_chStart = start; 54 m_chStart = start;
55 return TRUE; 55 return true;
56 } 56 }
57 } 57 }
58 return FALSE; 58 return false;
59 } 59 }
60 60
61 FX_BOOL CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end) { 61 bool CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end) {
62 for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { 62 for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) {
63 if (START_END_CHARS[i] == end) { 63 if (START_END_CHARS[i] == end) {
64 m_chEnd = end; 64 m_chEnd = end;
65 return TRUE; 65 return true;
66 } 66 }
67 } 67 }
68 return FALSE; 68 return false;
69 } 69 }
70 void CBC_OnedCodaBarWriter::SetDataLength(int32_t length) { 70 void CBC_OnedCodaBarWriter::SetDataLength(int32_t length) {
71 m_iDataLenth = length + 2; 71 m_iDataLenth = length + 2;
72 } 72 }
73 FX_BOOL CBC_OnedCodaBarWriter::SetTextLocation(BC_TEXT_LOC location) { 73 bool CBC_OnedCodaBarWriter::SetTextLocation(BC_TEXT_LOC location) {
74 if (location < BC_TEXT_LOC_NONE || location > BC_TEXT_LOC_BELOWEMBED) { 74 if (location < BC_TEXT_LOC_NONE || location > BC_TEXT_LOC_BELOWEMBED) {
75 return FALSE; 75 return false;
76 } 76 }
77 m_locTextLoc = location; 77 m_locTextLoc = location;
78 return TRUE; 78 return true;
79 } 79 }
80 FX_BOOL CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio) { 80 bool CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio) {
81 if (ratio < 2 || ratio > 3) { 81 if (ratio < 2 || ratio > 3) {
82 return FALSE; 82 return false;
83 } 83 }
84 m_iWideNarrRatio = ratio; 84 m_iWideNarrRatio = ratio;
85 return TRUE; 85 return true;
86 } 86 }
87 FX_BOOL CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, FX_BOOL isContent) { 87 bool CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, bool isContent) {
88 if (isContent) { 88 if (isContent) {
89 for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { 89 for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) {
90 if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { 90 if (ch == (FX_WCHAR)CONTENT_CHARS[i]) {
91 return TRUE; 91 return true;
92 } 92 }
93 } 93 }
94 for (size_t j = 0; j < FX_ArraySize(START_END_CHARS); ++j) { 94 for (size_t j = 0; j < FX_ArraySize(START_END_CHARS); ++j) {
95 if (ch == (FX_WCHAR)START_END_CHARS[j]) { 95 if (ch == (FX_WCHAR)START_END_CHARS[j]) {
96 return TRUE; 96 return true;
97 } 97 }
98 } 98 }
99 return FALSE; 99 return false;
100 } else { 100 } else {
101 for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { 101 for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) {
102 if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { 102 if (ch == (FX_WCHAR)CONTENT_CHARS[i]) {
103 return TRUE; 103 return true;
104 } 104 }
105 } 105 }
106 return FALSE; 106 return false;
107 } 107 }
108 } 108 }
109 FX_BOOL CBC_OnedCodaBarWriter::CheckContentValidity( 109 bool CBC_OnedCodaBarWriter::CheckContentValidity(
110 const CFX_WideStringC& contents) { 110 const CFX_WideStringC& contents) {
111 FX_WCHAR ch; 111 FX_WCHAR ch;
112 int32_t index = 0; 112 int32_t index = 0;
113 for (index = 0; index < contents.GetLength(); index++) { 113 for (index = 0; index < contents.GetLength(); index++) {
114 ch = contents.GetAt(index); 114 ch = contents.GetAt(index);
115 if (FindChar(ch, FALSE)) { 115 if (FindChar(ch, false)) {
116 continue; 116 continue;
117 } else { 117 } else {
118 return FALSE; 118 return false;
119 } 119 }
120 } 120 }
121 return TRUE; 121 return true;
122 } 122 }
123 CFX_WideString CBC_OnedCodaBarWriter::FilterContents( 123 CFX_WideString CBC_OnedCodaBarWriter::FilterContents(
124 const CFX_WideStringC& contents) { 124 const CFX_WideStringC& contents) {
125 CFX_WideString filtercontents; 125 CFX_WideString filtercontents;
126 FX_WCHAR ch; 126 FX_WCHAR ch;
127 for (int32_t index = 0; index < contents.GetLength(); index++) { 127 for (int32_t index = 0; index < contents.GetLength(); index++) {
128 ch = contents.GetAt(index); 128 ch = contents.GetAt(index);
129 if (ch > 175) { 129 if (ch > 175) {
130 index++; 130 index++;
131 continue; 131 continue;
132 } 132 }
133 if (FindChar(ch, TRUE)) { 133 if (FindChar(ch, true)) {
134 filtercontents += ch; 134 filtercontents += ch;
135 } else { 135 } else {
136 continue; 136 continue;
137 } 137 }
138 } 138 }
139 return filtercontents; 139 return filtercontents;
140 } 140 }
141 uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, 141 uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents,
142 BCFORMAT format, 142 BCFORMAT format,
143 int32_t& outWidth, 143 int32_t& outWidth,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 223 }
224 CFX_WideString CBC_OnedCodaBarWriter::encodedContents( 224 CFX_WideString CBC_OnedCodaBarWriter::encodedContents(
225 const CFX_WideStringC& contents) { 225 const CFX_WideStringC& contents) {
226 CFX_WideString strStart(m_chStart); 226 CFX_WideString strStart(m_chStart);
227 CFX_WideString strEnd(m_chEnd); 227 CFX_WideString strEnd(m_chEnd);
228 return strStart + contents + strEnd; 228 return strStart + contents + strEnd;
229 } 229 }
230 void CBC_OnedCodaBarWriter::RenderResult(const CFX_WideStringC& contents, 230 void CBC_OnedCodaBarWriter::RenderResult(const CFX_WideStringC& contents,
231 uint8_t* code, 231 uint8_t* code,
232 int32_t codeLength, 232 int32_t codeLength,
233 FX_BOOL isDevice, 233 bool isDevice,
234 int32_t& e) { 234 int32_t& e) {
235 CBC_OneDimWriter::RenderResult(encodedContents(contents).AsStringC(), code, 235 CBC_OneDimWriter::RenderResult(encodedContents(contents).AsStringC(), code,
236 codeLength, isDevice, e); 236 codeLength, isDevice, e);
237 } 237 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h ('k') | xfa/fxbarcode/oned/BC_OnedCode128Writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698