Include basic embed code generation in the HTTP connector. Closes #23, #24 and #25.

This commit is contained in:
Thulinma 2012-04-28 14:58:49 +02:00
parent 8b15fd52c4
commit 505ed38a50
2 changed files with 12 additions and 0 deletions

View file

@ -2,6 +2,7 @@
#include "json.h"
#include <sstream>
#include <fstream>
int JSON::Value::c2hex(int c){
if (c >= '0' && c <= '9') return c - '0';
@ -423,3 +424,13 @@ JSON::Value JSON::fromString(std::string json){
std::istringstream is(json);
return JSON::Value(is);
}
/// Converts a file to a JSON::Value.
JSON::Value JSON::fromFile(std::string filename){
std::string Result;
std::ifstream File;
File.open(filename.c_str());
while (File.good()){Result += File.get();}
File.close( );
return fromString(Result);
}

View file

@ -69,5 +69,6 @@ namespace JSON{
};
Value fromString(std::string json);
Value fromFile(std::string filename);
};