blob: dab81e680b333e1c3f9664c16f31e19b08a9e051 (
plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#ifndef _LANG_H
#define _LANG_H
#include <stdbool.h>
#include <stdint.h>
struct setting;
struct setting_value;
/**
* Settings for a programming language.
*/
struct language {
/** Language id */
const char *id;
/** Descriptive name of the programming language */
const char *name;
};
/**
* Initialize languages.
*
* @param[in] register_default Set to true to register some well known
* languages.
*/
void languages_init(bool register_default);
/**
* Free up resources associated with a language.
*/
void lang_destroy(struct language *lang);
/**
* Get a language config by file name.
*
* @param[in] filename File name.
* @returns A language config instance or the default language if not found.
*/
struct language lang_from_filename(const char *filename);
/**
* Get a language config by id. The language id is a short (all-lowercase)
* string identifying the language.
*
* @param[in] id The language id.
* @returns A language config instance or the default language if not found.
*/
struct language lang_from_id(const char *id);
/**
* Get all settings associated with a language.
*
* @param lang The language to get settings for.
* @param settings Result array for settings.
* @param nsettings resulting number of settings placed in @ref settings.
*/
void lang_settings(struct language *lang, struct setting **settings[],
uint32_t *nsettings);
/**
* Get a single setting for a language.
*
* @param lang The language to get setting for.
* @param key The setting key, relative to the language.
*
* @returns The setting if found, else NULL.
*/
struct setting *lang_setting(struct language *lang, const char *key);
/**
* Set a setting for a language.
*
* @param lang The language to set for.
* @param key The setting key, relative to the language.
* @param value The value to set
*/
void lang_setting_set(struct language *lang, const char *key,
struct setting_value value);
/**
* Set a default value for a language setting.
*
* @param lang The language to set for.
* @param key The setting key, relative to the language.
* @param value The value to set
*/
void lang_setting_set_default(struct language *lang, const char *key,
struct setting_value value);
#endif
|