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
14
16
18
19int32_t CFGAS_BreakPiece::GetEndPos() const {
20 return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
21}
22
24 return pdfium::base::checked_cast<size_t>(m_iCharCount);
25}
26
27CFGAS_Char* CFGAS_BreakPiece::GetChar(int32_t index) const {
28 return GetChar(pdfium::base::checked_cast<size_t>(index));
29}
30
31CFGAS_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
37WideString 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
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}
size_t GetLength() const
CFGAS_BreakPiece(const CFGAS_BreakPiece &other)
int32_t GetEndPos() const
std::vector< int32_t > GetWidths() const
WideString GetString() const
CFGAS_Char * GetChar(int32_t index) const