#pragma once #include #include #include #include #include #include namespace mln { struct AnchorOffsetPair { style::SymbolAnchorType anchorType; std::array offset; AnchorOffsetPair(style::SymbolAnchorType anchorType_, std::array offset_) : anchorType(anchorType_), offset(offset_) {} bool operator==(const AnchorOffsetPair& other) const = default; }; class VariableAnchorOffsetCollection { private: using CollectionType = std::vector; CollectionType anchorOffsets; public: VariableAnchorOffsetCollection() = default; VariableAnchorOffsetCollection(const VariableAnchorOffsetCollection& other) = default; VariableAnchorOffsetCollection(VariableAnchorOffsetCollection&& other) noexcept = default; VariableAnchorOffsetCollection(std::vector&& values) { anchorOffsets = std::move(values); } std::array getOffsetByAnchor(const style::SymbolAnchorType& anchorType) const; std::string toString() const; mln::Value serialize() const; bool empty() const { return anchorOffsets.size() == 0; } CollectionType::size_type size() const { return anchorOffsets.size(); } CollectionType::const_iterator begin() const { return anchorOffsets.begin(); } CollectionType::const_iterator end() const { return anchorOffsets.end(); } const AnchorOffsetPair& operator[](size_t index) const { return anchorOffsets[index]; } VariableAnchorOffsetCollection& operator=(const VariableAnchorOffsetCollection& other) = default; VariableAnchorOffsetCollection& operator=(VariableAnchorOffsetCollection&& other) noexcept = default; bool operator==(const VariableAnchorOffsetCollection& other) const = default; }; } // namespace mln