File: selection.h

package info (click to toggle)
tina 0.1.14-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 936 kB
  • sloc: ansic: 1,653; sh: 1,415; python: 1,196; makefile: 42
file content (42 lines) | stat: -rw-r--r-- 1,178 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * tina - a personal information manager
 * SPDX-FileCopyrightText: 2001  Matt Kraai
 * SPDX-FileCopyrightText: Peter Pentchev <roam@ringlet.net>
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef TINA_SELECTION_H
#define TINA_SELECTION_H

#include <sys/types.h>

#include "database.h"
#include "item.h"

struct selection
{
  struct database *db;
  char *category;

  struct item **items;
  size_t nitems;
};

/* Create a new selection.  */
struct selection *selection_new_with_database (struct database *db);
/* Delete S.  */
void selection_delete (struct selection *s);

/* Set the category of S to CATEGORY.  */
void selection_category_set (struct selection *s, const char *category);
/* Refresh S to reflect changes to the database.  */
void selection_refresh (struct selection *s);

/* Add IT to S at POS.  */
void selection_item_add (struct selection *s, struct item *it, size_t pos);
/* Remove the item at POS from S.  */
void selection_item_remove (struct selection *s, size_t pos);
/* Return the position of IT in S->items, or S->nitems if it is not present.  */
int selection_item_index (struct selection *s, struct item *it);

#endif /* TINA_SELECTION_H */