summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/JS_Value.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-23 09:40:59 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-23 17:56:28 +0000
commitc970895f94cf76eb738d0a583ae139fecdd85268 (patch)
tree85a46f604e7294cf4402aff67d3338fe031611f4 /fpdfsdk/javascript/JS_Value.h
parent97dab80731a15a6bd74cdc3caf11f97c3a3be5ed (diff)
downloadpdfium-c970895f94cf76eb738d0a583ae139fecdd85268.tar.xz
Cleanup CJS_Valuechromium/3248
This CL removes unused methods; renames Attach to Set and generally cleans up the CJS_Value classes. Change-Id: I858082100908f3bc51f4b58c11ceda3357fadc70 Reviewed-on: https://pdfium-review.googlesource.com/16430 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/JS_Value.h')
-rw-r--r--fpdfsdk/javascript/JS_Value.h52
1 files changed, 18 insertions, 34 deletions
diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h
index 47e8cce98a..3631dbe6a1 100644
--- a/fpdfsdk/javascript/JS_Value.h
+++ b/fpdfsdk/javascript/JS_Value.h
@@ -30,12 +30,14 @@ class CJS_Value {
VT_undefined
};
+ static Type GetValueType(v8::Local<v8::Value> value);
+
explicit CJS_Value(CJS_Runtime* pRuntime);
CJS_Value(CJS_Runtime* pRuntime, v8::Local<v8::Value> pValue);
- CJS_Value(CJS_Runtime* pRuntime, const int& iValue);
- CJS_Value(CJS_Runtime* pRuntime, const double& dValue);
- CJS_Value(CJS_Runtime* pRuntime, const float& fValue);
- CJS_Value(CJS_Runtime* pRuntime, const bool& bValue);
+ CJS_Value(CJS_Runtime* pRuntime, int iValue);
+ CJS_Value(CJS_Runtime* pRuntime, double dValue);
+ CJS_Value(CJS_Runtime* pRuntime, float fValue);
+ CJS_Value(CJS_Runtime* pRuntime, bool bValue);
CJS_Value(CJS_Runtime* pRuntime, CJS_Object* pObj);
CJS_Value(CJS_Runtime* pRuntime, const char* pStr);
CJS_Value(CJS_Runtime* pRuntime, const wchar_t* pWstr);
@@ -47,20 +49,19 @@ class CJS_Value {
~CJS_Value();
void SetNull(CJS_Runtime* pRuntime);
- void SetValue(const CJS_Value& other);
- void Attach(v8::Local<v8::Value> pValue);
- void Detach();
+ void Set(v8::Local<v8::Value> pValue);
- static Type GetValueType(v8::Local<v8::Value> value);
Type GetType() const { return GetValueType(m_pValue); }
int ToInt(CJS_Runtime* pRuntime) const;
bool ToBool(CJS_Runtime* pRuntime) const;
double ToDouble(CJS_Runtime* pRuntime) const;
float ToFloat(CJS_Runtime* pRuntime) const;
- CJS_Object* ToCJSObject(CJS_Runtime* pRuntime) const;
- WideString ToCFXWideString(CJS_Runtime* pRuntime) const;
- ByteString ToCFXByteString(CJS_Runtime* pRuntime) const;
+ CJS_Object* ToObject(CJS_Runtime* pRuntime) const;
+ CJS_Array ToArray(CJS_Runtime* pRuntime) const;
+ CJS_Date ToDate(CJS_Runtime* pRuntime) const;
+ WideString ToWideString(CJS_Runtime* pRuntime) const;
+ ByteString ToByteString(CJS_Runtime* pRuntime) const;
v8::Local<v8::Object> ToV8Object(CJS_Runtime* pRuntime) const;
v8::Local<v8::Array> ToV8Array(CJS_Runtime* pRuntime) const;
v8::Local<v8::Value> ToV8Value(CJS_Runtime* pRuntime) const;
@@ -71,10 +72,8 @@ class CJS_Value {
bool IsArrayObject() const;
bool IsDateObject() const;
- bool ConvertToArray(CJS_Runtime* pRuntime, CJS_Array&) const;
- bool ConvertToDate(CJS_Runtime* pRuntime, CJS_Date&) const;
- protected:
+ private:
v8::Local<v8::Value> m_pValue;
};
@@ -133,16 +132,14 @@ class CJS_PropValue {
class CJS_Array {
public:
CJS_Array();
+ explicit CJS_Array(v8::Local<v8::Array> pArray);
CJS_Array(const CJS_Array& other);
virtual ~CJS_Array();
- void Attach(v8::Local<v8::Array> pArray);
int GetLength(CJS_Runtime* pRuntime) const;
// These two calls may re-enter JS (and hence invalidate objects).
- void GetElement(CJS_Runtime* pRuntime,
- unsigned index,
- CJS_Value& value) const;
+ CJS_Value GetElement(CJS_Runtime* pRuntime, unsigned index) const;
void SetElement(CJS_Runtime* pRuntime,
unsigned index,
const CJS_Value& value);
@@ -156,6 +153,7 @@ class CJS_Array {
class CJS_Date {
public:
CJS_Date();
+ explicit CJS_Date(v8::Local<v8::Date> pDate);
CJS_Date(CJS_Runtime* pRuntime, double dMsec_time);
CJS_Date(CJS_Runtime* pRuntime,
int year,
@@ -167,30 +165,17 @@ class CJS_Date {
CJS_Date(const CJS_Date&);
virtual ~CJS_Date();
- void Attach(v8::Local<v8::Date> pDate);
bool IsValidDate(CJS_Runtime* pRuntime) const;
int GetYear(CJS_Runtime* pRuntime) const;
- void SetYear(CJS_Runtime* pRuntime, int iYear);
-
int GetMonth(CJS_Runtime* pRuntime) const;
- void SetMonth(CJS_Runtime* pRuntime, int iMonth);
-
int GetDay(CJS_Runtime* pRuntime) const;
- void SetDay(CJS_Runtime* pRuntime, int iDay);
-
int GetHours(CJS_Runtime* pRuntime) const;
- void SetHours(CJS_Runtime* pRuntime, int iHours);
-
int GetMinutes(CJS_Runtime* pRuntime) const;
- void SetMinutes(CJS_Runtime* pRuntime, int minutes);
-
int GetSeconds(CJS_Runtime* pRuntime) const;
- void SetSeconds(CJS_Runtime* pRuntime, int seconds);
v8::Local<v8::Date> ToV8Date(CJS_Runtime* pRuntime) const;
- double ToDouble(CJS_Runtime* pRuntime) const;
- WideString ToString(CJS_Runtime* pRuntime) const;
+ WideString ToWideString(int style) const;
protected:
v8::Local<v8::Date> m_pDate;
@@ -207,7 +192,6 @@ double JS_DateParse(const WideString& str);
double JS_MakeDay(int nYear, int nMonth, int nDay);
double JS_MakeTime(int nHour, int nMin, int nSec, int nMs);
double JS_MakeDate(double day, double time);
-double JS_LocalTime(double d);
// Some JS methods have the bizarre convention that they may also be called
// with a single argument which is an object containing the actual arguments
@@ -215,7 +199,7 @@ double JS_LocalTime(double d);
// names as wchar_t string literals corresponding to each positional argument.
// The result will always contain |nKeywords| value, with unspecified ones
// being set to type VT_unknown.
-std::vector<CJS_Value> JS_ExpandKeywordParams(
+std::vector<CJS_Value> ExpandKeywordParams(
CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& originals,
size_t nKeywords,