Commit bb887044 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

replace all calls to bind(...) with std::bind

parent 4872dcad
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ ReturnCode arrow_draw_default(
}

Arrow arrow_create_default() {
  return bind(&arrow_draw_default, _1, _2, _3, _4, _5);
  return std::bind(&arrow_draw_default, _1, _2, _3, _4, _5);
}

} // namespace clip
+6 −6
Original line number Diff line number Diff line
@@ -49,14 +49,14 @@ ReturnCode rectangle(
    {
      "color",
      expr_calln_fn({
        bind(&color_read, ctx, _1, &stroke_style.color),
        bind(&fill_style_read_solid, ctx, _1, &fill_style),
        std::bind(&color_read, ctx, _1, &stroke_style.color),
        std::bind(&fill_style_read_solid, ctx, _1, &fill_style),
      })
    },
    {"fill", bind(&fill_style_read, ctx, _1, &fill_style)},
    {"stroke-color", bind(&color_read, ctx, _1, &stroke_style.color)},
    {"stroke-width", bind(&measure_read, _1, &stroke_style.line_width)},
    {"stroke-style", bind(&stroke_style_read, ctx, _1, &stroke_style)},
    {"fill", std::bind(&fill_style_read, ctx, _1, &fill_style)},
    {"stroke-color", std::bind(&color_read, ctx, _1, &stroke_style.color)},
    {"stroke-width", std::bind(&measure_read, _1, &stroke_style.line_width)},
    {"stroke-style", std::bind(&stroke_style_read, ctx, _1, &stroke_style)},
  });

  if (!config_rc) {
+42 −42
Original line number Diff line number Diff line
@@ -490,78 +490,78 @@ ReturnCode plot_legend(
  auto config_rc = expr_walk_map_wrapped(expr, {
    {
      "position",
      bind(
      std::bind(
          &legend_configure_position,
          _1,
          &config->position_horiz,
          &config->position_vert)
    },
    {"item-row-padding", bind(&measure_read, _1, &config->item_row_padding)},
    {"item-column-padding", bind(&measure_read, _1, &config->item_column_padding)},
    {"item-flow", bind(&expr_to_switch, _1, &config->item_flow)},
    {"item", bind(&configure_item, ctx, _1, &config->items)},
    {"item-row-padding", std::bind(&measure_read, _1, &config->item_row_padding)},
    {"item-column-padding", std::bind(&measure_read, _1, &config->item_column_padding)},
    {"item-flow", std::bind(&expr_to_switch, _1, &config->item_flow)},
    {"item", std::bind(&configure_item, ctx, _1, &config->items)},
    {
      "padding",
      expr_calln_fn({
        bind(&measure_read, _1, &config->padding[0]),
        bind(&measure_read, _1, &config->padding[1]),
        bind(&measure_read, _1, &config->padding[2]),
        bind(&measure_read, _1, &config->padding[3]),
        std::bind(&measure_read, _1, &config->padding[0]),
        std::bind(&measure_read, _1, &config->padding[1]),
        std::bind(&measure_read, _1, &config->padding[2]),
        std::bind(&measure_read, _1, &config->padding[3]),
      })
    },
    {"padding-top", bind(&measure_read, _1, &config->padding[0])},
    {"padding-right", bind(&measure_read, _1, &config->padding[1])},
    {"padding-bottom", bind(&measure_read, _1, &config->padding[2])},
    {"padding-left", bind(&measure_read, _1, &config->padding[3])},
    {"padding-top", std::bind(&measure_read, _1, &config->padding[0])},
    {"padding-right", std::bind(&measure_read, _1, &config->padding[1])},
    {"padding-bottom", std::bind(&measure_read, _1, &config->padding[2])},
    {"padding-left", std::bind(&measure_read, _1, &config->padding[3])},
    {
      "margin",
      expr_calln_fn({
        bind(&measure_read, _1, &config->margins[0]),
        bind(&measure_read, _1, &config->margins[1]),
        bind(&measure_read, _1, &config->margins[2]),
        bind(&measure_read, _1, &config->margins[3]),
        std::bind(&measure_read, _1, &config->margins[0]),
        std::bind(&measure_read, _1, &config->margins[1]),
        std::bind(&measure_read, _1, &config->margins[2]),
        std::bind(&measure_read, _1, &config->margins[3]),
      })
    },
    {"margin-top", bind(&measure_read, _1, &config->margins[0])},
    {"margin-right", bind(&measure_read, _1, &config->margins[1])},
    {"margin-bottom", bind(&measure_read, _1, &config->margins[2])},
    {"margin-left", bind(&measure_read, _1, &config->margins[3])},
    {"margin-top", std::bind(&measure_read, _1, &config->margins[0])},
    {"margin-right", std::bind(&measure_read, _1, &config->margins[1])},
    {"margin-bottom", std::bind(&measure_read, _1, &config->margins[2])},
    {"margin-left", std::bind(&measure_read, _1, &config->margins[3])},
    {
      "border",
      expr_calln_fn({
        bind(&expr_to_stroke_style, _1, &config->borders[0]),
        bind(&expr_to_stroke_style, _1, &config->borders[1]),
        bind(&expr_to_stroke_style, _1, &config->borders[2]),
        bind(&expr_to_stroke_style, _1, &config->borders[3])
        std::bind(&expr_to_stroke_style, _1, &config->borders[0]),
        std::bind(&expr_to_stroke_style, _1, &config->borders[1]),
        std::bind(&expr_to_stroke_style, _1, &config->borders[2]),
        std::bind(&expr_to_stroke_style, _1, &config->borders[3])
      })
    },
    {
      "border-color",
      expr_calln_fn({
        bind(&color_read, ctx, _1, &config->borders[0].color),
        bind(&color_read, ctx, _1, &config->borders[1].color),
        bind(&color_read, ctx, _1, &config->borders[2].color),
        bind(&color_read, ctx, _1, &config->borders[3].color),
        std::bind(&color_read, ctx, _1, &config->borders[0].color),
        std::bind(&color_read, ctx, _1, &config->borders[1].color),
        std::bind(&color_read, ctx, _1, &config->borders[2].color),
        std::bind(&color_read, ctx, _1, &config->borders[3].color),
      })
    },
    {"border-top-color", bind(&color_read, ctx, _1, &config->borders[0].color)},
    {"border-right-color", bind(&color_read, ctx, _1, &config->borders[1].color)},
    {"border-bottom-color", bind(&color_read, ctx, _1, &config->borders[2].color)},
    {"border-left-color", bind(&color_read, ctx, _1, &config->borders[3].color)},
    {"border-top-color", std::bind(&color_read, ctx, _1, &config->borders[0].color)},
    {"border-right-color", std::bind(&color_read, ctx, _1, &config->borders[1].color)},
    {"border-bottom-color", std::bind(&color_read, ctx, _1, &config->borders[2].color)},
    {"border-left-color", std::bind(&color_read, ctx, _1, &config->borders[3].color)},
    {
      "border-width",
      expr_calln_fn({
        bind(&measure_read, _1, &config->borders[0].line_width),
        bind(&measure_read, _1, &config->borders[1].line_width),
        bind(&measure_read, _1, &config->borders[2].line_width),
        bind(&measure_read, _1, &config->borders[3].line_width),
        std::bind(&measure_read, _1, &config->borders[0].line_width),
        std::bind(&measure_read, _1, &config->borders[1].line_width),
        std::bind(&measure_read, _1, &config->borders[2].line_width),
        std::bind(&measure_read, _1, &config->borders[3].line_width),
      })
    },
    {"border-top-width", bind(&measure_read, _1, &config->borders[0].line_width)},
    {"border-right-width", bind(&measure_read, _1, &config->borders[1].line_width)},
    {"border-bottom-width", bind(&measure_read, _1, &config->borders[2].line_width)},
    {"border-left-width", bind(&measure_read, _1, &config->borders[3].line_width)},
    {"background", bind(&color_read_opt, ctx, _1, &config->background)},
    {"border-top-width", std::bind(&measure_read, _1, &config->borders[0].line_width)},
    {"border-right-width", std::bind(&measure_read, _1, &config->borders[1].line_width)},
    {"border-bottom-width", std::bind(&measure_read, _1, &config->borders[2].line_width)},
    {"border-left-width", std::bind(&measure_read, _1, &config->borders[3].line_width)},
    {"background", std::bind(&color_read_opt, ctx, _1, &config->background)},
  });

  if (!config_rc) {
+11 −11
Original line number Diff line number Diff line
@@ -187,8 +187,8 @@ ReturnCode legend_item_configure(

  /* parse exprerties */
  auto config_rc = expr_walk_map(expr, {
    {"font", expr_call_string_fn(bind(&font_load_best, _1, &config->label_font))},
    {"label", bind(&expr_to_string, _1, &config->label)},
    {"font", expr_call_string_fn(std::bind(&font_load_best, _1, &config->label_font))},
    {"label", std::bind(&expr_to_string, _1, &config->label)},
    {
      "label-align",
      expr_to_enum_fn<HAlign>(&config->label_align, {
@@ -196,11 +196,11 @@ ReturnCode legend_item_configure(
        {"right", HAlign::RIGHT},
      })
    },
    {"label-margin", bind(&measure_read, _1, &config->label_margin)},
    {"label-color", bind(&color_read, ctx, _1, &config->label_color)},
    {"label-font", expr_call_string_fn(bind(&font_load_best, _1, &config->label_font))},
    {"label-font-size", bind(&measure_read, _1, &config->label_font_size)},
    {"marker-shape", bind(&marker_configure, _1, &config->marker)},
    {"label-margin", std::bind(&measure_read, _1, &config->label_margin)},
    {"label-color", std::bind(&color_read, ctx, _1, &config->label_color)},
    {"label-font", expr_call_string_fn(std::bind(&font_load_best, _1, &config->label_font))},
    {"label-font-size", std::bind(&measure_read, _1, &config->label_font_size)},
    {"marker-shape", std::bind(&marker_configure, _1, &config->marker)},
    {
      "marker-align",
      expr_to_enum_fn<HAlign>(&config->marker_align, {
@@ -208,10 +208,10 @@ ReturnCode legend_item_configure(
        {"right", HAlign::RIGHT},
      })
    },
    {"marker-margin", bind(&measure_read, _1, &config->marker_margin)},
    {"marker-color", bind(&color_read, ctx, _1, &config->marker_color)},
    {"marker-size", bind(&measure_read, _1, &config->marker_size)},
    {"color", bind(&color_read, ctx, _1, &config->marker_color)},
    {"marker-margin", std::bind(&measure_read, _1, &config->marker_margin)},
    {"marker-color", std::bind(&color_read, ctx, _1, &config->marker_color)},
    {"marker-size", std::bind(&measure_read, _1, &config->marker_size)},
    {"color", std::bind(&color_read, ctx, _1, &config->marker_color)},
  });

  if (!config_rc) {
+1 −1
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ ReturnCode font_get_glyph_path(
}

ReturnCode font_load(const std::string& font_file, FontRef* font_ref) {
  auto font = FontRef(new FontStorage, bind(&font_close, _1));
  auto font = FontRef(new FontStorage, std::bind(&font_close, _1));

  if (FT_Init_FreeType(&font->ft) != 0) {
    return ERROR;
Loading