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
cpdf_bookmark.cpp
Go to the documentation of this file.
1// Copyright 2016 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 "core/fpdfdoc/cpdf_bookmark.h"
8
9#include <algorithm>
10#include <utility>
11
12#include "core/fpdfapi/parser/cpdf_array.h"
13#include "core/fpdfapi/parser/cpdf_dictionary.h"
14#include "core/fpdfapi/parser/cpdf_string.h"
15#include "core/fxge/dib/fx_dib.h"
16
17CPDF_Bookmark::CPDF_Bookmark() = default;
18
19CPDF_Bookmark::CPDF_Bookmark(const CPDF_Bookmark& that) = default;
20
23
24CPDF_Bookmark::~CPDF_Bookmark() = default;
25
27 if (!m_pDict) {
28 return WideString();
29 }
30 RetainPtr<const CPDF_String> pString =
31 ToString(m_pDict->GetDirectObjectFor("Title"));
32 if (!pString) {
33 return WideString();
34 }
35 WideString title = pString->GetUnicodeText();
36 WideString result;
37 result.Reserve(title.GetLength());
38 for (const wchar_t wc : title) {
39 result += std::max(wc, static_cast<wchar_t>(0x20));
40 }
41 return result;
42}
43
45 if (!m_pDict)
46 return CPDF_Dest(nullptr);
47 return CPDF_Dest::Create(pDocument, m_pDict->GetDirectObjectFor("Dest"));
48}
49
51 return CPDF_Action(m_pDict ? m_pDict->GetDictFor("A") : nullptr);
52}
53
54int CPDF_Bookmark::GetCount() const {
55 return m_pDict->GetIntegerFor("Count");
56}
int GetCount() const
WideString GetTitle() const
CPDF_Bookmark(RetainPtr< const CPDF_Dictionary > pDict)
CPDF_Action GetAction() const
CPDF_Bookmark(const CPDF_Bookmark &that)
CPDF_Dest GetDest(CPDF_Document *pDocument) const
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
WideString()=default
fxcrt::WideString WideString
Definition widestring.h:207