2022-07-25 12:24:23 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-10-12 20:40:38 +08:00
|
|
|
#include "fastfetch.h"
|
2022-07-25 13:59:19 +02:00
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
typedef struct FFpropquery {
|
2022-07-25 12:24:23 +02:00
|
|
|
const char* start;
|
|
|
|
|
FFstrbuf* buffer;
|
|
|
|
|
} FFpropquery;
|
|
|
|
|
|
|
|
|
|
bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer);
|
|
|
|
|
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries);
|
2023-06-24 10:59:53 +08:00
|
|
|
bool ffParsePropFileHomeValues(const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
2023-01-08 01:41:09 +01:00
|
|
|
bool ffParsePropFileListValues(const FFlist* list, const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
|
|
|
|
|
2024-07-15 10:05:35 +08:00
|
|
|
bool ffParsePropLinePointer(const char** line, const char* start, FFstrbuf* buffer);
|
|
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
static inline bool ffParsePropLine(const char* line, const char* start, FFstrbuf* buffer) {
|
2024-07-15 10:05:35 +08:00
|
|
|
return ffParsePropLinePointer(&line, start, buffer);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
static inline bool ffParsePropFile(const char* filename, const char* start, FFstrbuf* buffer) {
|
2026-03-30 10:27:23 +08:00
|
|
|
return ffParsePropFileValues(filename, 1, (FFpropquery[]) { { start, buffer } });
|
2023-01-08 01:41:09 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
static inline bool ffParsePropFileHome(const char* relativeFile, const char* start, FFstrbuf* buffer) {
|
2026-03-30 10:27:23 +08:00
|
|
|
return ffParsePropFileHomeValues(relativeFile, 1, (FFpropquery[]) { { start, buffer } });
|
2023-01-08 01:41:09 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
static inline bool ffParsePropFileList(const FFlist* list, const char* relativeFile, const char* start, FFstrbuf* buffer) {
|
2026-03-30 10:27:23 +08:00
|
|
|
return ffParsePropFileListValues(list, relativeFile, 1, (FFpropquery[]) { { start, buffer } });
|
2023-01-08 01:41:09 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
static inline bool ffParsePropFileConfigValues(const char* relativeFile, uint32_t numQueries, FFpropquery* queries) {
|
2023-06-24 10:59:53 +08:00
|
|
|
return ffParsePropFileListValues(&instance.state.platform.configDirs, relativeFile, numQueries, queries);
|
2023-01-08 01:41:09 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
static inline bool ffParsePropFileConfig(const char* relativeFile, const char* start, FFstrbuf* buffer) {
|
2026-03-30 10:27:23 +08:00
|
|
|
return ffParsePropFileConfigValues(relativeFile, 1, (FFpropquery[]) { { start, buffer } });
|
2023-01-08 01:41:09 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
static inline bool ffParsePropFileDataValues(const char* relativeFile, uint32_t numQueries, FFpropquery* queries) {
|
2023-06-24 10:59:53 +08:00
|
|
|
return ffParsePropFileListValues(&instance.state.platform.dataDirs, relativeFile, numQueries, queries);
|
2023-01-08 01:41:09 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
static inline bool ffParsePropFileData(const char* relativeFile, const char* start, FFstrbuf* buffer) {
|
2026-03-30 10:27:23 +08:00
|
|
|
return ffParsePropFileDataValues(relativeFile, 1, (FFpropquery[]) { { start, buffer } });
|
2023-01-08 01:41:09 +01:00
|
|
|
}
|