OpenPine C++ API
C++ wrapper for the OpenPine Pine Script VM
Loading...
Searching...
No Matches
line.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#if (defined(_MSVC_LANG) ? _MSVC_LANG : __cplusplus) < 201703L
9#error \
10 "OpenPine C++ wrapper headers require C++17 (std::optional, std::string_view)."
11#endif
12
13#include <cstdint>
14#include <optional>
15
16#include "../ffi.hpp"
17#include "../types.hpp"
18
19namespace openpine {
20namespace graph {
21
25class Line {
26 private:
27 const ffi::Line* p_;
28
29 public:
30 Line(const ffi::Line* p) : p_(p) {}
31
35 int64_t x1() const { return ffi::lineX1(p_); }
36
40 double y1() const { return ffi::lineY1(p_); }
41
45 int64_t x2() const { return ffi::lineX2(p_); }
46
50 double y2() const { return ffi::lineY2(p_); }
51
55 XLocation xloc() const { return ffi::lineXloc(p_); }
56
60 Extend extend() const { return ffi::lineExtend(p_); }
61
65 std::optional<uint32_t> color() const {
66 uint32_t v;
67 if (ffi::lineColor(p_, &v)) {
68 return v;
69 } else {
70 return std::nullopt;
71 }
72 }
73
77 LineStyle style() const { return ffi::lineStyle(p_); }
78
82 int32_t width() const { return ffi::lineWidth(p_); }
83
87 bool forceOverlay() const { return ffi::lineForceOverlay(p_); }
88};
89
90} // namespace graph
91} // namespace openpine
Extend extend() const
Gets the extend mode.
Definition line.hpp:60
LineStyle style() const
Gets the stroke style.
Definition line.hpp:77
XLocation xloc() const
Gets the X-axis coordinate system used by x1()/x2().
Definition line.hpp:55
double y1() const
Gets the first Y coordinate.
Definition line.hpp:40
Line(const ffi::Line *p)
Definition line.hpp:30
int32_t width() const
Gets the stroke width.
Definition line.hpp:82
int64_t x1() const
Gets the first X coordinate.
Definition line.hpp:35
std::optional< uint32_t > color() const
Gets the optional stroke color.
Definition line.hpp:65
bool forceOverlay() const
Gets whether the line is forced to render as overlay.
Definition line.hpp:87
double y2() const
Gets the second Y coordinate.
Definition line.hpp:50
int64_t x2() const
Gets the second X coordinate.
Definition line.hpp:45
Re-exports FFI types into the openpine namespace.