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

Delta Between Two Patch Sets: src/Utils.cpp

Issue 10296001: Implement File API (Closed)
Left Patch Set: Address issues Created April 15, 2013, 1:42 p.m.
Right Patch Set: Addressed the new issues Created April 16, 2013, 1:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/Utils.h ('k') | test/DefaultFileSystem.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #include <sstream> 1 #include <sstream>
2 #include <string> 2 #include <string>
3 3
4 #include "Utils.h" 4 #include "Utils.h"
5 5
6 using namespace AdblockPlus; 6 using namespace AdblockPlus;
7 7
8 std::string Utils::Slurp(std::istream& stream) 8 std::string Utils::Slurp(std::ios& stream)
9 { 9 {
10 std::stringstream content; 10 std::stringstream content;
11 content << stream.rdbuf(); 11 content << stream.rdbuf();
12 return content.str(); 12 return content.str();
13 } 13 }
14 14
15 std::string Utils::FromV8String(v8::Handle<v8::Value> value) 15 std::string Utils::FromV8String(v8::Handle<v8::Value> value)
16 { 16 {
17 v8::String::Utf8Value stringValue(value); 17 v8::String::Utf8Value stringValue(value);
18 if (stringValue.length()) 18 if (stringValue.length())
19 return std::string(*stringValue, stringValue.length()); 19 return std::string(*stringValue, stringValue.length());
20 else 20 else
21 return std::string(); 21 return std::string();
22 } 22 }
23 23
24 v8::Local<v8::String> Utils::ToV8String(const std::string& str) 24 v8::Local<v8::String> Utils::ToV8String(const std::string& str)
25 { 25 {
26 return v8::String::New(str.c_str(), str.length()); 26 return v8::String::New(str.c_str(), str.length());
27 } 27 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld