| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 | 6 |
| 7 #ifndef CORE_FPDFDOC_CPVT_WORDPLACE_H_ | 7 #ifndef CORE_FPDFDOC_CPVT_WORDPLACE_H_ |
| 8 #define CORE_FPDFDOC_CPVT_WORDPLACE_H_ | 8 #define CORE_FPDFDOC_CPVT_WORDPLACE_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/fx_system.h" | 10 #include "core/fxcrt/fx_system.h" |
| 11 | 11 |
| 12 struct CPVT_WordPlace { | 12 struct CPVT_WordPlace { |
| 13 CPVT_WordPlace() : nSecIndex(-1), nLineIndex(-1), nWordIndex(-1) {} | 13 CPVT_WordPlace() : nSecIndex(-1), nLineIndex(-1), nWordIndex(-1) {} |
| 14 | 14 |
| 15 CPVT_WordPlace(int32_t other_nSecIndex, | 15 CPVT_WordPlace(int32_t other_nSecIndex, |
| 16 int32_t other_nLineIndex, | 16 int32_t other_nLineIndex, |
| 17 int32_t other_nWordIndex) { | 17 int32_t other_nWordIndex) { |
| 18 nSecIndex = other_nSecIndex; | 18 nSecIndex = other_nSecIndex; |
| 19 nLineIndex = other_nLineIndex; | 19 nLineIndex = other_nLineIndex; |
| 20 nWordIndex = other_nWordIndex; | 20 nWordIndex = other_nWordIndex; |
| 21 } | 21 } |
| 22 | 22 |
| 23 void Default() { nSecIndex = nLineIndex = nWordIndex = -1; } | 23 void Default() { nSecIndex = nLineIndex = nWordIndex = -1; } |
| 24 | 24 |
| 25 bool operator==(const CPVT_WordPlace& wp) const { | 25 bool operator==(const CPVT_WordPlace& wp) const { |
| 26 return wp.nSecIndex == nSecIndex && wp.nLineIndex == nLineIndex && | 26 return wp.nSecIndex == nSecIndex && wp.nLineIndex == nLineIndex && |
| 27 wp.nWordIndex == nWordIndex; | 27 wp.nWordIndex == nWordIndex; |
| 28 } | 28 } |
| 29 | 29 |
| 30 FX_BOOL operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); } | 30 bool operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); } |
| 31 | 31 |
| 32 inline int32_t WordCmp(const CPVT_WordPlace& wp) const { | 32 inline int32_t WordCmp(const CPVT_WordPlace& wp) const { |
| 33 if (nSecIndex > wp.nSecIndex) | 33 if (nSecIndex > wp.nSecIndex) |
| 34 return 1; | 34 return 1; |
| 35 if (nSecIndex < wp.nSecIndex) | 35 if (nSecIndex < wp.nSecIndex) |
| 36 return -1; | 36 return -1; |
| 37 if (nLineIndex > wp.nLineIndex) | 37 if (nLineIndex > wp.nLineIndex) |
| 38 return 1; | 38 return 1; |
| 39 if (nLineIndex < wp.nLineIndex) | 39 if (nLineIndex < wp.nLineIndex) |
| 40 return -1; | 40 return -1; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 64 return -1; | 64 return -1; |
| 65 return 0; | 65 return 0; |
| 66 } | 66 } |
| 67 | 67 |
| 68 int32_t nSecIndex; | 68 int32_t nSecIndex; |
| 69 int32_t nLineIndex; | 69 int32_t nLineIndex; |
| 70 int32_t nWordIndex; | 70 int32_t nWordIndex; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 #endif // CORE_FPDFDOC_CPVT_WORDPLACE_H_ | 73 #endif // CORE_FPDFDOC_CPVT_WORDPLACE_H_ |
| OLD | NEW |