pub struct Config {
pub file_header: Option<String>,
pub file_trailer: Option<String>,
pub file_autogen_warning: Option<String>,
pub function_prefix: Option<String>,
pub function_postfix: Option<String>,
pub enum_add_sentinel: bool,
pub struct_gen_op_eq: bool,
pub struct_gen_op_neq: bool,
pub struct_gen_op_lt: bool,
pub struct_gen_op_lte: bool,
pub struct_gen_op_gt: bool,
pub struct_gen_op_gte: bool,
}
impl Config {
pub fn default() -> Config {
Config {
file_header: None,
file_trailer: None,
file_autogen_warning: None,
function_prefix: None,
function_postfix: None,
enum_add_sentinel: false,
struct_gen_op_eq: false,
struct_gen_op_neq: false,
struct_gen_op_lt: false,
struct_gen_op_lte: false,
struct_gen_op_gt: false,
struct_gen_op_gte: false,
}
}
pub fn gecko_webrender() -> Config {
let license = r###"/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */"###;
let autogen = r###"/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
* To generate this file, clone `https://github.com/rlhunt/cbindgen` or run `cargo install cbindgen`,
* then run `cbindgen -c wr gfx/webrender_bindings/ gfx/webrender_bindings/webrender_ffi_generated.h` */"###;
Config {
file_header: Some(String::from(license)),
file_trailer: None,
file_autogen_warning: Some(String::from(autogen)),
function_prefix: Some(String::from("WR_INLINE")),
function_postfix: Some(String::from("WR_FUNC")),
enum_add_sentinel: true,
struct_gen_op_eq: true,
struct_gen_op_neq: false,
struct_gen_op_lt: false,
struct_gen_op_lte: false,
struct_gen_op_gt: false,
struct_gen_op_gte: false,
}
}
pub fn load(config: &str) -> Option<Config> {
match config {
"default" => Some(Config::default()),
"wr" => Some(Config::gecko_webrender()),
_ => None,
}
}
}