OLD | NEW |
(Empty) | |
| 1 #include <sstream> |
| 2 #include <string> |
| 3 |
| 4 #include "Utils.h" |
| 5 |
| 6 using namespace AdblockPlus; |
| 7 |
| 8 std::string Utils::Slurp(std::ios& stream) |
| 9 { |
| 10 std::stringstream content; |
| 11 content << stream.rdbuf(); |
| 12 return content.str(); |
| 13 } |
| 14 |
| 15 std::string Utils::FromV8String(v8::Handle<v8::Value> value) |
| 16 { |
| 17 v8::String::Utf8Value stringValue(value); |
| 18 if (stringValue.length()) |
| 19 return std::string(*stringValue, stringValue.length()); |
| 20 else |
| 21 return std::string(); |
| 22 } |
| 23 |
| 24 v8::Local<v8::String> Utils::ToV8String(const std::string& str) |
| 25 { |
| 26 return v8::String::New(str.c_str(), str.length()); |
| 27 } |
OLD | NEW |