btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / storage / CopyEngine.h
blobaed78bf233ea5d08b16d796392930324a8be4dda
1 /*
2 * Copyright 2013, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Ingo Weinhold <ingo_weinhold@gmx.de>
7 */
8 #ifndef _COPY_ENGINE_H
9 #define _COPY_ENGINE_H
12 #include <stdarg.h>
14 #include <EntryOperationEngineBase.h>
17 class BFile;
18 class BNode;
21 namespace BPrivate {
24 class BCopyEngine : public BEntryOperationEngineBase {
25 public:
26 class BController;
28 enum {
29 COPY_RECURSIVELY = 0x01,
30 MERGE_EXISTING_DIRECTORIES = 0x02,
31 UNLINK_DESTINATION = 0x04,
34 public:
35 BCopyEngine(uint32 flags = 0);
36 ~BCopyEngine();
38 BController* Controller() const;
39 void SetController(BController* controller);
41 uint32 Flags() const;
42 BCopyEngine& SetFlags(uint32 flags);
43 BCopyEngine& AddFlags(uint32 flags);
44 BCopyEngine& RemoveFlags(uint32 flags);
46 status_t CopyEntry(const Entry& sourceEntry,
47 const Entry& destEntry);
49 private:
50 status_t _CopyEntry(const char* sourcePath,
51 const char* destPath);
52 status_t _CopyFileData(const char* sourcePath,
53 BFile& source, const char* destPath,
54 BFile& destination);
55 status_t _CopyAttributes(const char* sourcePath,
56 BNode& source, const char* destPath,
57 BNode& destination);
59 void _NotifyError(status_t error, const char* format,
60 ...);
61 void _NotifyErrorVarArgs(status_t error,
62 const char* format, va_list args);
63 status_t _HandleEntryError(const char* path,
64 status_t error, const char* format, ...);
65 status_t _HandleAttributeError(const char* path,
66 const char* attribute, uint32 attributeType,
67 status_t error, const char* format, ...);
69 private:
70 BController* fController;
71 uint32 fFlags;
72 char* fBuffer;
73 size_t fBufferSize;
77 class BCopyEngine::BController {
78 public:
79 BController();
80 virtual ~BController();
82 virtual bool EntryStarted(const char* path);
83 virtual bool EntryFinished(const char* path, status_t error);
85 virtual bool AttributeStarted(const char* path,
86 const char* attribute,
87 uint32 attributeType);
88 virtual bool AttributeFinished(const char* path,
89 const char* attribute,
90 uint32 attributeType, status_t error);
92 virtual void ErrorOccurred(const char* message,
93 status_t error);
97 } // namespace BPrivate
100 using ::BPrivate::BCopyEngine;
103 #endif // _COPY_ENGINE_H