Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: include/AdblockPlus/JsValue.h

Issue 10184021: Some refactoring of global JavaScript objects (Closed)
Patch Set: Created April 15, 2013, 2:54 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | include/AdblockPlus/WebRequest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef ADBLOCKPLUS_JS_VALUE_H 1 #ifndef ADBLOCKPLUS_JS_VALUE_H
2 #define ADBLOCKPLUS_JS_VALUE_H 2 #define ADBLOCKPLUS_JS_VALUE_H
3 3
4 #include <vector> 4 #include <vector>
5 #include <v8.h> 5 #include <v8.h>
6 #ifdef _MSC_VER 6 #ifdef _MSC_VER
7 #include <memory> 7 #include <memory>
8 #else 8 #else
9 #include <tr1/memory> 9 #include <tr1/memory>
10 #endif 10 #endif
(...skipping 18 matching lines...) Expand all
29 bool IsString() const; 29 bool IsString() const;
30 bool IsNumber() const; 30 bool IsNumber() const;
31 bool IsBool() const; 31 bool IsBool() const;
32 bool IsObject() const; 32 bool IsObject() const;
33 bool IsArray() const; 33 bool IsArray() const;
34 bool IsFunction() const; 34 bool IsFunction() const;
35 std::string AsString() const; 35 std::string AsString() const;
36 int64_t AsInt() const; 36 int64_t AsInt() const;
37 bool AsBool() const; 37 bool AsBool() const;
38 JsValueList AsList() const; 38 JsValueList AsList() const;
39 std::vector<std::string> GetOwnPropertyNames() const;
39 JsValuePtr GetProperty(const std::string& name) const; 40 JsValuePtr GetProperty(const std::string& name) const;
40 void SetProperty(const std::string& name, const std::string& val); 41 void SetProperty(const std::string& name, const std::string& val);
41 void SetProperty(const std::string& name, int64_t val); 42 void SetProperty(const std::string& name, int64_t val);
42 void SetProperty(const std::string& name, bool val); 43 void SetProperty(const std::string& name, bool val);
44 void SetProperty(const std::string& name, JsValuePtr value);
43 inline void SetProperty(const std::string& name, const char* val) 45 inline void SetProperty(const std::string& name, const char* val)
44 { 46 {
45 SetProperty(name, std::string(val)); 47 SetProperty(name, std::string(val));
46 } 48 }
47 inline void SetProperty(const std::string& name, int val) 49 inline void SetProperty(const std::string& name, int val)
48 { 50 {
49 SetProperty(name, (int64_t)val); 51 SetProperty(name, (int64_t)val);
50 } 52 }
51 std::string GetClassName() const; 53 std::string GetClassName() const;
52 JsValuePtr Call(const JsValueList& params = JsValueList(), 54 JsValuePtr Call(const JsValueList& params = JsValueList(),
53 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const; 55 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const;
54 protected: 56 protected:
55 JsValue(JsEngine& jsEngine, v8::Handle<v8::Value> value); 57 JsValue(JsEngine& jsEngine, v8::Handle<v8::Value> value);
56 void SetProperty(const std::string& name, v8::Handle<v8::Value> val); 58 void SetProperty(const std::string& name, v8::Handle<v8::Value> val);
57 59
58 JsEngine& jsEngine; 60 JsEngine& jsEngine;
59 v8::Persistent<v8::Value> value; 61 v8::Persistent<v8::Value> value;
60 }; 62 };
61 } 63 }
62 64
63 #endif 65 #endif
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | include/AdblockPlus/WebRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld