-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfile_handler.h
29 lines (24 loc) · 1.14 KB
/
file_handler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2011 The Native Client SDK Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.
#ifndef FILE_HANDLER_H_
#define FILE_HANDLER_H_
#include <ppapi/cpp/file_io.h>
#include <ppapi/cpp/instance.h>
#include <tr1/functional>
#include <vector>
// FileHandler functions are used to read from a file to a vector or write from
// a vector to a file. It then calls you back when it's done.
namespace FileHandler {
// Read all the data in the file and put the results in data. Assumes the
// pointers remain valid until the file is done.
void ReadFromFile(pp::FileIO* file, std::vector<char>* data,
std::tr1::function<void (int32_t)> progress_callback,
std::tr1::function<void ()> finished_callback);
// Write all the data in data to the file. Assumes the pointers remain valid
// until the file is done.
void WriteToFile(pp::FileIO* file, std::vector<char>* data,
std::tr1::function<void (int32_t)> progress_callback,
std::tr1::function<void ()> finished_callback);
}
#endif // FILE_HANDLER_H_