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_SECTIONINFO_H_ | |
| 8 #define CORE_FPDFDOC_CPVT_SECTIONINFO_H_ | |
| 9 | |
| 10 #include "core/fpdfdoc/cpvt_floatrect.h" | |
| 11 #include "core/fpdfdoc/include/cpvt_secprops.h" | |
| 12 #include "core/fpdfdoc/include/cpvt_wordprops.h" | |
| 13 | |
| 14 struct CPVT_SectionInfo { | |
| 15 CPVT_SectionInfo() | |
| 16 : rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps(NULL) {} | |
|
Tom Sepez
2016/04/05 16:58:23
nit: nullptr.
dsinclair
2016/04/05 17:29:20
Done.
| |
| 17 | |
| 18 ~CPVT_SectionInfo() { | |
| 19 delete pSecProps; | |
|
Tom Sepez
2016/04/05 16:58:23
can these be unique_ptr?
dsinclair
2016/04/05 17:29:20
Will attempt as a followup.
| |
| 20 delete pWordProps; | |
| 21 } | |
| 22 | |
| 23 CPVT_SectionInfo(const CPVT_SectionInfo& other) | |
| 24 : rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps(NULL) { | |
| 25 operator=(other); | |
| 26 } | |
| 27 | |
| 28 void operator=(const CPVT_SectionInfo& other) { | |
| 29 if (this == &other) | |
| 30 return; | |
| 31 | |
| 32 rcSection = other.rcSection; | |
| 33 nTotalLine = other.nTotalLine; | |
| 34 if (other.pSecProps) { | |
| 35 if (pSecProps) | |
| 36 *pSecProps = *other.pSecProps; | |
| 37 else | |
| 38 pSecProps = new CPVT_SecProps(*other.pSecProps); | |
| 39 } | |
| 40 if (other.pWordProps) { | |
| 41 if (pWordProps) | |
| 42 *pWordProps = *other.pWordProps; | |
| 43 else | |
| 44 pWordProps = new CPVT_WordProps(*other.pWordProps); | |
| 45 } | |
| 46 } | |
| 47 | |
| 48 CPVT_FloatRect rcSection; | |
| 49 int32_t nTotalLine; | |
| 50 CPVT_SecProps* pSecProps; | |
| 51 CPVT_WordProps* pWordProps; | |
| 52 }; | |
| 53 | |
| 54 #endif // CORE_FPDFDOC_CPVT_SECTIONINFO_H_ | |
| OLD | NEW |