41 lines
962 B
C++
41 lines
962 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
namespace drive {
|
|
|
|
enum drive_type {
|
|
dt_alipan,
|
|
dt_filebrowser,
|
|
};
|
|
|
|
/// @brief file entry
|
|
struct dItem {
|
|
std::string id;
|
|
std::string name;
|
|
bool folder;
|
|
};
|
|
|
|
class drive {
|
|
public:
|
|
virtual ~drive() {}
|
|
typedef std::shared_ptr<drive> ref;
|
|
typedef void (*fnQrcode)(const std::string&);
|
|
|
|
virtual bool qrLogin(fnQrcode printQr) = 0;
|
|
virtual std::vector<dItem> list(const std::string& file_id) = 0;
|
|
virtual std::string link(const std::string& file_id) = 0;
|
|
virtual void remove(const std::string& file_id) = 0;
|
|
virtual std::string mkdir(const std::string& parent_id, const std::string& name) = 0;
|
|
virtual std::string upload(const std::string& parent_id, const std::string& file) = 0;
|
|
};
|
|
|
|
/// @brief factory funtion
|
|
drive::ref new_drive(drive_type type);
|
|
|
|
std::string hex_encode(const unsigned char* data, size_t len);
|
|
std::string device_name();
|
|
|
|
} |