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

Merge branch 'master' of github.com:asmuth/signaltk-dev

parents d4f4cf01 56de3c98
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ cmake_install.cmake
*.so
*.dll
*.dylib
/signaltk
/plotfx
/.ninja_deps
/.ninja_log
/*.ninja
+8 −7
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 2.8.8)
project(signaltk)
project(plotfx)
enable_testing()

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/extra/cmake")
set(CMAKE_CXX_STANDARD 17)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/toolkit)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/core)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

find_package(Threads)
@@ -16,7 +16,9 @@ include_directories(${CAIRO_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS} ${HARFBUZZ_IN

add_definitions(-DFNORDMETRIC_VERSION="unstable")

add_library(signaltk STATIC
add_library(plotfx STATIC
    core/plist/plist.cc
    core/plist/plist_parser.cc
    graphics/path.cc
    graphics/brush.cc
    graphics/colour.cc
@@ -28,7 +30,6 @@ add_library(signaltk STATIC
    graphics/rasterize.cc
    graphics/png.cc
    elements/element_factory.cc
    elements/element_spec_parser.cc
    elements/element_tree.cc
    elements/plot/gridlines.cc
    elements/plot/plot_axis.cc
@@ -53,11 +54,11 @@ add_library(signaltk STATIC
    utils/ISO8601.cc
    utils/UTF8.cc
    utils/wallclock.cc
    signaltk_cmd.cc)
    plotfx_cmd.cc)

set(SIGNALTK_LDFLAGS signaltk ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES} ${HARFBUZZ_ICU_LIBRARIES} ${PNG_LIBRARIES})
set(SIGNALTK_LDFLAGS plotfx ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES} ${HARFBUZZ_ICU_LIBRARIES} ${PNG_LIBRARIES})

add_executable(plotfx platform/signaltk_cli.cc)
add_executable(plotfx platform/plotfx_cli.cc)
target_link_libraries(plotfx ${SIGNALTK_LDFLAGS})

file(GLOB unit_test_files "testing/**/test_*.cc")
+0 −2
Original line number Diff line number Diff line
@@ -29,8 +29,6 @@ To run the test suite, run `make check`:
License
-------

    The plotfx License (BSD-3-Clause)

    Copyright (c) 2018, Paul Asmuth, Laura Schlimmer
    All rights reserved.

+12 −6
Original line number Diff line number Diff line
@@ -31,22 +31,28 @@
#include <unordered_map>
#include "utils/return_code.h"

namespace signaltk {
namespace plotfx {

template <typename T>
using PropertyDefinitions = std::unordered_map<
    std::string,
    std::function<ReturnCode (const std::string&, T*)>>;
    std::function<ReturnCode (const plist::Property&, T*)>>;

template<typename T>
ReturnCode configureProperties(
    const PropertyList& plist,
    const PropertyDefinitions<T>& pdefs,
    T* config) {
  for (const auto& prop : plist.properties) {
    const auto& pdef = pdefs.find(prop.first);
  for (const auto& prop : plist) {
    const auto& pdef = pdefs.find(prop.name);
    if (pdef != pdefs.end()) {
      if (auto rc = pdef->second(prop.second, config); !rc.isSuccess()) {
      if (auto rc = pdef->second(prop, config); !rc.isSuccess()) {
        return ReturnCode::errorf(
            "EPARSE",
            "error while parsing property '$0': $1",
            prop.name,
            rc.getMessage());

        return rc;
      }
    }
@@ -72,5 +78,5 @@ ReturnCode parseEnum(
  return ReturnCode::success();
}

} // namespace signaltk
} // namespace plotfx

core/plist/plist.cc

0 → 100644
+34 −0
Original line number Diff line number Diff line
/**
 * This file is part of the "FnordMetric" project
 *   Copyright (c) 2018 Paul Asmuth
 *
 * FnordMetric is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License v3.0. You should have received a
 * copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
#include <assert.h>
#include "plist.h"

namespace plist {

PropertyValue::operator const std::string&() const {
  return data;
}

const PropertyValue& Property::get(size_t i) const {
  assert(i < values.size());
  return values[i];
}

const PropertyValue& Property::operator[](size_t i) const {
  assert(i < values.size());
  return values[i];
}

size_t Property::size() const {
  return values.size();
}

} // namespace plist
Loading