Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Generate parse_markup function
Browse files Browse the repository at this point in the history
  • Loading branch information
EPashkin committed Jul 8, 2017
1 parent 567cdba commit b4e0d07
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ manual = [
"Pango.AttrClass",
"Pango.Language",
"Pango.Rectangle",
"GLib.Error",
]

[[object]]
Expand Down
17 changes: 13 additions & 4 deletions src/auto/functions.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// This file was generated by gir (9e3f4cc) from gir-files (0bcaef9)
// DO NOT EDIT

use AttrList;
use Direction;
use Error;
use Rectangle;
use Stretch;
use Style;
Expand Down Expand Up @@ -96,7 +98,7 @@ pub fn is_zero_width(ch: char) -> bool {
//}

//#[cfg(feature = "v1_31")]
//pub fn markup_parser_finish(context: /*Ignored*/&glib::MarkupParseContext, error: /*Ignored*/Option<Error>) -> Result<(AttrList, String, char), Error> {
//pub fn markup_parser_finish(context: /*Ignored*/&glib::MarkupParseContext) -> Result<(AttrList, String, char), Error> {
// unsafe { TODO: call ffi::pango_markup_parser_finish() }
//}

Expand All @@ -120,9 +122,16 @@ pub fn parse_enum<'a, P: Into<Option<&'a str>>>(type_: glib::types::Type, str: P
}
}

//pub fn parse_markup(markup_text: &str, length: i32, accel_marker: char, error: /*Ignored*/Option<Error>) -> Result<(AttrList, String, char), Error> {
// unsafe { TODO: call ffi::pango_parse_markup() }
//}
pub fn parse_markup(markup_text: &str, length: i32, accel_marker: char) -> Result<(AttrList, String, char), Error> {
unsafe {
let mut attr_list = ptr::null_mut();
let mut text = ptr::null_mut();
let mut accel_char = mem::uninitialized();
let mut error = ptr::null_mut();
let _ = ffi::pango_parse_markup(markup_text.to_glib_none().0, length, accel_marker.to_glib(), &mut attr_list, &mut text, &mut accel_char, &mut error);
if error.is_null() { Ok((from_glib_full(attr_list), from_glib_full(text), from_glib(accel_char))) } else { Err(from_glib_full(error)) }
}
}

pub fn parse_stretch(str: &str, warn: bool) -> Option<Stretch> {
unsafe {
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ extern crate glib;
extern crate bitflags;
extern crate libc;

pub use glib::Error;

mod auto;
pub use auto::*;
pub use auto::functions::*;
Expand Down

0 comments on commit b4e0d07

Please sign in to comment.