mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 11:31:23 +00:00
Support new SpiderMonkey API.
wposix: Define int8_t compatibly with SpiderMonkey. Remove unused camera, lightenv JS interfaces. Remove most of vector JS interface. Remove some of the redundant JS string conversion functions. Remove unneeded vmem, _lodBias functions. Clean up some formatting. This was SVN commit r8629.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2009 Wildfire Games.
|
||||
/* Copyright (C) 2010 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -29,10 +29,10 @@
|
||||
class CScriptVal
|
||||
{
|
||||
public:
|
||||
CScriptVal() : m_Val(0) { }
|
||||
CScriptVal() : m_Val(JSVAL_VOID) { }
|
||||
CScriptVal(jsval val) : m_Val(val) { }
|
||||
|
||||
jsval get() const { return m_Val; }
|
||||
const jsval& get() const { return m_Val; }
|
||||
|
||||
private:
|
||||
jsval m_Val;
|
||||
@@ -45,14 +45,48 @@ public:
|
||||
CScriptValRooted(JSContext* cx, jsval val);
|
||||
CScriptValRooted(JSContext* cx, CScriptVal val);
|
||||
|
||||
/**
|
||||
* Returns the current value (or JSVAL_VOID if uninitialised).
|
||||
*/
|
||||
jsval get() const;
|
||||
|
||||
/**
|
||||
* Returns reference to the current value.
|
||||
* Fails if the value is not yet initialised.
|
||||
*/
|
||||
jsval& getRef() const;
|
||||
|
||||
/**
|
||||
* Returns whether the value is uninitialised or is JSVAL_VOID.
|
||||
*/
|
||||
bool undefined() const;
|
||||
|
||||
/**
|
||||
* Returns whether the value is uninitialised.
|
||||
*/
|
||||
bool uninitialised() const;
|
||||
|
||||
private:
|
||||
boost::shared_ptr<jsval> m_Val;
|
||||
};
|
||||
|
||||
/**
|
||||
* RAII wrapper for JSIdArray*
|
||||
*/
|
||||
class AutoJSIdArray
|
||||
{
|
||||
NONCOPYABLE(AutoJSIdArray);
|
||||
public:
|
||||
AutoJSIdArray(JSContext* cx, JSIdArray* ida);
|
||||
~AutoJSIdArray();
|
||||
|
||||
JSIdArray* get() const;
|
||||
size_t length() const;
|
||||
jsid operator[](size_t i) const;
|
||||
|
||||
private:
|
||||
JSContext* m_Context;
|
||||
JSIdArray* m_IdArray;
|
||||
};
|
||||
|
||||
#endif // INCLUDED_SCRIPTVAL
|
||||
|
||||
Reference in New Issue
Block a user