Initial commit.

This commit is contained in:
Mike Bostock 2012-12-14 09:47:48 -08:00
commit 44b5f2392f
98 changed files with 11750 additions and 0 deletions

27
resource.cpp Normal file
View file

@ -0,0 +1,27 @@
// -*- C++ -*-
#include <fstream>
#include <ios>
#include <iostream>
#include "resource.h"
using namespace mbostock;
const char* Resources::path() {
return "Contents/Resources/";
}
const char* Resources::readFile(const char* p) {
std::string fullPath(path());
fullPath.append(p);
std::ifstream file(fullPath.c_str());
file.seekg(0, std::ios::end);
std::ifstream::pos_type size = file.tellg();
file.seekg(0, std::ios::beg);
char* buffer = new char[1 + size];
file.read(buffer, size);
buffer[size] = '\0';
file.close();
return buffer;
}