qt_core 0.1.3

Bindings for Qt5Core library
extern crate cpp_to_rust;
use cpp_to_rust::config::Config;
use cpp_to_rust::errors::{Result};

extern crate qt_build_tools;
use qt_build_tools::QtConfig;

fn setup() -> Result<()> {
  let mut config = Config::new();
  try!(config.setup_qt_library());
  config.add_cpp_parser_blocked_names(vec![
    "QtMetaTypePrivate",
    "QtPrivate",
    "QFlag",
    "QBasicAtomicInteger",
    "qt_check_for_QGADGET_macro",
    "QMessageLogContext::copy",
    "QBasicAtomicInteger"
  ]);
  config.exclude_qvector_eq_based_methods(&["QStaticPlugin", "QTimeZone::OffsetData"]);
  config.exclude_qlist_eq_based_methods(&["QAbstractEventDispatcher::TimerInfo", "QCommandLineOption"]);
  config.add_cpp_ffi_generator_filter(Box::new(|method| {
    if let Some(ref info) = method.class_membership {
      if info.class_type.to_cpp_pseudo_code() == "QFuture<void>" {
        // template partial specialization removes these methods
        match method.name.as_ref() {
          "operator void" | "isResultReadyAt" | "result" | "resultAt" | "results" => return Ok(false),
          _ => {}
        }
      }
      if info.class_type.to_cpp_pseudo_code() == "QFutureIterator<void>" {
        // template partial specialization removes these methods
        match method.name.as_ref() {
          "QFutureIterator" | "operator=" => return Ok(false),
          _ => {}
        }
      }
      if info.class_type.name == "QString" {
        match method.name.as_ref() {
          "toLatin1" | "toUtf8" | "toLocal8Bit" => {
            // MacOS has non-const duplicates of these methods,
            // and that would alter Rust names of these methods
            if !info.is_const {
              return Ok(false);
            }
          }
          _ => {}
        }
      }
    }
    Ok(true)
  }));
  config.exec()
}

fn main() {
  if let Err(err) = setup() {
    err.display_report();
    std::process::exit(1);
  }
}