summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/dev/file_ref_dev.h
blob: 99abd0387c7f94c4769cd234c2469e7c452329c3 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2010 The Chromium 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 PPAPI_CPP_DEV_FILE_REF_DEV_H_
#define PPAPI_CPP_DEV_FILE_REF_DEV_H_

#include "ppapi/c/dev/ppb_file_ref_dev.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/cpp/resource.h"
#include "ppapi/cpp/var.h"

namespace pp {

class CompletionCallback;
class FileSystem_Dev;

class FileRef_Dev : public Resource {
 public:
  // Creates an is_null() FileRef object.
  FileRef_Dev() {}

  // This constructor is used when we've gotten a PP_Resource as a return value
  // that we need to addref.
  explicit FileRef_Dev(PP_Resource resource);

  // This constructor is used when we've gotten a PP_Resource as a return value
  // that has already been addref'ed for us.
  struct PassRef {};
  FileRef_Dev(PassRef, PP_Resource resource);

  // Creates a FileRef pointing to a path in the given filesystem.
  FileRef_Dev(const FileSystem_Dev& file_system, const char* path);

  FileRef_Dev(const FileRef_Dev& other);

  FileRef_Dev& operator=(const FileRef_Dev& other);

  // Returns the file system type.
  PP_FileSystemType_Dev GetFileSystemType() const;

  // Returns the name of the file.
  Var GetName() const;

  // Returns the absolute path of the file.  See PPB_FileRef::GetPath for more
  // details.
  Var GetPath() const;

  // Returns the parent directory of this file.  See PPB_FileRef::GetParent for
  // more details.
  FileRef_Dev GetParent() const;

  int32_t MakeDirectory(const CompletionCallback& cc);

  int32_t MakeDirectoryIncludingAncestors(const CompletionCallback& cc);

  int32_t Query(PP_FileInfo_Dev* result_buf, const CompletionCallback& cc);

  int32_t Touch(PP_Time last_access_time,
                PP_Time last_modified_time,
                const CompletionCallback& cc);

  int32_t Delete(const CompletionCallback& cc);

  int32_t Rename(const FileRef_Dev& new_file_ref, const CompletionCallback& cc);
};

}  // namespace pp

#endif  // PPAPI_CPP_FILE_REF_H_