Files
fastfetch/src/common/properties.h
T

48 lines
2.2 KiB
C
Raw Normal View History

#pragma once
#include "fastfetch.h"
2026-03-29 09:28:49 +08:00
typedef struct FFpropquery {
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);
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);
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) {
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) {
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) {
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
}