• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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 #include "xfa/fgas/layout/cfx_breakline.h"
8 
9 #include "third_party/base/stl_util.h"
10 
CFX_BreakLine()11 CFX_BreakLine::CFX_BreakLine() : m_iStart(0), m_iWidth(0), m_iArabicChars(0) {}
12 
~CFX_BreakLine()13 CFX_BreakLine::~CFX_BreakLine() {}
14 
CountChars() const15 int32_t CFX_BreakLine::CountChars() const {
16   return pdfium::CollectionSize<int32_t>(m_LineChars);
17 }
18 
GetChar(int32_t index)19 CFX_Char* CFX_BreakLine::GetChar(int32_t index) {
20   ASSERT(pdfium::IndexInBounds(m_LineChars, index));
21   return &m_LineChars[index];
22 }
23 
GetChar(int32_t index) const24 const CFX_Char* CFX_BreakLine::GetChar(int32_t index) const {
25   ASSERT(pdfium::IndexInBounds(m_LineChars, index));
26   return &m_LineChars[index];
27 }
28 
CountPieces() const29 int32_t CFX_BreakLine::CountPieces() const {
30   return pdfium::CollectionSize<int32_t>(m_LinePieces);
31 }
32 
GetPiece(int32_t index) const33 const CFX_BreakPiece* CFX_BreakLine::GetPiece(int32_t index) const {
34   ASSERT(index >= 0 && index < CountPieces());
35   return &m_LinePieces[index];
36 }
37 
GetLineEnd() const38 int32_t CFX_BreakLine::GetLineEnd() const {
39   return m_iStart + m_iWidth;
40 }
41 
Clear()42 void CFX_BreakLine::Clear() {
43   m_LineChars.clear();
44   m_LinePieces.clear();
45   m_iWidth = 0;
46   m_iArabicChars = 0;
47 }
48