DIE Engine
Loading...
Searching...
No Matches
Tags Class Reference

Tags database. More...

#include <tags.h>

Public Member Functions

 Tags ()
void init ()
 Clear the database and forget the current path.
void clear ()
 Remove all the tags.
bool load (const QString &filename)
 Load tags from a file and merge them into the database.
bool save (const QString &filename)
 Save all the tags to a file.
int findByName (const char *name) const
 Find a tag by its name.
int findOrAddByName (const char *name)
 Find a tag by its name, create it when missing.
const char * nameForTag (uint16_t tag) const
 Name of a tag, "None" for id 0 or out of range ids.
const char * valueForTag (uint16_t tag) const
 Value of a tag, "" for id 0 or out of range ids.

Public Attributes

QString path
QList< Tagtags

Detailed Description

Tags database.

Note
tag ids are 1-based, id 0 means "None" / not found

Constructor & Destructor Documentation

◆ Tags()

Tags::Tags ( )

Member Function Documentation

◆ clear()

void Tags::clear ( )

Remove all the tags.

◆ findByName()

int Tags::findByName ( const char * name) const

Find a tag by its name.

Returns
1-based tag id, or 0 when not found

◆ findOrAddByName()

int Tags::findOrAddByName ( const char * name)

Find a tag by its name, create it when missing.

Returns
1-based tag id, or 0 for empty / "None" names and a full database

◆ init()

void Tags::init ( )

Clear the database and forget the current path.

◆ load()

bool Tags::load ( const QString & filename)

Load tags from a file and merge them into the database.

Note
tags with an already known name get their value updated
Parameters
filenamepath of the tags file
Returns
true on success, false when the file cannot be opened

◆ nameForTag()

const char * Tags::nameForTag ( uint16_t tag) const

Name of a tag, "None" for id 0 or out of range ids.

◆ save()

bool Tags::save ( const QString & filename)

Save all the tags to a file.

Parameters
filenamepath of the tags file
Returns
true on success, false when the file cannot be opened

◆ valueForTag()

const char * Tags::valueForTag ( uint16_t tag) const

Value of a tag, "" for id 0 or out of range ids.

Member Data Documentation

◆ path

QString Tags::path

◆ tags

QList<Tag> Tags::tags

The documentation for this class was generated from the following files: