30 #include YFM_YSLib_UI_Loader
32 #include YFM_YSLib_UI_YPanel
33 #include YFM_NPL_SContext
34 #include YFM_NPL_Configuration
45 std::istringstream iss(str);
48 for(
size_t i(0); i < 4; ++i)
52 throw std::invalid_argument(
"Parse 'Rect' failed: bad state.");
54 if(buf[2] < 0 || buf[3] < 0)
55 throw std::invalid_argument(
"Parse 'Rect' failed: underflow.");
57 Rect res(buf[0], buf[1], buf[2], buf[3]);
70 const auto& p(AccessChild<shared_ptr<IWidget>>(node,
"$pointer"));
76 catch(std::out_of_range&)
88 const auto& type_str(AccessChild<string>(node,
"$type"));
90 if(
const auto* p_bounds_str = AccessChildPtr<string>(node,
"$bounds"))
95 return Bounds.Call(type_str, bounds);
97 catch(std::invalid_argument&)
119 const auto& key(AccessChild<string>(node,
"$type"));
120 const bool ins(
Insert.Contains(key));
125 auto p_con(make_unique<ValueNode::Container>());
127 for(
const auto& vn : node)
133 auto&
wgt(*AccessChild<shared_ptr<IWidget>>(child,
135 const auto p_z(AccessChildPtr<string>(vn,
"$z"));
141 const auto r(std::stoul(*p_z));
147 catch(std::invalid_argument&)
149 if(p_con->insert(std::move(child)).second)
151 if(insz && (p_z || !ins))
161 res += {0,
"$children", std::move(p_con),
PointerTag()};
163 res += {0,
"$pointer", shared_ptr<IWidget>(std::move(p_new_widget))};
GWidgetInserterRegister< IWidget & > Insert
unique_ptr< IWidget > DetectWidgetNode(const ValueNode &)
GWidgetInserterRegister< IWidget &, const ZOrderType & > InsertZOrdered
YF_API ValueNode LoadNPLA1(ValueNode &&)
读取 NPLA1 翻译单元。
ValueNode TransformUILayout(const ValueNode &)
YF_API void Analyze(ValueNode &, const TokenList &)
分析指定源,取抽象语法树储存至指定值类型节点。
#define YAssertNonnull(_expr)
GWidgetRegister< const Rect & > Bounds
IWidget & AccessWidget(const ValueNode &node, const string &name, _tParams &&...args)
const ZOrderType DefaultZOrder(64)
默认 Z 顺序值。
std::string to_string(unsigned char val)
转换为字符串。
#define YTraceDe(...)
YCLib 默认调试跟踪。
YF_API Rect ParseRect(const string &)
bool CheckChildName(const string &str)
ValueNode LoadUILayout(const string &)