DIE Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
tags.h
Go to the documentation of this file.
1
11
12
#ifndef TAGS_H
13
#define TAGS_H
14
15
#include <QList>
16
#include <QString>
17
#include <stdio.h>
18
#include <stdint.h>
19
20
static
constexpr
int
TAG_NAME_MAX = 31;
21
static
constexpr
int
TAG_VALUE_MAX = 127;
22
static
constexpr
int
TAG_COUNT_MAX = 65535;
23
24
/*****************************************************************************/
28
typedef
struct
{
29
char
name
[TAG_NAME_MAX + 1];
30
char
value
[TAG_VALUE_MAX + 1];
31
}
Tag
;
32
33
/*****************************************************************************/
38
class
Tags
39
{
40
public
:
41
Tags
();
42
44
void
init
();
45
47
void
clear
();
48
55
bool
load
(
const
QString & filename);
56
62
bool
save
(
const
QString & filename);
63
68
int
findByName
(
const
char
* name)
const
;
69
74
int
findOrAddByName
(
const
char
* name);
75
77
const
char
*
nameForTag
(uint16_t tag)
const
;
78
80
const
char
*
valueForTag
(uint16_t tag)
const
;
81
82
QString
path
;
83
QList<Tag>
tags
;
84
85
private
:
86
static
void
skipLine(FILE * file);
87
};
88
89
extern
Tags
tags
;
90
91
#endif
// TAGS_H
Tags
Tags database.
Definition
tags.h:39
Tags::findOrAddByName
int findOrAddByName(const char *name)
Find a tag by its name, create it when missing.
Definition
tags.cpp:104
Tags::nameForTag
const char * nameForTag(uint16_t tag) const
Name of a tag, "None" for id 0 or out of range ids.
Definition
tags.cpp:121
Tags::path
QString path
Definition
tags.h:82
Tags::findByName
int findByName(const char *name) const
Find a tag by its name.
Definition
tags.cpp:95
Tags::save
bool save(const QString &filename)
Save all the tags to a file.
Definition
tags.cpp:75
Tags::clear
void clear()
Remove all the tags.
Definition
tags.cpp:31
Tags::load
bool load(const QString &filename)
Load tags from a file and merge them into the database.
Definition
tags.cpp:37
Tags::Tags
Tags()
Definition
tags.cpp:20
Tags::valueForTag
const char * valueForTag(uint16_t tag) const
Value of a tag, "" for id 0 or out of range ids.
Definition
tags.cpp:127
Tags::tags
QList< Tag > tags
Definition
tags.h:83
Tags::init
void init()
Clear the database and forget the current path.
Definition
tags.cpp:25
Tag
A tag: name / value pair (null-terminated strings).
Definition
tags.h:28
Tag::name
char name[TAG_NAME_MAX+1]
Definition
tags.h:29
Tag::value
char value[TAG_VALUE_MAX+1]
Definition
tags.h:30
tags
Tags tags
Definition
tags.cpp:17
common
engine
tags.h
Generated by
1.17.0