Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfgas_breakpiece.cpp
Go to the documentation of this file.
1
// Copyright 2017 The PDFium Authors
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/cfgas_breakpiece.h"
8
9
#
include
"third_party/base/check_op.h"
10
#
include
"third_party/base/numerics/safe_conversions.h"
11
#
include
"xfa/fgas/layout/cfgas_textuserdata.h"
12
13
CFGAS_BreakPiece
::
CFGAS_BreakPiece
() =
default
;
14
15
CFGAS_BreakPiece
::
CFGAS_BreakPiece
(
const
CFGAS_BreakPiece
& other) =
default
;
16
17
CFGAS_BreakPiece
::~
CFGAS_BreakPiece
() =
default
;
18
19
int32_t
CFGAS_BreakPiece
::
GetEndPos
()
const
{
20
return
m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
21
}
22
23
size_t
CFGAS_BreakPiece
::
GetLength
()
const
{
24
return
pdfium::base::checked_cast<size_t>(m_iCharCount);
25
}
26
27
CFGAS_Char
*
CFGAS_BreakPiece
::
GetChar
(int32_t index)
const
{
28
return
GetChar(pdfium::base::checked_cast<size_t>(index));
29
}
30
31
CFGAS_Char
*
CFGAS_BreakPiece
::
GetChar
(size_t index)
const
{
32
DCHECK_LT(index, GetLength());
33
DCHECK(m_pChars);
34
return
&(*m_pChars)[m_iStartChar + index];
35
}
36
37
WideString
CFGAS_BreakPiece
::
GetString
()
const
{
38
WideString ret;
39
ret.Reserve(m_iCharCount);
40
for
(int32_t i = m_iStartChar; i < m_iStartChar + m_iCharCount; i++)
41
ret +=
static_cast
<
wchar_t
>((*m_pChars)[i].char_code());
42
return
ret;
43
}
44
45
std
::
vector
<
int32_t
>
CFGAS_BreakPiece
::
GetWidths
()
const
{
46
std::vector<int32_t> ret;
47
ret.reserve(m_iCharCount);
48
for
(int32_t i = m_iStartChar; i < m_iStartChar + m_iCharCount; i++)
49
ret.push_back((*m_pChars)[i].m_iCharWidth);
50
return
ret;
51
}
CFGAS_BreakPiece
Definition
cfgas_breakpiece.h:19
CFGAS_BreakPiece::GetLength
size_t GetLength() const
Definition
cfgas_breakpiece.cpp:23
CFGAS_BreakPiece::CFGAS_BreakPiece
CFGAS_BreakPiece()
CFGAS_BreakPiece::CFGAS_BreakPiece
CFGAS_BreakPiece(const CFGAS_BreakPiece &other)
CFGAS_BreakPiece::GetEndPos
int32_t GetEndPos() const
Definition
cfgas_breakpiece.cpp:19
CFGAS_BreakPiece::GetWidths
std::vector< int32_t > GetWidths() const
Definition
cfgas_breakpiece.cpp:45
CFGAS_BreakPiece::GetString
WideString GetString() const
Definition
cfgas_breakpiece.cpp:37
CFGAS_BreakPiece::~CFGAS_BreakPiece
~CFGAS_BreakPiece()
CFGAS_BreakPiece::GetChar
CFGAS_Char * GetChar(int32_t index) const
Definition
cfgas_breakpiece.cpp:27
CFGAS_Char
Definition
cfgas_char.h:19
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fgas
layout
cfgas_breakpiece.cpp
Generated on Sat Sep 21 2024 01:00:31 for Qt by
1.12.0