Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
87 lines (66 loc) · 2.73 KB

File metadata and controls

87 lines (66 loc) · 2.73 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#ifndef _MENU_APPINFO_H_
#define _MENU_APPINFO_H_
// ========================================
// INCLUDES
// ========================================
#include "settings.h"
#include "system.h"
// ========================================
// MACROS
// ========================================
#define NUM_BUFFER_SIZE 10
// ========================================
// TYPES
// ========================================
// ========================================
// PROTOTYPES
// ========================================
// ========================================
// GLOBALS
// ========================================
PocuterSettings pocuterSettings;
char numBuffer[NUM_BUFFER_SIZE];
// ========================================
// FUNCTIONS
// ========================================
bool getSetting(const char *section, const char *name, char *dest, size_t maxLength) {
PocuterConfig config((const uint8_t *) "settings");
return config.get((const uint8_t *) section, (const uint8_t *) name, (uint8_t *) dest, maxLength);
}
char* getSetting(const char *section, const char *name, const char *defaultValue, char *dest, size_t maxLength) {
if (!getSetting(section, name, dest, maxLength)) {
strncpy(dest, defaultValue, maxLength-1);
dest[maxLength-1] = '\0';
}
return dest;
}
int getSetting(const char *section, const char *name, int defaultValue) {
if (!getSetting(section, name, numBuffer, NUM_BUFFER_SIZE))
return defaultValue;
return atoi(numBuffer);
}
uint32_t getSetting(const char *section, const char *name, uint32_t defaultValue) {
return getSetting(section, name, (int) defaultValue);
}
double getSetting(const char *section, const char *name, double defaultValue) {
if (!getSetting(section, name, numBuffer, NUM_BUFFER_SIZE))
return defaultValue;
return atof(numBuffer);
}
bool setSetting(const char *section, const char *name, const char *value) {
PocuterConfig config((const uint8_t *) "settings");
return config.set((const uint8_t *) section, (const uint8_t *) name, (const uint8_t *) value);
}
bool setSetting(const char *section, const char *name, int value) {
snprintf(numBuffer, NUM_BUFFER_SIZE, "%d", value);
return setSetting(section, name, (const char *) numBuffer);
}
bool setSetting(const char *section, const char *name, uint32_t value) {
snprintf(numBuffer, NUM_BUFFER_SIZE, "%d", value);
return setSetting(section, name, (const char *) numBuffer);
}
bool setSetting(const char *section, const char *name, double value) {
snprintf(numBuffer, NUM_BUFFER_SIZE, "%f", value);
return setSetting(section, name, (const char *) numBuffer);
}
#endif //_MENU_APPINFO_H_
Morty Proxy This is a proxified and sanitized view of the page, visit original site.