xref: /haiku/src/kits/package/FetchUtils.h (revision 4c8e85b316c35a9161f5a1c50ad70bc91c83a76f)
1 /*
2  * Copyright 2020, Stephan Aßmus <superstippi@gmx.de>
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE__PRIVATE__FETCH_UTILS_H_
6 #define _PACKAGE__PRIVATE__FETCH_UTILS_H_
7 
8 
9 #include "SupportDefs.h"
10 #include <Node.h>
11 
12 namespace BPackageKit {
13 
14 namespace BPrivate {
15 
16 
17 class FetchUtils {
18 public:
19 	static	bool				IsDownloadCompleted(const char* path);
20 	static	bool				IsDownloadCompleted(const BNode& node);
21 
22 	static	status_t			MarkDownloadComplete(const char* path);
23 	static	status_t			MarkDownloadComplete(BNode& node);
24 
25 	static	status_t			SetFileType(BNode& node, const char* type);
26 
27 private:
28 	static	status_t			_SetAttribute(BNode& node,
29 									const char* attrName,
30 									type_code type, const void* data,
31 									size_t size);
32 	static	status_t			_GetAttribute(const BNode& node,
33 									const char* attrName,
34 									type_code type, void* data,
35 									size_t size);
36 };
37 
38 
39 }	// namespace BPrivate
40 
41 }	// namespace BPackageKit
42 
43 
44 #endif // _PACKAGE__PRIVATE__FETCH_UTILS_H_
45