Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
js_resources.cpp
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "fxjs/js_resources.h"
8
9WideString JSGetStringFromID(JSMessage msg) {
10 const char* msg_string = "";
11 switch (msg) {
13 msg_string = "Alert";
14 break;
16 msg_string = "Incorrect number of parameters passed to function.";
17 break;
19 msg_string = "The input value is invalid.";
20 break;
22 msg_string = "The input value is too long.";
23 break;
25 msg_string =
26 "The input value can't be parsed as a valid date/time (%ls).";
27 break;
29 msg_string =
30 "The input value must be greater than or equal to %ls"
31 " and less than or equal to %ls.";
32 break;
34 msg_string = "The input value must be greater than or equal to %ls.";
35 break;
37 msg_string = "The input value must be less than or equal to %ls.";
38 break;
40 msg_string = "Operation not supported.";
41 break;
43 msg_string = "System is busy.";
44 break;
46 msg_string = "Duplicate formfield event found.";
47 break;
49 msg_string = "The second parameter can't be converted to a Date.";
50 break;
52 msg_string = "The second parameter is an invalid Date.";
53 break;
55 msg_string = "Global value not found.";
56 break;
58 msg_string = "Cannot assign to readonly property.";
59 break;
61 msg_string = "Incorrect parameter type.";
62 break;
64 msg_string = "Incorrect parameter value.";
65 break;
67 msg_string = "Permission denied.";
68 break;
70 msg_string = "Object no longer exists.";
71 break;
73 msg_string = "Object is of the wrong type.";
74 break;
76 msg_string = "Unknown property.";
77 break;
79 msg_string = "Set not possible, invalid or unknown.";
80 break;
82 msg_string = "User gesture required.";
83 break;
85 msg_string = "Too many occurrences.";
86 break;
88 msg_string = "Unknown method.";
89 break;
91 msg_string = "Operation would create a cycle.";
92 break;
93 }
94 return WideString::FromASCII(msg_string);
95}
96
97WideString JSFormatErrorString(const char* class_name,
98 const char* property_name,
99 const WideString& details) {
100 WideString result = WideString::FromUTF8(class_name);
101 if (property_name) {
102 result += L".";
103 result += WideString::FromUTF8(property_name);
104 }
105 result += L": ";
106 result += details;
107 return result;
108}
WideString & operator+=(const WideString &str)
static WideString FromUTF8(ByteStringView str)
WideString & operator+=(const wchar_t *str)
static WideString FromASCII(ByteStringView str)
JSMessage
@ kParamTooLongError
@ kObjectTypeError
@ kPermissionError
@ kRangeBetweenError
@ kRangeGreaterError
@ kDuplicateEventError
@ kGlobalNotFoundError
@ kNotSupportedError
@ kTooManyOccurrences
@ kSecondParamNotDateError
@ kInvalidInputError
@ kUserGestureRequiredError
@ kUnknownProperty
@ kSecondParamInvalidDateError
@ kInvalidSetError
WideString JSFormatErrorString(const char *class_name, const char *property_name, const WideString &details)
WideString JSGetStringFromID(JSMessage msg)