OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
9 #include "../../include/javascript/JS_Define.h" | 9 #include "../../include/javascript/JS_Define.h" |
10 #include "../../include/javascript/JS_Object.h" | 10 #include "../../include/javascript/JS_Object.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 CFX_WideString strSegment; | 176 CFX_WideString strSegment; |
177 if (iIndex >= iSize) { | 177 if (iIndex >= iSize) { |
178 c_strResult += c_strFormat; | 178 c_strResult += c_strFormat; |
179 continue; | 179 continue; |
180 } | 180 } |
181 | 181 |
182 switch (ParstDataType(&c_strFormat)) | 182 switch (ParstDataType(&c_strFormat)) |
183 { | 183 { |
184 case UTIL_INT: | 184 case UTIL_INT: |
185 » » » » strSegment.Format((FX_LPCWSTR)c_strFormat.c_str(
),(int)params[iIndex]); | 185 » » » » strSegment.Format(c_strFormat.c_str(),(int)param
s[iIndex]); |
186 break; | 186 break; |
187 case UTIL_DOUBLE: | 187 case UTIL_DOUBLE: |
188 » » » » strSegment.Format((FX_LPCWSTR)c_strFormat.c_str(
),(double)params[iIndex]); | 188 » » » » strSegment.Format(c_strFormat.c_str(),(double)pa
rams[iIndex]); |
189 break; | 189 break; |
190 case UTIL_STRING: | 190 case UTIL_STRING: |
191 » » » » strSegment.Format((FX_LPCWSTR)c_strFormat.c_str(
),(FX_LPCWSTR)params[iIndex].operator CFX_WideString()); | 191 » » » » strSegment.Format(c_strFormat.c_str(),(FX_LPCWST
R)params[iIndex].operator CFX_WideString()); |
192 break; | 192 break; |
193 default: | 193 default: |
194 » » » » strSegment.Format(L"%S", (FX_LPCWSTR)c_strFormat
.c_str()); | 194 » » » » strSegment.Format(L"%S", c_strFormat.c_str()); |
195 break; | 195 break; |
196 } | 196 } |
197 » » c_strResult += (wchar_t*)strSegment.GetBuffer(strSegment.GetLeng
th()+1); | 197 » » c_strResult += strSegment.GetBuffer(strSegment.GetLength()+1); |
198 } | 198 } |
199 | 199 |
200 c_strResult.erase(c_strResult.begin()); | 200 c_strResult.erase(c_strResult.begin()); |
201 » vRet = (FX_LPCWSTR)c_strResult.c_str(); | 201 » vRet = c_strResult.c_str(); |
202 return TRUE; | 202 return TRUE; |
203 } | 203 } |
204 | 204 |
205 FX_BOOL util::printd(OBJ_METHOD_PARAMS) | 205 FX_BOOL util::printd(OBJ_METHOD_PARAMS) |
206 { | 206 { |
207 v8::Isolate* isolate = GetIsolate(cc); | 207 v8::Isolate* isolate = GetIsolate(cc); |
208 | 208 |
209 int iSize = params.size(); | 209 int iSize = params.size(); |
210 if (iSize < 2) | 210 if (iSize < 2) |
211 return FALSE; | 211 return FALSE; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 break; | 264 break; |
265 default: | 265 default: |
266 return FALSE; | 266 return FALSE; |
267 } | 267 } |
268 | 268 |
269 vRet = swResult; | 269 vRet = swResult; |
270 return TRUE; | 270 return TRUE; |
271 } | 271 } |
272 else if (p1.GetType() == VT_string) | 272 else if (p1.GetType() == VT_string) |
273 { | 273 { |
274 » » std::basic_string<wchar_t> cFormat = (wchar_t*)(FX_LPCWSTR)p1.op
erator CFX_WideString();» » | 274 » » std::basic_string<wchar_t> cFormat = (FX_LPCWSTR)p1.operator CFX
_WideString();» » |
275 | 275 |
276 bool bXFAPicture = false; | 276 bool bXFAPicture = false; |
277 if (iSize > 2) | 277 if (iSize > 2) |
278 { | 278 { |
279 //CJS_Value value; | 279 //CJS_Value value; |
280 bXFAPicture = params[2]; | 280 bXFAPicture = params[2]; |
281 } | 281 } |
282 | 282 |
283 if (bXFAPicture) | 283 if (bXFAPicture) |
284 { | 284 { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 iStart = iEnd; | 358 iStart = iEnd; |
359 } | 359 } |
360 } | 360 } |
361 | 361 |
362 CFX_WideString strFormat; | 362 CFX_WideString strFormat; |
363 // strFormat.Format(L"%d,%d,%d,%d,%d,%d",iYear, iMonth, iDay, iHour
, iMin, iSec); | 363 // strFormat.Format(L"%d,%d,%d,%d,%d,%d",iYear, iMonth, iDay, iHour
, iMin, iSec); |
364 // CString strFormat = cppTm.Format(cFormat.c_str()); | 364 // CString strFormat = cppTm.Format(cFormat.c_str()); |
365 wchar_t buf[64] = {0}; | 365 wchar_t buf[64] = {0}; |
366 strFormat = wcsftime(buf, 64, cFormat.c_str(), &time); | 366 strFormat = wcsftime(buf, 64, cFormat.c_str(), &time); |
367 cFormat = buf; | 367 cFormat = buf; |
368 » » vRet = (FX_LPCWSTR)cFormat.c_str(); | 368 » » vRet = cFormat.c_str(); |
369 //rtRet = strFormat.GetBuffer(strFormat.GetLength()+1); | 369 //rtRet = strFormat.GetBuffer(strFormat.GetLength()+1); |
370 return TRUE; | 370 return TRUE; |
371 } | 371 } |
372 return FALSE; | 372 return FALSE; |
373 } | 373 } |
374 | 374 |
375 void util::printd(const std::wstring &cFormat2, CJS_Date jsDate, bool bXFAPictur
e, std::wstring &cPurpose) | 375 void util::printd(const std::wstring &cFormat2, CJS_Date jsDate, bool bXFAPictur
e, std::wstring &cPurpose) |
376 { | 376 { |
377 std::wstring cFormat = cFormat2; | 377 std::wstring cFormat = cFormat2; |
378 | 378 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 int iSize = params.size(); | 640 int iSize = params.size(); |
641 if (iSize == 0) | 641 if (iSize == 0) |
642 return FALSE; | 642 return FALSE; |
643 int nByte = (int)params[0]; | 643 int nByte = (int)params[0]; |
644 unsigned char cByte = (unsigned char)nByte; | 644 unsigned char cByte = (unsigned char)nByte; |
645 CFX_WideString csValue; | 645 CFX_WideString csValue; |
646 csValue.Format(L"%c", cByte); | 646 csValue.Format(L"%c", cByte); |
647 vRet = csValue; | 647 vRet = csValue; |
648 return TRUE; | 648 return TRUE; |
649 } | 649 } |
OLD | NEW |