add Path::read()

This commit is contained in:
Josh Holtrop 2014-06-23 15:59:38 -04:00
parent 08979cef45
commit d54e772803
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include "jes/Ref.h"
#include <string>
#include <vector>
#include <stdint.h>
namespace jes
{
@ -20,6 +21,7 @@ namespace jes
const std::string & to_s() { return m_path; }
bool exists();
std::vector<std::string> dir_entries();
bool read(uint8_t ** buf, size_t * size);
protected:
void clean();
std::string m_path;

View File

@ -1,4 +1,5 @@
#include "jes/Path.h"
#include "jes/FileReader.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@ -104,6 +105,11 @@ namespace jes
return rv;
}
bool Path::read(uint8_t ** buf, size_t * size)
{
return FileReader::load(m_path.c_str(), buf, size);
}
void Path::clean()
{
for (char & c : m_path)