-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicReaderWriter.h
More file actions
45 lines (35 loc) · 1.23 KB
/
Copy pathBasicReaderWriter.h
File metadata and controls
45 lines (35 loc) · 1.23 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#pragma once
// A simple reader/writer class that provides support for reading and writing
// files on disk. Provides synchronous and asynchronous methods.
#include <winrt/Windows.Storage.h>
#include <rpcndr.h>
class BasicReaderWriter
{
public:
BasicReaderWriter();
BasicReaderWriter(
_In_ winrt::Windows::Storage::StorageFolder folder
);
std::vector<byte> ReadData(
_In_ winrt::hstring const& filename
);
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Storage::Streams::IBuffer> ReadDataAsync(
_In_ winrt::hstring const& filename
);
uint32_t WriteData(
_In_ winrt::hstring const& filename,
_In_ std::vector<byte> const& fileData
);
winrt::Windows::Foundation::IAsyncAction WriteDataAsync(
_In_ winrt::hstring const& filename,
_In_ std::vector<byte> const& fileData
);
private:
winrt::Windows::Storage::StorageFolder m_location{ nullptr };
};