Pebble App Framework
v7.1.1
How It Works
CLI
Device API
Phone API
C Coverage
TS Coverage
GitHub
Theme
Pebble App Framework: Device API
Toggle main menu visibility
Loading...
Searching...
No Matches
settings_chain.h
Go to the documentation of this file.
1
11
#pragma once
12
#include "
system/settings/settings.h
"
13
18
26
static
inline
const
SettingsSchema
*
settings_chain_first
(
const
SettingsSchema
*head,
const
SettingsSchema
*tail)
27
{
28
return
head ? head : tail;
29
}
30
41
static
inline
const
SettingsSchema
*
settings_chain_next
(
const
SettingsSchema
*schema,
const
SettingsSchema
*tail)
42
{
43
if
(schema == tail)
44
{
45
return
NULL;
46
}
47
48
return
schema->
companion
? schema->
companion
: tail;
49
}
50
58
#define SETTINGS_CHAIN_EACH(schema, head, tail) \
59
for (const SettingsSchema *schema = settings_chain_first((head), (tail)); schema; \
60
schema = settings_chain_next(schema, (tail)))
61
71
static
inline
bool
settings_chain_has_field
(
const
SettingsSchema
*head,
const
uint32_t *message_key)
72
{
73
for
(
const
SettingsSchema
*schema = head; schema; schema = schema->
companion
)
74
{
75
for
(uint8_t i = 0; i < schema->field_count; i++)
76
{
77
if
(schema->fields[i].message_key == message_key)
78
{
79
return
true
;
80
}
81
}
82
}
83
84
return
false
;
85
}
86
96
static
inline
bool
settings_chain_has_key
(
const
SettingsSchema
*head, uint32_t key)
97
{
98
for
(
const
SettingsSchema
*schema = head; schema; schema = schema->
companion
)
99
{
100
if
(schema->key == key)
101
{
102
return
true
;
103
}
104
}
105
106
return
false
;
107
}
108
settings_chain_has_field
static bool settings_chain_has_field(const SettingsSchema *head, const uint32_t *message_key)
Whether a schema in the face's own chain has a field on a message key.
Definition
settings_chain.h:71
settings_chain_has_key
static bool settings_chain_has_key(const SettingsSchema *head, uint32_t key)
Whether a schema in the face's own chain is saved under a persist key.
Definition
settings_chain.h:96
settings_chain_first
static const SettingsSchema * settings_chain_first(const SettingsSchema *head, const SettingsSchema *tail)
Where the walk starts.
Definition
settings_chain.h:26
settings_chain_next
static const SettingsSchema * settings_chain_next(const SettingsSchema *schema, const SettingsSchema *tail)
The schema after this one in the walk.
Definition
settings_chain.h:41
settings.h
The persist API. A per-face SettingField table drives versioned load and save, sanitizing,...
SettingsSchema
A face's persistence identity.
Definition
settings.h:97
SettingsSchema::companion
const struct SettingsSchema * companion
Next schema in the chain, or NULL.
Definition
settings.h:106
src
c
pebble
system
settings
settings_chain.h
Generated by
1.18.0