From 2f5582f46dce2abfe9d75ea5f885a2ce0a4c10d2 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 9 Jun 2016 11:48:23 -0700 Subject: Convert CFXJSE_Value::ToString to return. ThiS Cl updates CFXJSE_Value::ToString() to return a CFX_ByteString instead of taking an out parameter. It also adds a ToStringC() and ToWideString() to hide the common conversions that are done on the string value. Review-Url: https://codereview.chromium.org/2044293004 --- xfa/fxjse/value.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'xfa/fxjse') diff --git a/xfa/fxjse/value.h b/xfa/fxjse/value.h index da4976b53c..d74fc325dd 100644 --- a/xfa/fxjse/value.h +++ b/xfa/fxjse/value.h @@ -172,14 +172,17 @@ class CFXJSE_Value { v8::Local::New(m_pIsolate, m_hValue); return static_cast(hValue->NumberValue()); } - V8_INLINE void ToString(CFX_ByteString& szStrOutput) const { + V8_INLINE CFX_ByteString ToString() const { ASSERT(!m_hValue.IsEmpty()); CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); v8::Local hValue = v8::Local::New(m_pIsolate, m_hValue); v8::Local hString = hValue->ToString(); v8::String::Utf8Value hStringVal(hString); - szStrOutput = *hStringVal; + return CFX_ByteString(*hStringVal); + } + V8_INLINE CFX_WideString ToWideString() const { + return CFX_WideString::FromUTF8(ToString().AsStringC()); } CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const; -- cgit v1.2.3