Restructure project files

This commit is contained in:
topjohnwu
2023-11-08 01:46:02 -08:00
parent ecb31eed40
commit 65c18f9c09
44 changed files with 85 additions and 113 deletions

View File

@@ -4,9 +4,11 @@
#include <map>
#include <base.hpp>
#include <core.hpp>
#include <resetprop.hpp>
#include "resetprop.hpp"
#include "../core-rs.hpp"
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <api/_system_properties.h>
using namespace std;

View File

@@ -1,34 +0,0 @@
#pragma once
#include <string>
#include <map>
#include <cxx.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <api/_system_properties.h>
struct prop_cb {
virtual void exec(const char *name, const char *value) = 0;
};
using prop_list = std::map<std::string, std::string>;
struct prop_collector : prop_cb {
explicit prop_collector(prop_list &list) : list(list) {}
void exec(const char *name, const char *value) override {
list.insert({name, value});
}
private:
prop_list &list;
};
// System properties
rust::String get_prop_rs(const char *name, bool persist);
std::string get_prop(const char *name, bool persist = false);
int delete_prop(const char *name, bool persist = false);
int set_prop(const char *name, const char *value, bool skip_svc = false);
void load_prop_file(const char *filename, bool skip_svc = false);
static inline void prop_cb_exec(prop_cb &cb, const char *name, const char *value) {
cb.exec(name, value);
}