2020-12-30 22:07:54 -06:00
|
|
|
/*
|
|
|
|
* Copyright 2020, Jaidyn Levesque <jadedctrl@teknik.io>
|
2021-02-27 20:51:41 -06:00
|
|
|
* Copyight 2017 Akshay Agarwal, agarwal.akshay.akshay8@gmail.com
|
2020-12-30 22:07:54 -06:00
|
|
|
* All rights reserved. Distributed under the terms of the MIT license.
|
|
|
|
*/
|
2020-07-04 10:27:38 -05:00
|
|
|
#ifndef UTIL_H
|
|
|
|
#define UTIL_H
|
|
|
|
|
2020-07-06 04:39:30 -05:00
|
|
|
#include <DateTime.h>
|
2020-12-30 22:07:54 -06:00
|
|
|
|
2020-07-04 10:27:38 -05:00
|
|
|
#include "ProtocolListener.h"
|
|
|
|
|
2021-02-27 20:51:41 -06:00
|
|
|
class BBitmap;
|
2020-12-30 22:07:54 -06:00
|
|
|
class BUrl;
|
|
|
|
|
|
|
|
|
|
|
|
BDateTime feedDateToBDate(const char*);
|
|
|
|
BDateTime dateRfc3339ToBDate(const char*);
|
|
|
|
BDateTime dateRfc822ToBDate(const char*);
|
|
|
|
BDateTime stringDateToBDate(const char*, const char*);
|
2020-07-06 04:39:30 -05:00
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
BString dateTo3339String(BDateTime);
|
2020-07-06 04:39:30 -05:00
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
bool withinDateRange(BDateTime, BDateTime, BDateTime);
|
2020-07-06 04:39:30 -05:00
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
bool isRemotePath(BString);
|
|
|
|
|
2021-01-11 18:08:15 -06:00
|
|
|
BString urlToFilename(BUrl url);
|
2021-02-20 20:26:42 -06:00
|
|
|
const char* tempFileName(const char* dir, const char* name, const char* suffix);
|
2021-01-11 18:08:15 -06:00
|
|
|
|
2021-01-11 11:41:46 -06:00
|
|
|
int32 fetch(BUrl url, BDataIO* reply, BString* hash, int timeout);
|
2020-11-16 18:46:07 -06:00
|
|
|
|
2021-01-28 00:19:36 -06:00
|
|
|
void userFileError(status_t status, const char* path);
|
2020-07-04 10:27:38 -05:00
|
|
|
|
2021-02-20 20:26:42 -06:00
|
|
|
// Takes a (probably invalid) bit of HTML and adds necessary elements in a
|
|
|
|
// temporary copy. Returns an entry_ref to said temporary copy.
|
|
|
|
entry_ref tempHtmlFile(entry_ref* ref, const char* title);
|
|
|
|
|
2021-02-27 20:51:41 -06:00
|
|
|
// Ripped from Calendar (utils/ResourceLoader.cpp)
|
|
|
|
BBitmap* loadVectorIcon(const char* name, int32 iconSize = 32,
|
|
|
|
int32 cropSize = 22);
|
2021-01-28 00:19:36 -06:00
|
|
|
|
|
|
|
#endif // UTIL_H
|
2020-12-30 22:07:54 -06:00
|
|
|
|