7#ifndef MYGUI_FLOW_DIRECTION_H_
8#define MYGUI_FLOW_DIRECTION_H_
29 FlowDirection(Enum _value = LeftToRight) :
34 static FlowDirection parse(std::string_view _value)
40 std::string_view name = type.getValueName(value);
41 if (name.empty() || name == _value)
45 type.mValue =
static_cast<Enum>(value);
49 bool isHorizontal()
const
51 return mValue == LeftToRight || mValue == RightToLeft;
54 bool isVertical()
const
56 return !isHorizontal();
59 friend bool operator==(FlowDirection
const& a, FlowDirection
const& b)
61 return a.mValue == b.mValue;
64 friend bool operator!=(FlowDirection
const& a, FlowDirection
const& b)
66 return a.mValue != b.mValue;
69 friend std::ostream& operator<<(std::ostream& _stream,
const FlowDirection& _value)
71 _stream << _value.getValueName(_value.mValue);
75 friend std::istream& operator>>(std::istream& _stream, FlowDirection& _value)
79 _value = parse(value);
83 std::string_view print()
const
85 return getValueName(mValue);
94 std::string_view getValueName(
int _index)
const
96 if (_index < 0 || _index >= MAX)
98 static const std::string_view values[MAX] = {
"LeftToRight",
"RightToLeft",
"TopToBottom",
"BottomToTop"};
99 return values[_index];