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 "xfa/fxfa/fm2js/xfa_simpleexpression.h" | 7 #include "xfa/fxfa/fm2js/xfa_simpleexpression.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 void CXFA_FMNumberExpression::ToJavaScript(CFX_WideTextBuf& javascript) { | 140 void CXFA_FMNumberExpression::ToJavaScript(CFX_WideTextBuf& javascript) { |
141 javascript << m_wsNumber; | 141 javascript << m_wsNumber; |
142 } | 142 } |
143 | 143 |
144 CXFA_FMStringExpression::CXFA_FMStringExpression(uint32_t line, | 144 CXFA_FMStringExpression::CXFA_FMStringExpression(uint32_t line, |
145 CFX_WideStringC wsString) | 145 CFX_WideStringC wsString) |
146 : CXFA_FMSimpleExpression(line, TOKstring), m_wsString(wsString) {} | 146 : CXFA_FMSimpleExpression(line, TOKstring), m_wsString(wsString) {} |
147 | 147 |
148 void CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { | 148 void CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { |
149 CFX_WideString tempStr = m_wsString; | 149 CFX_WideString tempStr(m_wsString); |
150 if (tempStr.GetLength() > 2) { | 150 if (tempStr.GetLength() > 2) { |
151 javascript.AppendChar(L'\"'); | 151 javascript.AppendChar(L'\"'); |
152 FX_WCHAR oneChar; | 152 FX_WCHAR oneChar; |
153 for (int16_t i = 1; i < tempStr.GetLength() - 1; i++) { | 153 for (int16_t i = 1; i < tempStr.GetLength() - 1; i++) { |
154 oneChar = tempStr[i]; | 154 oneChar = tempStr[i]; |
155 switch (oneChar) { | 155 switch (oneChar) { |
156 case L'\"': { | 156 case L'\"': { |
157 i++; | 157 i++; |
158 javascript << FX_WSTRC(L"\\\""); | 158 javascript << FX_WSTRC(L"\\\""); |
159 } break; | 159 } break; |
(...skipping 11 matching lines...) Expand all Loading... |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 CXFA_FMIdentifierExpressionn::CXFA_FMIdentifierExpressionn( | 174 CXFA_FMIdentifierExpressionn::CXFA_FMIdentifierExpressionn( |
175 uint32_t line, | 175 uint32_t line, |
176 CFX_WideStringC wsIdentifier) | 176 CFX_WideStringC wsIdentifier) |
177 : CXFA_FMSimpleExpression(line, TOKidentifier), | 177 : CXFA_FMSimpleExpression(line, TOKidentifier), |
178 m_wsIdentifier(wsIdentifier) {} | 178 m_wsIdentifier(wsIdentifier) {} |
179 | 179 |
180 void CXFA_FMIdentifierExpressionn::ToJavaScript(CFX_WideTextBuf& javascript) { | 180 void CXFA_FMIdentifierExpressionn::ToJavaScript(CFX_WideTextBuf& javascript) { |
181 CFX_WideString tempStr = m_wsIdentifier; | 181 CFX_WideString tempStr(m_wsIdentifier); |
182 if (tempStr == FX_WSTRC(L"$")) { | 182 if (tempStr == FX_WSTRC(L"$")) { |
183 tempStr = FX_WSTRC(L"this"); | 183 tempStr = FX_WSTRC(L"this"); |
184 } else if (tempStr == FX_WSTRC(L"!")) { | 184 } else if (tempStr == FX_WSTRC(L"!")) { |
185 tempStr = FX_WSTRC(L"xfa.datasets"); | 185 tempStr = FX_WSTRC(L"xfa.datasets"); |
186 } else if (tempStr == FX_WSTRC(L"$data")) { | 186 } else if (tempStr == FX_WSTRC(L"$data")) { |
187 tempStr = FX_WSTRC(L"xfa.datasets.data"); | 187 tempStr = FX_WSTRC(L"xfa.datasets.data"); |
188 } else if (tempStr == FX_WSTRC(L"$event")) { | 188 } else if (tempStr == FX_WSTRC(L"$event")) { |
189 tempStr = FX_WSTRC(L"xfa.event"); | 189 tempStr = FX_WSTRC(L"xfa.event"); |
190 } else if (tempStr == FX_WSTRC(L"$form")) { | 190 } else if (tempStr == FX_WSTRC(L"$form")) { |
191 tempStr = FX_WSTRC(L"xfa.form"); | 191 tempStr = FX_WSTRC(L"xfa.form"); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 L"for(var index = accessor_object.length - 1; index > 1; index--)\n{\n"); | 729 L"for(var index = accessor_object.length - 1; index > 1; index--)\n{\n"); |
730 javascript << FX_WSTRC(L"method_return_value = accessor_object[index]."); | 730 javascript << FX_WSTRC(L"method_return_value = accessor_object[index]."); |
731 m_pExp2->ToJavaScript(javascript); | 731 m_pExp2->ToJavaScript(javascript); |
732 javascript << FX_WSTRC(L";\n}\n}\n"); | 732 javascript << FX_WSTRC(L";\n}\n}\n"); |
733 javascript << FX_WSTRC(L"else\n{\nmethod_return_value = accessor_object."); | 733 javascript << FX_WSTRC(L"else\n{\nmethod_return_value = accessor_object."); |
734 m_pExp2->ToJavaScript(javascript); | 734 m_pExp2->ToJavaScript(javascript); |
735 javascript << FX_WSTRC(L";\n}\n"); | 735 javascript << FX_WSTRC(L";\n}\n"); |
736 javascript << FX_WSTRC(L"return method_return_value;\n"); | 736 javascript << FX_WSTRC(L"return method_return_value;\n"); |
737 javascript << FX_WSTRC(L"}\n).call(this)"); | 737 javascript << FX_WSTRC(L"}\n).call(this)"); |
738 } | 738 } |
OLD | NEW |