You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
899 B
22 lines
899 B
// config_updater.h — Universal INI config file updater (like insert_or_replace_option in utun) |
|
#ifndef CONFIG_UPDATER_H |
|
#define CONFIG_UPDATER_H |
|
|
|
#include <QString> |
|
#include <QStringList> |
|
|
|
enum ConfigUpdateFlag { |
|
CONFIG_UPDATE_REPLACE = 0, // replace existing param (single value) |
|
CONFIG_UPDATE_APPEND = 1 // add new param even if exists (multi-value) |
|
}; |
|
|
|
// Batch update — for callers that read/write the file once (e.g. NodeConfig::save) |
|
bool config_update_in_lines(QStringList& lines, const QString& section, |
|
const QString& key, const QString& value, bool replace); |
|
|
|
// File-level wrapper — reads, updates, writes |
|
bool config_update_option(const QString& filePath, const QString& section, |
|
const QString& param, const QString& value, |
|
int flags = CONFIG_UPDATE_REPLACE); |
|
|
|
#endif // CONFIG_UPDATER_H
|
|
|