#include "core/fpdfdoc/cpdf_filespec.h"
#include <array>
#include <iterator>
#include <utility>
#include "build/build_config.h"
#include "constants/stream_dict_common.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_object.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fxcrt/check.h"
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/notreached.h"
namespace {
#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN)
WideString ChangeSlashToPlatform(WideStringView str) {
WideString result;
for (auto wch : str) {
if (wch == '/') {
#if BUILDFLAG(IS_APPLE)
result += L':';
#else
result += L'\\';
#endif
} else {
result += wch;
}
}
return result;
}
WideString ChangeSlashToPDF(WideStringView str) {
WideString result;
for (auto wch : str) {
if (wch == '\\' || wch == ':') {
result += L'/';
} else {
result += wch;
}
}
return result;
}
#endif
}
CPDF_FileSpec::CPDF_FileSpec(RetainPtr<const CPDF_Object> pObj)
: … { … }
CPDF_FileSpec::~CPDF_FileSpec() = default;
WideString CPDF_FileSpec::DecodeFileName(const WideString& filepath) { … }
WideString CPDF_FileSpec::GetFileName() const { … }
RetainPtr<const CPDF_Stream> CPDF_FileSpec::GetFileStream() const { … }
RetainPtr<const CPDF_Dictionary> CPDF_FileSpec::GetParamsDict() const { … }
RetainPtr<CPDF_Dictionary> CPDF_FileSpec::GetMutableParamsDict() { … }
WideString CPDF_FileSpec::EncodeFileName(const WideString& filepath) { … }