qt_gui 0.1.1

Bindings for Qt5Gui 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;

#[cfg(all(windows, target_env = "msvc"))]
pub fn is_msvc() -> bool {
  true
}

#[cfg(not(all(windows, target_env = "msvc")))]
pub fn is_msvc() -> bool {
  false
}

fn setup() -> Result<()> {
  let mut config = Config::new();
  try!(config.setup_qt_library());
  config.add_cpp_parser_blocked_names(vec!["QAbstractOpenGLFunctionsPrivate",
                                           "QOpenGLFunctionsPrivate",
                                           "QOpenGLExtraFunctionsPrivate"]);
  config.exclude_qvector_eq_based_methods(&["QTextLayout::FormatRange"]);
  config.exclude_qlist_eq_based_methods(&["QInputMethodEvent::Attribute",
                                          "QTextLayout::FormatRange",
                                          "QTouchEvent::TouchPoint"]);
  config.add_cpp_ffi_generator_filter(Box::new(|method| {
    if let Some(ref info) = method.class_membership {
      match info.class_type.to_cpp_pseudo_code().as_ref() {
        "QQueue<QInputMethodEvent::Attribute>" |
        "QQueue<QTextLayout::FormatRange>" |
        "QQueue<QTouchEvent::TouchPoint>" => {
          match method.name.as_ref() {
            "operator==" | "operator!=" => return Ok(false),
            _ => {}
          }
        }
        "QStack<QInputMethodEvent::Attribute>" |
        "QStack<QTextLayout::FormatRange>" => {
          match method.name.as_ref() {
            "operator==" | "operator!=" | "fromList" => return Ok(false),
            _ => {}
          }
        }
        "QOpenGLVersionFunctionsStorage" => {
          match method.name.as_ref() {
            "QOpenGLVersionFunctionsStorage" |
            "~QOpenGLVersionFunctionsStorage" |
            "backend" => return Ok(false),
            _ => {}
          }
        }
        _ => {}
      }
      if method.is_constructor() && info.class_type.name.starts_with("QOpenGLFunctions_") &&
         (info.class_type.name.ends_with("_CoreBackend") |
          info.class_type.name.ends_with("_DeprecatedBackend")) {
        return Ok(false);
      }
    }
    Ok(true)
  }));


  config.exec()
}

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