Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef CORE_FPDFDOC_CPVT_WORDINFO_H_ | |
| 8 #define CORE_FPDFDOC_CPVT_WORDINFO_H_ | |
| 9 | |
| 10 #include "core/fpdfdoc/include/cpvt_wordprops.h" | |
| 11 #include "core/fxcrt/include/fx_system.h" | |
| 12 | |
| 13 struct CPVT_WordInfo { | |
| 14 CPVT_WordInfo() | |
| 15 : Word(0), | |
| 16 nCharset(0), | |
| 17 fWordX(0.0f), | |
| 18 fWordY(0.0f), | |
| 19 fWordTail(0.0f), | |
| 20 nFontIndex(-1), | |
| 21 pWordProps(nullptr) {} | |
| 22 | |
| 23 CPVT_WordInfo(uint16_t word, | |
| 24 int32_t charset, | |
| 25 int32_t fontIndex, | |
| 26 CPVT_WordProps* pProps) | |
| 27 : Word(word), | |
| 28 nCharset(charset), | |
| 29 fWordX(0.0f), | |
| 30 fWordY(0.0f), | |
| 31 fWordTail(0.0f), | |
| 32 nFontIndex(fontIndex), | |
| 33 pWordProps(pProps) {} | |
| 34 | |
| 35 CPVT_WordInfo(const CPVT_WordInfo& word) | |
| 36 : Word(0), | |
| 37 nCharset(0), | |
| 38 fWordX(0.0f), | |
| 39 fWordY(0.0f), | |
| 40 fWordTail(0.0f), | |
| 41 nFontIndex(-1), | |
| 42 pWordProps(nullptr) { | |
| 43 operator=(word); | |
| 44 } | |
| 45 | |
| 46 ~CPVT_WordInfo() { delete pWordProps; } | |
|
Tom Sepez
2016/04/05 16:58:23
Can this be unique_ptr?
dsinclair
2016/04/05 17:29:20
On followup list.
| |
| 47 | |
| 48 void operator=(const CPVT_WordInfo& word) { | |
| 49 if (this == &word) | |
| 50 return; | |
| 51 | |
| 52 Word = word.Word; | |
| 53 nCharset = word.nCharset; | |
| 54 nFontIndex = word.nFontIndex; | |
| 55 if (word.pWordProps) { | |
| 56 if (pWordProps) | |
| 57 *pWordProps = *word.pWordProps; | |
| 58 else | |
| 59 pWordProps = new CPVT_WordProps(*word.pWordProps); | |
| 60 } | |
| 61 } | |
| 62 | |
| 63 uint16_t Word; | |
| 64 int32_t nCharset; | |
| 65 FX_FLOAT fWordX; | |
| 66 FX_FLOAT fWordY; | |
| 67 FX_FLOAT fWordTail; | |
| 68 int32_t nFontIndex; | |
| 69 CPVT_WordProps* pWordProps; | |
| 70 }; | |
| 71 | |
| 72 #endif // CORE_FPDFDOC_CPVT_WORDINFO_H_ | |
| OLD | NEW |