Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: xfa/fxfa/fm2js/xfa_simpleexpression.cpp

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/fm2js/xfa_simpleexpression.h ('k') | xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "xfa/fxfa/fm2js/xfa_simpleexpression.h" 7 #include "xfa/fxfa/fm2js/xfa_simpleexpression.h"
8 8
9 #include "core/fxcrt/fx_ext.h" 9 #include "core/fxcrt/fx_ext.h"
10 10
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 switch (m_op) { 335 switch (m_op) {
336 case TOKeq: 336 case TOKeq:
337 case TOKkseq: 337 case TOKkseq:
338 javascript << gs_lpStrExpFuncName[EQUALITY]; 338 javascript << gs_lpStrExpFuncName[EQUALITY];
339 break; 339 break;
340 case TOKne: 340 case TOKne:
341 case TOKksne: 341 case TOKksne:
342 javascript << gs_lpStrExpFuncName[NOTEQUALITY]; 342 javascript << gs_lpStrExpFuncName[NOTEQUALITY];
343 break; 343 break;
344 default: 344 default:
345 ASSERT(FALSE); 345 ASSERT(false);
346 break; 346 break;
347 } 347 }
348 javascript << FX_WSTRC(L"("); 348 javascript << FX_WSTRC(L"(");
349 m_pExp1->ToJavaScript(javascript); 349 m_pExp1->ToJavaScript(javascript);
350 javascript << FX_WSTRC(L", "); 350 javascript << FX_WSTRC(L", ");
351 m_pExp2->ToJavaScript(javascript); 351 m_pExp2->ToJavaScript(javascript);
352 javascript << FX_WSTRC(L")"); 352 javascript << FX_WSTRC(L")");
353 } 353 }
354 354
355 CXFA_FMRelationalExpression::CXFA_FMRelationalExpression( 355 CXFA_FMRelationalExpression::CXFA_FMRelationalExpression(
(...skipping 15 matching lines...) Expand all
371 break; 371 break;
372 case TOKle: 372 case TOKle:
373 case TOKksle: 373 case TOKksle:
374 javascript << gs_lpStrExpFuncName[LESSEQUAL]; 374 javascript << gs_lpStrExpFuncName[LESSEQUAL];
375 break; 375 break;
376 case TOKge: 376 case TOKge:
377 case TOKksge: 377 case TOKksge:
378 javascript << gs_lpStrExpFuncName[GREATEREQUAL]; 378 javascript << gs_lpStrExpFuncName[GREATEREQUAL];
379 break; 379 break;
380 default: 380 default:
381 ASSERT(FALSE); 381 ASSERT(false);
382 break; 382 break;
383 } 383 }
384 javascript << FX_WSTRC(L"("); 384 javascript << FX_WSTRC(L"(");
385 m_pExp1->ToJavaScript(javascript); 385 m_pExp1->ToJavaScript(javascript);
386 javascript << FX_WSTRC(L", "); 386 javascript << FX_WSTRC(L", ");
387 m_pExp2->ToJavaScript(javascript); 387 m_pExp2->ToJavaScript(javascript);
388 javascript << FX_WSTRC(L")"); 388 javascript << FX_WSTRC(L")");
389 } 389 }
390 390
391 CXFA_FMAdditiveExpression::CXFA_FMAdditiveExpression( 391 CXFA_FMAdditiveExpression::CXFA_FMAdditiveExpression(
392 uint32_t line, 392 uint32_t line,
393 XFA_FM_TOKEN op, 393 XFA_FM_TOKEN op,
394 CXFA_FMSimpleExpression* pExp1, 394 CXFA_FMSimpleExpression* pExp1,
395 CXFA_FMSimpleExpression* pExp2) 395 CXFA_FMSimpleExpression* pExp2)
396 : CXFA_FMBinExpression(line, op, pExp1, pExp2) {} 396 : CXFA_FMBinExpression(line, op, pExp1, pExp2) {}
397 397
398 void CXFA_FMAdditiveExpression::ToJavaScript(CFX_WideTextBuf& javascript) { 398 void CXFA_FMAdditiveExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
399 switch (m_op) { 399 switch (m_op) {
400 case TOKplus: 400 case TOKplus:
401 javascript << gs_lpStrExpFuncName[PLUS]; 401 javascript << gs_lpStrExpFuncName[PLUS];
402 break; 402 break;
403 case TOKminus: 403 case TOKminus:
404 javascript << gs_lpStrExpFuncName[MINUS]; 404 javascript << gs_lpStrExpFuncName[MINUS];
405 break; 405 break;
406 default: 406 default:
407 ASSERT(FALSE); 407 ASSERT(false);
408 break; 408 break;
409 } 409 }
410 javascript << FX_WSTRC(L"("); 410 javascript << FX_WSTRC(L"(");
411 m_pExp1->ToJavaScript(javascript); 411 m_pExp1->ToJavaScript(javascript);
412 javascript << FX_WSTRC(L", "); 412 javascript << FX_WSTRC(L", ");
413 m_pExp2->ToJavaScript(javascript); 413 m_pExp2->ToJavaScript(javascript);
414 javascript << FX_WSTRC(L")"); 414 javascript << FX_WSTRC(L")");
415 } 415 }
416 416
417 CXFA_FMMultiplicativeExpression::CXFA_FMMultiplicativeExpression( 417 CXFA_FMMultiplicativeExpression::CXFA_FMMultiplicativeExpression(
418 uint32_t line, 418 uint32_t line,
419 XFA_FM_TOKEN op, 419 XFA_FM_TOKEN op,
420 CXFA_FMSimpleExpression* pExp1, 420 CXFA_FMSimpleExpression* pExp1,
421 CXFA_FMSimpleExpression* pExp2) 421 CXFA_FMSimpleExpression* pExp2)
422 : CXFA_FMBinExpression(line, op, pExp1, pExp2) {} 422 : CXFA_FMBinExpression(line, op, pExp1, pExp2) {}
423 423
424 void CXFA_FMMultiplicativeExpression::ToJavaScript( 424 void CXFA_FMMultiplicativeExpression::ToJavaScript(
425 CFX_WideTextBuf& javascript) { 425 CFX_WideTextBuf& javascript) {
426 switch (m_op) { 426 switch (m_op) {
427 case TOKmul: 427 case TOKmul:
428 javascript << gs_lpStrExpFuncName[MULTIPLE]; 428 javascript << gs_lpStrExpFuncName[MULTIPLE];
429 break; 429 break;
430 case TOKdiv: 430 case TOKdiv:
431 javascript << gs_lpStrExpFuncName[DIVIDE]; 431 javascript << gs_lpStrExpFuncName[DIVIDE];
432 break; 432 break;
433 default: 433 default:
434 ASSERT(FALSE); 434 ASSERT(false);
435 break; 435 break;
436 } 436 }
437 javascript << FX_WSTRC(L"("); 437 javascript << FX_WSTRC(L"(");
438 m_pExp1->ToJavaScript(javascript); 438 m_pExp1->ToJavaScript(javascript);
439 javascript << FX_WSTRC(L", "); 439 javascript << FX_WSTRC(L", ");
440 m_pExp2->ToJavaScript(javascript); 440 m_pExp2->ToJavaScript(javascript);
441 javascript << FX_WSTRC(L")"); 441 javascript << FX_WSTRC(L")");
442 } 442 }
443 443
444 CXFA_FMPosExpression::CXFA_FMPosExpression(uint32_t line, 444 CXFA_FMPosExpression::CXFA_FMPosExpression(uint32_t line,
(...skipping 26 matching lines...) Expand all
471 javascript << gs_lpStrExpFuncName[NOT]; 471 javascript << gs_lpStrExpFuncName[NOT];
472 javascript << FX_WSTRC(L"("); 472 javascript << FX_WSTRC(L"(");
473 m_pExp->ToJavaScript(javascript); 473 m_pExp->ToJavaScript(javascript);
474 javascript << FX_WSTRC(L")"); 474 javascript << FX_WSTRC(L")");
475 } 475 }
476 476
477 CXFA_FMCallExpression::CXFA_FMCallExpression( 477 CXFA_FMCallExpression::CXFA_FMCallExpression(
478 uint32_t line, 478 uint32_t line,
479 CXFA_FMSimpleExpression* pExp, 479 CXFA_FMSimpleExpression* pExp,
480 CFX_ArrayTemplate<CXFA_FMSimpleExpression*>* pArguments, 480 CFX_ArrayTemplate<CXFA_FMSimpleExpression*>* pArguments,
481 FX_BOOL bIsSomMethod) 481 bool bIsSomMethod)
482 : CXFA_FMUnaryExpression(line, TOKcall, pExp), 482 : CXFA_FMUnaryExpression(line, TOKcall, pExp),
483 m_bIsSomMethod(bIsSomMethod), 483 m_bIsSomMethod(bIsSomMethod),
484 m_pArguments(pArguments) {} 484 m_pArguments(pArguments) {}
485 485
486 CXFA_FMCallExpression::~CXFA_FMCallExpression() { 486 CXFA_FMCallExpression::~CXFA_FMCallExpression() {
487 if (m_pArguments) { 487 if (m_pArguments) {
488 for (int i = 0; i < m_pArguments->GetSize(); ++i) 488 for (int i = 0; i < m_pArguments->GetSize(); ++i)
489 delete m_pArguments->GetAt(i); 489 delete m_pArguments->GetAt(i);
490 490
491 delete m_pArguments; 491 delete m_pArguments;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 javascript << FX_WSTRC(L"\", "); 659 javascript << FX_WSTRC(L"\", ");
660 } 660 }
661 m_pExp2->ToJavaScript(javascript); 661 m_pExp2->ToJavaScript(javascript);
662 javascript << FX_WSTRC(L")"); 662 javascript << FX_WSTRC(L")");
663 } 663 }
664 664
665 CXFA_FMIndexExpression::CXFA_FMIndexExpression( 665 CXFA_FMIndexExpression::CXFA_FMIndexExpression(
666 uint32_t line, 666 uint32_t line,
667 XFA_FM_AccessorIndex accessorIndex, 667 XFA_FM_AccessorIndex accessorIndex,
668 CXFA_FMSimpleExpression* pIndexExp, 668 CXFA_FMSimpleExpression* pIndexExp,
669 FX_BOOL bIsStarIndex) 669 bool bIsStarIndex)
670 : CXFA_FMUnaryExpression(line, TOKlbracket, pIndexExp), 670 : CXFA_FMUnaryExpression(line, TOKlbracket, pIndexExp),
671 m_accessorIndex(accessorIndex), 671 m_accessorIndex(accessorIndex),
672 m_bIsStarIndex(bIsStarIndex) {} 672 m_bIsStarIndex(bIsStarIndex) {}
673 673
674 void CXFA_FMIndexExpression::ToJavaScript(CFX_WideTextBuf& javascript) { 674 void CXFA_FMIndexExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
675 switch (m_accessorIndex) { 675 switch (m_accessorIndex) {
676 case ACCESSOR_NO_INDEX: 676 case ACCESSOR_NO_INDEX:
677 javascript << FX_WSTRC(L"0"); 677 javascript << FX_WSTRC(L"0");
678 break; 678 break;
679 case ACCESSOR_NO_RELATIVEINDEX: 679 case ACCESSOR_NO_RELATIVEINDEX:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 L"for(var index = accessor_object.length - 1; index > 1; index--)\n{\n"); 746 L"for(var index = accessor_object.length - 1; index > 1; index--)\n{\n");
747 javascript << FX_WSTRC(L"method_return_value = accessor_object[index]."); 747 javascript << FX_WSTRC(L"method_return_value = accessor_object[index].");
748 m_pExp2->ToJavaScript(javascript); 748 m_pExp2->ToJavaScript(javascript);
749 javascript << FX_WSTRC(L";\n}\n}\n"); 749 javascript << FX_WSTRC(L";\n}\n}\n");
750 javascript << FX_WSTRC(L"else\n{\nmethod_return_value = accessor_object."); 750 javascript << FX_WSTRC(L"else\n{\nmethod_return_value = accessor_object.");
751 m_pExp2->ToJavaScript(javascript); 751 m_pExp2->ToJavaScript(javascript);
752 javascript << FX_WSTRC(L";\n}\n"); 752 javascript << FX_WSTRC(L";\n}\n");
753 javascript << FX_WSTRC(L"return method_return_value;\n"); 753 javascript << FX_WSTRC(L"return method_return_value;\n");
754 javascript << FX_WSTRC(L"}\n).call(this)"); 754 javascript << FX_WSTRC(L"}\n).call(this)");
755 } 755 }
OLDNEW
« no previous file with comments | « xfa/fxfa/fm2js/xfa_simpleexpression.h ('k') | xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698