remarkable_tool/notebook_tree.hpp

57 lines
1.5 KiB
C++

/* Copyright 2021, Michele Santullo
* This file is part of remarkable_tool.
*
* remarkable_tool is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Remarkable_tool is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with remarkable_tool. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vector>
#include <cstdint>
#include <string>
#include <string_view>
namespace duck {
struct NotebookInfo {
std::string visible_name;
std::string parent;
std::string type;
std::vector<std::string> files;
std::uint64_t version = 0;
std::uintmax_t total_size = 0;
bool deleted = false;
bool isolated = true;
};
struct Node {
Node() :
info(nullptr),
parent(nullptr)
{ }
Node (std::string_view name, const NotebookInfo* payload, Node* parent) :
name(name),
info(payload),
parent(parent)
{ }
std::vector<Node> children;
std::string_view name;
const NotebookInfo* info;
const Node* parent;
};
std::vector<Node> build_notebook_tree (std::string_view base_path);
std::vector<const NotebookInfo*> make_list_of_deleted (const std::vector<Node>& roots);
} //namespace duck