use interoptopus::util::NamespaceMappings;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum WriteTypes {
Namespace,
NamespaceAndInteroptopusGlobal,
All,
}
impl WriteTypes {
pub fn write_interoptopus_globals(&self) -> bool {
match self {
WriteTypes::Namespace => false,
WriteTypes::NamespaceAndInteroptopusGlobal => true,
WriteTypes::All => true,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum CSharpVisibility {
AsDeclared,
ForcePublic,
ForceInternal,
}
impl CSharpVisibility {
pub fn to_access_modifier(&self) -> &'static str {
match self {
CSharpVisibility::AsDeclared => "public",
CSharpVisibility::ForcePublic => "public",
CSharpVisibility::ForceInternal => "internal",
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Unsafe {
None,
UnsafeKeyword,
UnsafePlatformMemCpy,
}
impl Unsafe {
pub fn any_unsafe(self) -> bool {
match self {
Unsafe::None => false,
Unsafe::UnsafeKeyword => true,
Unsafe::UnsafePlatformMemCpy => true,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum ParamSliceType {
Array,
Span,
}
#[derive(Clone, Debug)]
pub struct Config {
pub file_header_comment: String,
pub class: String,
pub class_constants: Option<String>,
pub dll_name: String,
pub namespace_mappings: NamespaceMappings,
pub namespace_id: String,
pub visibility_types: CSharpVisibility,
pub unroll_struct_arrays: bool,
pub write_types: WriteTypes,
pub use_unsafe: Unsafe,
pub rename_symbols: bool,
pub debug: bool,
pub param_slice_type: ParamSliceType,
}
impl Config {}
impl Default for Config {
fn default() -> Self {
Self {
file_header_comment: "// Automatically generated by Interoptopus.".to_string(),
class: "Interop".to_string(),
class_constants: None,
dll_name: "library".to_string(),
namespace_mappings: NamespaceMappings::new("My.Company"),
namespace_id: "".to_string(),
visibility_types: CSharpVisibility::AsDeclared,
unroll_struct_arrays: true,
write_types: WriteTypes::NamespaceAndInteroptopusGlobal,
use_unsafe: Unsafe::None,
rename_symbols: false,
debug: false,
param_slice_type: ParamSliceType::Array,
}
}
}
#[derive(Clone, Debug, Default)]
pub struct DocConfig {
pub header: String,
}