From 10a285391c74845898830f8167bcfc467665b0f8 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 10 Oct 2016 18:45:55 -0700 Subject: Move ToString() and friends from CPDF_Object.h to CPDF_String.h Ditto with the other ToXXX functions to CPDF_xxx.h. Shortly, we will want to introduce another variant: inline std::unique_ptr ToString( std::unique_ptr); This will require that CPDF_String be complete which is not the case in the CPDF_Object.h header. Rather than dragging all the other .h's into it, move these to the subclass headers. That way, these will be together when the new form is added. Review-Url: https://codereview.chromium.org/2406033002 --- core/fpdfapi/parser/cpdf_string.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/fpdfapi/parser/cpdf_string.h') diff --git a/core/fpdfapi/parser/cpdf_string.h b/core/fpdfapi/parser/cpdf_string.h index d99e00c403..01ea8224d4 100644 --- a/core/fpdfapi/parser/cpdf_string.h +++ b/core/fpdfapi/parser/cpdf_string.h @@ -36,4 +36,12 @@ class CPDF_String : public CPDF_Object { FX_BOOL m_bHex; }; +inline CPDF_String* ToString(CPDF_Object* obj) { + return obj ? obj->AsString() : nullptr; +} + +inline const CPDF_String* ToString(const CPDF_Object* obj) { + return obj ? obj->AsString() : nullptr; +} + #endif // CORE_FPDFAPI_PARSER_CPDF_STRING_H_ -- cgit v1.2.3