#ifndef SUIT_ATTENTION_H #define SUIT_ATTENTION_H #include <stdbool.h> #include <stddef.h> // $SUIT_HOME/attention: what needs the user. An item is a line, "KIND NAME" // or "KIND NAME: what", and the lines indented by two spaces after it, which // belong to it. The file is written beside, synced and renamed, and is removed // when it would be empty. Each returns 0, or 1 after saying what failed. constexpr size_t ATTENTION_FILE_MAX = 131072; // Take out the items of NAME, of kind KIND (every kind if null). Writes // nothing when there is none. int attention_remove(const char *path, const char *kind, const char *name); // Replace the item KIND NAME with HEADER and DETAILS: lines, each ending in a // newline, kept under it indented (null for none). Writes nothing when the // file would not change. int attention_add(const char *path, const char *kind, const char *name, const char *header, const char *details); // Print "needs you:" and the file's lines, or nothing when there are none. int attention_print(const char *path); // How many items the file holds: its lines that are not indented. 0 in *COUNT // when it is not there. Returns 0, or 1 after saying what failed. int attention_count(const char *path, unsigned *count); // Whether the item KIND NAME is in the file: false in *HAS when it is not // there. Returns 0, or 1 after saying what failed. int attention_has(const char *path, const char *kind, const char *name, bool *has); #endif