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

add environment struct

parent 3821c684
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ ReturnCode document_load(
       *elem_config,
       doc->data,
       *doc,
       doc->env,
       &elem);

   if (!rc) {
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ struct Document {
  Document();
  Measure width;
  Measure height;
  Environment env;
  ColorScheme color_scheme;
  Color background_color;
  Color text_color;
+3 −0
Original line number Diff line number Diff line
@@ -34,12 +34,14 @@
#include <functional>
#include "plist/plist.h"
#include "utils/return_code.h"
#include "environment.h"

namespace plotfx {
struct Layer;
struct Rectangle;
struct Document;
struct DataContext;
struct Environment;

using plist::PropertyList;

@@ -53,6 +55,7 @@ using ElementConfigureAsFn = std::function<ReturnCode (
    const plist::PropertyList&,
    const DataContext&,
    const Document&,
    const Environment&,
    T*)>;

struct Element {
+2 −1
Original line number Diff line number Diff line
@@ -46,13 +46,14 @@ ReturnCode buildElement(
    const plist::PropertyList& plist,
    const DataContext& ctx,
    const Document& doc,
    const Environment& env,
    ElementRef* elem) {
  const auto& elem_entry = elems.find(name);
  if (elem_entry == elems.end()) {
    return ReturnCode::errorf("NOTFOUND", "no such element: $0", name);
  }

  return elem_entry->second(plist, ctx, doc, elem);
  return elem_entry->second(plist, ctx, doc, env, elem);
}

} // namespace plotfx
+3 −0
Original line number Diff line number Diff line
@@ -33,11 +33,13 @@

namespace plotfx {
struct Document;
struct Environment;

using ElementBuilder = std::function<ReturnCode (
    const plist::PropertyList&,
    const DataContext&,
    const Document&,
    const Environment&,
    ElementRef* elem)>;

template <typename T>
@@ -50,6 +52,7 @@ ReturnCode buildElement(
    const plist::PropertyList& plist,
    const DataContext& ctx,
    const Document& doc,
    const Environment& env,
    ElementRef* elem);

} // namespace plotfx
Loading