CFX_WideString CPDF_Bookmark::GetTitle() { if (!m_pDict) { return CFX_WideString(); } CPDF_String* pString = (CPDF_String*)m_pDict->GetElementValue("Title"); if (pString == NULL || pString->GetType() != PDFOBJ_STRING) { return CFX_WideString(); } CFX_WideString title = pString->GetUnicodeText(); FX_LPWSTR buf = title.LockBuffer(); int len = title.GetLength(), i; for (i = 0; i < len; i ++) if (buf[i] < 0x20) { buf[i] = 0x20; } title.ReleaseBuffer(len); return title; }
CFX_WideString CPDF_Bookmark::GetTitle() const { if (!m_pDict) { return CFX_WideString(); } CPDF_String* pString = ToString(m_pDict->GetElementValue("Title")); if (!pString) return CFX_WideString(); CFX_WideString title = pString->GetUnicodeText(); int len = title.GetLength(); if (!len) { return CFX_WideString(); } nonstd::unique_ptr<FX_WCHAR[]> buf(new FX_WCHAR[len]); for (int i = 0; i < len; i++) { FX_WCHAR w = title[i]; buf[i] = w > 0x20 ? w : 0x20; } return CFX_WideString(buf.get(), len); }