view include/sys/x11/settings.h @ 367:8d45d892be88 default tip

*: instead of pugixml, use Qt XML features this means we have one extra Qt dependency though...
author Paper <paper@tflc.us>
date Sun, 17 Nov 2024 22:55:47 -0500
parents 99c961c91809
children
line wrap: on
line source

#ifndef MINORI_SYS_X11_SETTINGS_H_
#define MINORI_SYS_X11_SETTINGS_H_

#include <cstdint>
#include <string>
#include <vector>

namespace x11 {

/* stores the item, type, etc */
struct SettingsItem {
	enum Type {
		TypeInt = 0,
		TypeStr = 1,
		TypeRgba = 2,
	};

	/* could technically be a union */
	struct Data {
		std::int32_t integer;
		std::string string;
		struct {
			std::uint16_t red, green, blue, alpha;
		} rgba;
	};

	bool VerifyType();

	std::uint8_t type;    /* one of Type */
	std::string name;     /* name of the item */
	std::uint32_t serial; /* last-changed serial */
	Data data;            /* type-specific data */
};

bool GetSettings(std::vector<SettingsItem>& settings);
bool FindSetting(const std::string& name, SettingsItem& setting);

}

#endif /* MINORI_SYS_X11_SETTINGS_H_ */