YSTest: ValueNode.h 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

ValueNode.h
浏览该文件的文档.
1 /*
2 © 2012-2017 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_Core_ValueNode_h_
29 #define YSL_INC_Core_ValueNode_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_Core_YObject // for ystdex::invoke;
33 #include <ystdex/path.hpp>
34 #include <ystdex/set.hpp> // for ystdex::mapped_set;
35 #include <numeric> // for std::accumulate;
36
37 namespace YSLib
38 {
39
41
42 yconstexpr const struct ListContainerTag{} ListContainer{};
44
46 yconstexpr const struct NoContainerTag{} NoContainer{};
48
49
58 class YF_API ValueNode : private ystdex::totally_ordered<ValueNode>,
59 private ystdex::totally_ordered<ValueNode, string>
60 {
61 public:
62 using Container = ystdex::mapped_set<ValueNode, ystdex::less<>>;
64 using key_type = typename Container::key_type;
66 using iterator = Container::iterator;
68 using const_iterator = Container::const_iterator;
70 using reverse_iterator = Container::reverse_iterator;
72 using const_reverse_iterator = Container::const_reverse_iterator;
73
74 private:
75 string name{};
80 Container container{};
81
82 public:
84 ValueObject Value{};
85
86 DefDeCtor(ValueNode)
91 ValueNode(Container con)
92 : container(std::move(con))
93 {}
99 template<typename _tString, typename... _tParams>
100 inline
101 ValueNode(NoContainerTag, _tString&& str, _tParams&&... args)
102 : name(yforward(str)), Value(yforward(args)...)
103 {}
108 template<typename _tString, typename... _tParams>
109 ValueNode(Container con, _tString&& str, _tParams&&... args)
110 : name(yforward(str)), container(std::move(con)),
111 Value(yforward(args)...)
112 {}
117 template<typename _tIn>
118 inline
119 ValueNode(const pair<_tIn, _tIn>& pr)
120 : container(pr.first, pr.second)
121 {}
126 template<typename _tIn, typename _tString>
127 inline
128 ValueNode(const pair<_tIn, _tIn>& pr, _tString&& str)
129 : name(yforward(str)), container(pr.first, pr.second)
130 {}
136 template<typename... _tParams1>
137 inline
138 ValueNode(tuple<_tParams1...> args1)
139 : container(ystdex::make_from_tuple<Container>(args1))
140 {}
141 template<typename... _tParams1, typename... _tParams2>
142 inline
143 ValueNode(tuple<_tParams1...> args1, tuple<_tParams2...> args2)
144 : name(ystdex::make_from_tuple<string>(args2)),
145 container(ystdex::make_from_tuple<Container>(args1))
146 {}
147 template<typename... _tParams1, typename... _tParams2,
148 typename... _tParams3>
149 inline
150 ValueNode(tuple<_tParams1...> args1, tuple<_tParams2...> args2,
151 tuple<_tParams3...> args3)
152 : name(ystdex::make_from_tuple<string>(args2)),
153 container(ystdex::make_from_tuple<Container>(args1)),
154 Value(ystdex::make_from_tuple<ValueObject>(args3))
155 {}
157
158 DefDeCopyMoveCtor(ValueNode)
159
160
161
162 PDefHOp(ValueNode&, =, const ValueNode& node)
164 ImplRet(ystdex::copy_and_swap(*this, node))
165 DefDeMoveAssignment(ValueNode)
167
169 DefBoolNeg(explicit, bool(Value) || !container.empty())
170
172
173 PDefHOp(const ValueNode&, +=, const ValueNode& node)
174 ImplRet(Add(node), *this)
175 PDefHOp(const ValueNode&, +=, ValueNode&& node)
176 ImplRet(Add(std::move(node)), *this)
177
178 PDefHOp(const ValueNode&, -=, const ValueNode& node)
179 ImplRet(Remove(node), *this)
180 PDefHOp(const ValueNode&, -=, const string& str)
181 ImplRet(Remove(str), *this)
187 PDefHOp(ValueNode&, /=, const ValueNode& node)
188 ImplRet(*this %= node, *this)
189 PDefHOp(ValueNode&, /=, ValueNode&& node)
190 ImplRet(*this %= std::move(node), *this)
192
198 ValueNode&
199 operator%=(const ValueNode&);
200 ValueNode&
201 operator%=(ValueNode&&);
203
204
206 friend PDefHOp(bool, ==, const ValueNode& x, const ValueNode& y) ynothrow
207 ImplRet(x.name == y.name)
209 friend PDefHOp(bool, ==, const ValueNode& x, const string& str) ynothrow
210 ImplRet(x.name == str)
212 template<typename _tKey>
213 friend bool
214 operator==(const ValueNode& x, const _tKey& str) ynothrow
215 {
216 return x.name == str;
217 }
218
220 friend PDefHOp(bool, <, const ValueNode& x, const ValueNode& y) ynothrow
221 ImplRet(x.name < y.name)
223 friend PDefHOp(bool, <, const ValueNode& x, const string& str) ynothrow
224 ImplRet(x.name < str)
226 template<typename _tKey>
227 friend bool
228 operator<(const ValueNode& x, const _tKey& str) ynothrow
229 {
230 return x.name < str;
231 }
233 template<typename _tKey>
234 friend bool
235 operator<(const _tKey& str, const ValueNode& y) ynothrow
236 {
237 return str < y.name;
238 }
240 friend PDefHOp(bool, >, const ValueNode& x, const string& str) ynothrow
241 ImplRet(x.name > str)
243 template<typename _tKey>
244 friend bool
245 operator>(const ValueNode& x, const _tKey& str) ynothrow
246 {
247 return x.name > str;
248 }
250 template<typename _tKey>
251 friend bool
252 operator>(const _tKey& str, const ValueNode& y) ynothrow
253 {
254 return str > y.name;
255 }
256
258 template<typename _tString>
259 ValueNode&
260 operator[](_tString&& str)
261 {
262 return *ystdex::try_emplace(container, str, NoContainer, yforward(str))
263 .first;
264 }
266 template<class _tCon>
267 ValueNode&
268 operator[](const ystdex::path<_tCon>& pth)
269 {
270 auto p(this);
271
272 for(const auto& n : pth)
273 p = &(*p)[n];
274 return *p;
275 }
276
281 DefGetter(const ynothrow, const Container&, Container, container)
286 DefGetter(ynothrow, Container&, ContainerRef, container)
287 DefGetter(const ynothrow, const string&, Name, name)
288
299 PDefH(void, SetChildren, const Container& con)
300 ImplExpr(container = con)
301 PDefH(void, SetChildren, Container&& con)
302 ImplExpr(container = std::move(con))
304 PDefH(void, SetChildren, ValueNode&& node)
305 ImplExpr(container = std::move(node.container))
307
313 template<class _tCon, class _tValue>
315 yimpl(ystdex::enable_if_t)<
316 ystdex::and_<std::is_assignable<Container, _tCon&&>,
317 std::is_assignable<ValueObject, _tValue&&>>::value>
318 SetContent(_tCon&& con, _tValue&& val) ynoexcept(ystdex::and_<
319 std::is_nothrow_assignable<Container, _tCon&&>,
320 std::is_nothrow_assignable<ValueObject, _tValue&&>>())
321 {
322 yunseq(container = yforward(con), Value = yforward(val));
323 }
324 PDefH(void, SetContent, const ValueNode& node)
325 ImplExpr(SetContent(node.GetContainer(), node.Value))
326 PDefH(void, SetContent, ValueNode&& node)
327 ImplExpr(SwapContent(node))
329
330
332 PDefH(bool, Add, const ValueNode& node)
333 ImplRet(insert(node).second)
335 PDefH(bool, Add, ValueNode&& node)
336 ImplRet(insert(std::move(node)).second)
337
343
345 template<typename _tKey>
346 bool
347 AddChild(_tKey&& k, const ValueNode& node)
348 {
349 return
350 try_emplace(k, node.GetContainer(), yforward(k), node.Value).second;
351 }
352 template<typename _tKey>
353 bool
354 AddChild(_tKey&& k, ValueNode&& node)
355 {
356 return try_emplace(k, std::move(node.GetContainerRef()), yforward(k),
357 std::move(node.Value)).second;
358 }
360
362 template<typename _tKey>
363 void
364 AddChild(const_iterator hint, _tKey&& k, const ValueNode& node)
365 {
366 return try_emplace_hint(hint, k, node.GetContainer(), yforward(k),
367 node.Value);
368 }
369 template<typename _tKey>
370 void
371 AddChild(const_iterator hint, _tKey&& k, ValueNode&& node)
372 {
373 return try_emplace_hint(hint, k, std::move(node.GetContainerRef()),
374 yforward(k), std::move(node.Value));
375 }
377
378
384 template<typename _tKey, typename... _tParams>
386 inline bool
387 AddValue(_tKey&& k, _tParams&&... args)
388 {
389 return
390 try_emplace(k, NoContainer, yforward(k), yforward(args)...).second;
391 }
393 template<typename _tKey, typename... _tParams>
394 inline bool
395 AddValue(const_iterator hint, _tKey&& k, _tParams&&... args)
396 {
397 return try_emplace_hint(hint, k, NoContainer, yforward(k),
398 yforward(args)...).second;
399 }
401
407 template<typename _tString, typename... _tParams>
408 static bool
409 AddValueTo(Container& con, _tString&& str, _tParams&&... args)
410 {
411 return ystdex::try_emplace(con, str,
412 NoContainer, yforward(str), yforward(args)...).second;
413 }
414
416
417
422 PDefH(void, Clear, ) ynothrow
423 ImplExpr(Value.Clear(), ClearContainer())
424
430 PDefH(void, ClearTo, const ValueObject& vo) ynothrow
431 ImplExpr(ClearContainer(), Value = vo)
432 PDefH(void, ClearTo, ValueObject&& vo) ynothrow
433 ImplExpr(ClearContainer(), Value = std::move(vo))
435
436
442 PDefH(void, ClearContainer, ) ynothrow
443 ImplExpr(container.clear())
444
446
447 static Container
449 CreateRecursively(const Container&, IValueHolder::Creation);
451 template<typename _fCallable>
452 static Container
453 CreateRecursively(Container& con, _fCallable f)
454 {
455 Container res;
456
457 for(auto& tm : con)
458 res.emplace(CreateRecursively(tm.GetContainerRef(), f),
459 tm.GetName(), ystdex::invoke(f, tm.Value));
460 return res;
461 }
463 template<typename _fCallable>
464 static Container
465 CreateRecursively(const Container& con, _fCallable f)
466 {
467 Container res;
468
469 for(auto& tm : con)
470 res.emplace(CreateRecursively(tm.GetContainer(), f), tm.GetName(),
471 ystdex::invoke(f, tm.Value));
472 return res;
473 }
474
476 PDefH(Container, CreateWith, IValueHolder::Creation c) const
477 ImplRet(CreateRecursively(container, c))
479 template<typename _fCallable>
480 Container
481 CreateWith(_fCallable f)
482 {
483 return CreateRecursively(container, f);
484 }
486 template<typename _fCallable>
487 Container
488 CreateWith(_fCallable f) const
489 {
490 return CreateRecursively(container, f);
491 }
493
499
501
505 template<typename _type, typename _tString, typename... _tParams>
506 inline _type&
507 Place(_tString&& str, _tParams&&... args)
508 {
509 return PlaceValue<_type>(yforward(str), yforward(args)...).template
510 Access<_type>();
511 }
512
517 template<typename _type, typename _tString, typename... _tParams>
518 inline _type&
519 PlaceUnchecked(_tString&& str, _tParams&&... args)
520 {
521 return PlaceValue<_type>(yforward(str), yforward(args)...).template
522 GetObject<_type>();
523 }
525
527 template<typename _type, typename _tString, typename... _tParams>
528 inline ValueObject&
529 PlaceValue(_tString&& str, _tParams&&... args)
530 {
531 return try_emplace(str, NoContainer, yforward(str),
532 ystdex::in_place<_type>, yforward(args)...).first->Value;
533 }
535
536 PDefH(bool, Remove, const ValueNode& node)
537 ImplRet(erase(node) != 0)
539 PDefH(iterator, Remove, const_iterator i)
540 ImplRet(erase(i))
542 template<typename _tKey, yimpl(typename = ystdex::enable_if_t<
543 ystdex::is_interoperable<const _tKey&, const string&>::value>)>
544 inline bool
545 Remove(const _tKey& k)
546 {
547 return ystdex::erase_first(container, k);
548 }
549
554 template<typename _func>
555 Container
556 SelectChildren(_func f) const
557 {
558 Container res;
559
560 ystdex::for_each_if(begin(), end(), f, [&](const ValueNode& nd){
561 res.insert(nd);
562 });
563 return res;
564 }
565
567
568 template<typename _func>
570 Container
571 SplitChildren(_func f)
572 {
573 Container res;
574
575 std::for_each(begin(), end(), [&](const ValueNode& nd){
576 res.emplace(NoContainer, nd.GetName());
577 });
578 ystdex::for_each_if(begin(), end(), f, [&, this](const ValueNode& nd){
579 const auto& child_name(nd.GetName());
580
581 Deref(res.find(child_name)).Value = std::move(nd.Value);
582 Remove(child_name);
583 });
584 return res;
585 }
586
588
589 PDefH(void, SwapContainer, ValueNode& node) ynothrow
591 ImplExpr(container.swap(node.container))
592
594 void
595 SwapContent(ValueNode&) ynothrow;
597
598
604 YB_NORETURN static void
605 ThrowIndexOutOfRange();
606
612 YB_NORETURN static void
613 ThrowWrongNameFound();
614
616
617 PDefH(iterator, begin, )
618 ImplRet(GetContainerRef().begin())
619 PDefH(const_iterator, begin, ) const
620 ImplRet(GetContainer().begin())
621
623 DefFwdTmpl(, pair<iterator YPP_Comma bool>, emplace,
624 container.emplace(yforward(args)...))
625
627 DefFwdTmpl(, iterator, emplace_hint,
628 container.emplace_hint(yforward(args)...))
629
631 PDefH(bool, empty, ) const ynothrow
632 ImplRet(container.empty())
633
634 PDefH(iterator, end, )
635 ImplRet(GetContainerRef().end())
636 PDefH(const_iterator, end, ) const
637 ImplRet(GetContainer().end())
639
641 DefFwdTmpl(-> decltype(container.erase(yforward(args)...)), auto,
642 erase, container.erase(yforward(args)...))
643
645 DefFwdTmpl(-> decltype(container.insert(yforward(args)...)), auto,
646 insert, container.insert(yforward(args)...))
647
649
650 template<typename _tKey, class _tParam>
651 yimpl(ystdex::enable_if_inconvertible_t)<_tKey&&, const_iterator,
652 std::pair<iterator, bool>>
653 insert_or_assign(_tKey&& k, _tParam&& arg)
654 {
655 return ystdex::insert_or_assign(container, yforward(k), yforward(arg));
656 }
657 template<typename _tKey, class _tParam>
658 iterator
659 insert_or_assign(const_iterator hint, _tKey&& k, _tParam&& arg)
660 {
661 return ystdex::insert_or_assign_hint(container, hint, yforward(k),
662 yforward(arg));
663 }
665
667
668 PDefH(reverse_iterator, rbegin, )
669 ImplRet(GetContainerRef().rbegin())
670 PDefH(const_reverse_iterator, rbegin, ) const
671 ImplRet(GetContainer().rbegin())
672
673 PDefH(reverse_iterator, rend, )
674 ImplRet(GetContainerRef().rend())
675 PDefH(const_reverse_iterator, rend, ) const
676 ImplRet(GetContainer().rend())
678
684 friend PDefH(ValueNode, set_value_move, ValueNode& node)
685 ImplRet({std::move(node.GetContainerRef()), node.GetName(),
686 std::move(node.Value)})
687
689 PDefH(size_t, size, ) const ynothrow
690 ImplRet(container.size())
691
696 YF_API friend void
697 swap(ValueNode&, ValueNode&) ynothrow;
698
700 template<typename _tKey, typename... _tParams>
701 yimpl(ystdex::enable_if_inconvertible_t)<_tKey&&, const_iterator,
702 std::pair<iterator, bool>>
703 try_emplace(_tKey&& k, _tParams&&... args)
704 {
705 return ystdex::try_emplace(container, yforward(k), yforward(args)...);
706 }
708 template<typename _tKey, typename... _tParams>
709 iterator
710 try_emplace(const_iterator hint, _tKey&& k, _tParams&&... args)
711 {
712 return ystdex::try_emplace_hint(container, hint, yforward(k),
713 yforward(args)...);
714 }
715 };
716
718
719
721
726 template<typename _type>
727 inline _type&
728 Access(ValueNode& node)
729 {
730 return node.Value.Access<_type>();
731 }
732 template<typename _type>
733 inline const _type&
734 Access(const ValueNode& node)
735 {
736 return node.Value.Access<_type>();
737 }
739
741
742
744 template<typename _type>
745 inline observer_ptr<_type>
746 AccessPtr(ValueNode& node) ynothrow
747 {
748 return node.Value.AccessPtr<_type>();
749 }
750 template<typename _type>
751 inline observer_ptr<const _type>
752 AccessPtr(const ValueNode& node) ynothrow
753 {
754 return node.Value.AccessPtr<_type>();
755 }
757
762 template<typename _type, typename _tNodeOrPointer>
763 inline auto
764 AccessPtr(observer_ptr<_tNodeOrPointer> p) ynothrow
765 -> decltype(YSLib::AccessPtr<_type>(*p))
766 {
767 return p ? YSLib::AccessPtr<_type>(*p) : nullptr;
768 }
770
771
772
774
775 YF_API ValueObject
777 GetValueOf(observer_ptr<const ValueNode>);
778
780 YF_API observer_ptr<const ValueObject>
781 GetValuePtrOf(observer_ptr<const ValueNode>);
783
784
785
787
788 template<typename _tKey>
789 observer_ptr<ValueNode>
790 AccessNodePtr(ValueNode::Container*, const _tKey&) ynothrow;
791 template<typename _tKey>
792 observer_ptr<const ValueNode>
793 AccessNodePtr(const ValueNode::Container*, const _tKey&) ynothrow;
794
800 YF_API ValueNode&
802 AccessNode(ValueNode::Container*, const string&);
804 YF_API const ValueNode&
805 AccessNode(const ValueNode::Container*, const string&);
806 template<typename _tKey>
807 ValueNode&
808 AccessNode(ValueNode::Container* p_con, const _tKey& name)
809 {
810 if(const auto p = YSLib::AccessNodePtr(p_con, name))
811 return *p;
812 ValueNode::ThrowWrongNameFound();
813 }
814 template<typename _tKey>
815 const ValueNode&
816 AccessNode(const ValueNode::Container* p_con, const _tKey& name)
817 {
818 if(const auto p = YSLib::AccessNodePtr(p_con, name))
819 return *p;
820 ValueNode::ThrowWrongNameFound();
821 }
822 template<typename _tKey>
823 inline ValueNode&
824 AccessNode(observer_ptr<ValueNode::Container> p_con, const _tKey& name)
825 {
826 return YSLib::AccessNode(p_con.get(), name);
827 }
828 template<typename _tKey>
829 inline const ValueNode&
830 AccessNode(observer_ptr<const ValueNode::Container> p_con, const _tKey& name)
831 {
832 return YSLib::AccessNode(p_con.get(), name);
833 }
834 template<typename _tKey>
835 inline ValueNode&
836 AccessNode(ValueNode::Container& con, const _tKey& name)
837 {
838 return YSLib::AccessNode(&con, name);
839 }
840 template<typename _tKey>
841 inline const ValueNode&
842 AccessNode(const ValueNode::Container& con, const _tKey& name)
843 {
844 return YSLib::AccessNode(&con, name);
845 }
851 YF_API ValueNode&
852 AccessNode(ValueNode&, size_t);
853 YF_API const ValueNode&
854 AccessNode(const ValueNode&, size_t);
856 template<typename _tKey, yimpl(typename = typename ystdex::enable_if_t<
857 ystdex::is_interoperable<const _tKey&, const string&>::value>)>
858 inline ValueNode&
859 AccessNode(ValueNode& node, const _tKey& name)
860 {
861 return YSLib::AccessNode(node.GetContainerRef(), name);
862 }
863 template<typename _tKey, yimpl(typename = typename ystdex::enable_if_t<
864 ystdex::is_interoperable<const _tKey&, const string&>::value>)>
865 inline const ValueNode&
866 AccessNode(const ValueNode& node, const _tKey& name)
867 {
868 return YSLib::AccessNode(node.GetContainer(), name);
869 }
871
872 template<class _tNode, typename _tIn>
874 _tNode&&
875 AccessNode(_tNode&& node, _tIn first, _tIn last)
876 {
877 return std::accumulate(first, last, ystdex::ref(node),
878 [](_tNode&& nd, decltype(*first) c){
879 return ystdex::ref(AccessNode(nd, c));
880 });
881 }
883 template<class _tNode, typename _tRange,
884 yimpl(typename = typename ystdex::enable_if_t<
885 !std::is_constructible<const string&, const _tRange&>::value>)>
886 inline auto
887 AccessNode(_tNode&& node, const _tRange& c)
888 -> decltype(YSLib::AccessNode(yforward(node), begin(c), end(c)))
889 {
890 return YSLib::AccessNode(yforward(node), begin(c), end(c));
891 }
893
894
896
897 YF_API observer_ptr<ValueNode>
899 AccessNodePtr(ValueNode::Container&, const string&) ynothrow;
901 YF_API observer_ptr<const ValueNode>
902 AccessNodePtr(const ValueNode::Container&, const string&) ynothrow;
903 template<typename _tKey>
904 observer_ptr<ValueNode>
905 AccessNodePtr(ValueNode::Container& con, const _tKey& name) ynothrow
906 {
907 return make_observer(ystdex::call_value_or<ValueNode*>(ystdex::addrof<>(),
908 con.find(name), {}, end(con)));
909 }
910 template<typename _tKey>
911 observer_ptr<const ValueNode>
912 AccessNodePtr(const ValueNode::Container& con, const _tKey& name) ynothrow
913 {
914 return make_observer(ystdex::call_value_or<const ValueNode*>(
915 ystdex::addrof<>(), con.find(name), {}, end(con)));
916 }
917 template<typename _tKey>
918 inline observer_ptr<ValueNode>
919 AccessNodePtr(ValueNode::Container* p_con, const _tKey& name) ynothrow
920 {
921 return p_con ? YSLib::AccessNodePtr(*p_con, name) : nullptr;
922 }
923 template<typename _tKey>
924 inline observer_ptr<const ValueNode>
925 AccessNodePtr(const ValueNode::Container* p_con, const _tKey& name) ynothrow
926 {
927 return p_con ? YSLib::AccessNodePtr(*p_con, name) : nullptr;
928 }
929 template<typename _tKey>
930 inline observer_ptr<ValueNode>
931 AccessNodePtr(observer_ptr<ValueNode::Container> p_con, const _tKey& name)
932 ynothrow
933 {
934 return p_con ? YSLib::AccessNodePtr(*p_con, name) : nullptr;
935 }
936 template<typename _tKey>
937 inline observer_ptr<const ValueNode>
938 AccessNodePtr(observer_ptr<const ValueNode::Container> p_con, const _tKey& name)
939 ynothrow
940 {
941 return p_con ? YSLib::AccessNodePtr(*p_con, name) : nullptr;
942 }
948 YF_API observer_ptr<ValueNode>
949 AccessNodePtr(ValueNode&, size_t);
950 YF_API observer_ptr<const ValueNode>
951 AccessNodePtr(const ValueNode&, size_t);
953 template<typename _tKey, yimpl(typename = typename ystdex::enable_if_t<
954 ystdex::is_interoperable<const _tKey&, const string&>::value>)>
955 inline observer_ptr<ValueNode>
956 AccessNodePtr(ValueNode& node, const _tKey& name)
957 {
958 return YSLib::AccessNodePtr(node.GetContainerRef(), name);
959 }
960 template<typename _tKey, yimpl(typename = typename ystdex::enable_if_t<
961 ystdex::is_interoperable<const _tKey&, const string&>::value>)>
962 inline observer_ptr<const ValueNode>
963 AccessNodePtr(const ValueNode& node, const _tKey& name)
964 {
965 return YSLib::AccessNodePtr(node.GetContainer(), name);
966 }
968
969 template<class _tNode, typename _tIn>
971 auto
972 AccessNodePtr(_tNode&& node, _tIn first, _tIn last)
973 -> decltype(make_obsrever(std::addressof(node)))
974 {
975 // TODO: Simplified using algorithm template?
976 for(auto p(make_observer(std::addressof(node))); p && first != last;
977 ++first)
978 p = AccessNodePtr(*p, *first);
979 return first;
980 }
982 template<class _tNode, typename _tRange,
983 yimpl(typename = typename ystdex::enable_if_t<
984 !std::is_constructible<const string&, const _tRange&>::value>)>
985 inline auto
986 AccessNodePtr(_tNode&& node, const _tRange& c)
987 -> decltype(YSLib::AccessNodePtr(yforward(node), begin(c), end(c)))
988 {
989 return YSLib::AccessNodePtr(yforward(node), begin(c), end(c));
990 }
992
993
994
996
997
1007 template<typename _type, typename... _tParams>
1008 inline _type&
1009 AccessChild(ValueNode& node, _tParams&&... args)
1010 {
1011 return Access<_type>(AccessNode(node, yforward(args)...));
1012 }
1013 template<typename _type, typename... _tParams>
1014 inline const _type&
1015 AccessChild(const ValueNode& node, _tParams&&... args)
1016 {
1017 return Access<_type>(AccessNode(node, yforward(args)...));
1018 }
1020
1022
1023 template<typename _type, typename... _tParams>
1024 inline observer_ptr<_type>
1025 AccessChildPtr(ValueNode& node, _tParams&&... args) ynothrow
1026 {
1027 return AccessPtr<_type>(
1028 AccessNodePtr(node.GetContainerRef(), yforward(args)...));
1029 }
1030 template<typename _type, typename... _tParams>
1031 inline observer_ptr<const _type>
1032 AccessChildPtr(const ValueNode& node, _tParams&&... args) ynothrow
1033 {
1034 return AccessPtr<_type>(
1035 AccessNodePtr(node.GetContainer(), yforward(args)...));
1036 }
1037 template<typename _type, typename... _tParams>
1038 inline observer_ptr<_type>
1039 AccessChildPtr(ValueNode* p_node, _tParams&&... args) ynothrow
1040 {
1041 return p_node ? AccessChildPtr<_type>(*p_node, yforward(args)...) : nullptr;
1042 }
1043 template<typename _type, typename... _tParams>
1044 inline observer_ptr<const _type>
1045 AccessChildPtr(const ValueNode* p_node, _tParams&&... args) ynothrow
1046 {
1047 return p_node ? AccessChildPtr<_type>(*p_node, yforward(args)...) : nullptr;
1048 }
1050
1051
1052
1053
1055
1056 inline PDefH(const ValueNode&, AsNode, const ValueNode& node)
1058 ImplRet(node)
1063 template<typename _tString, typename... _tParams>
1064 inline ValueNode
1065 AsNode(_tString&& str, _tParams&&... args)
1066 {
1067 return {NoContainer, yforward(str), yforward(args)...};
1068 }
1069
1074 template<typename _tString, typename... _tParams>
1075 inline ValueNode
1076 MakeNode(_tString&& str, _tParams&&... args)
1077 {
1078 return {NoContainer, yforward(str), ystdex::decay_copy(args)...};
1079 }
1081
1087 template<typename _tString, typename... _tParams>
1088 inline ValueNode
1089 StringifyToNode(_tString&& str, _tParams&&... args)
1090 {
1091 return {NoContainer, yforward(str), to_string(yforward(args)...)};
1092 }
1093
1099 inline PDefH(const ValueNode&, UnpackToNode, const ValueNode& arg)
1100 ImplRet(arg)
1101 inline PDefH(ValueNode&&, UnpackToNode, ValueNode&& arg)
1102 ImplRet(std::move(arg))
1104
1109 template<class _tPack>
1110 inline ValueNode
1111 UnpackToNode(_tPack&& pk)
1112 {
1113 return {0, get<0>(yforward(pk)),
1114 ValueObject(ystdex::decay_copy(get<1>(yforward(pk))))};
1115 }
1116
1122 template<typename _tElem>
1123 inline ValueNode::Container
1124 CollectNodes(std::initializer_list<_tElem> il)
1125 {
1126 return il;
1127 }
1128 template<typename... _tParams>
1129 inline ValueNode::Container
1130 CollectNodes(_tParams&&... args)
1131 {
1132 return {yforward(args)...};
1133 }
1135
1140 template<typename _tString, typename... _tParams>
1141 inline ValueNode
1142 PackNodes(_tString&& name, _tParams&&... args)
1143 {
1144 return {CollectNodes(UnpackToNode(yforward(args))...), yforward(name)};
1145 }
1146
1147
1149
1150 YF_API void
1152 RemoveEmptyChildren(ValueNode::Container&) ynothrow;
1153
1159 YF_API void
1160 RemoveHead(ValueNode::Container&) ynothrowv;
1161 inline PDefH(void, RemoveHead, ValueNode& node) ynothrowv
1162 ImplExpr(RemoveHead(node.GetContainerRef()))
1164
1165
1170 template<typename _tNode, typename _fCallable>
1171 void
1172 SetContentWith(ValueNode& dst, _tNode& node, _fCallable f)
1173 {
1174 yunseq(
1175 dst.Value = ystdex::invoke(f, node.Value),
1176 dst.GetContainerRef() = node.CreateWith(f)
1177 );
1178 }
1179
1180
1187 YF_API bool
1188 IsPrefixedIndex(string_view, char = '$');
1189
1198 YF_API string
1199 MakeIndex(size_t);
1200 inline PDefH(string, MakeIndex, const ValueNode::Container& con)
1201 ImplRet(MakeIndex(con.size()))
1202 inline PDefH(string, MakeIndex, const ValueNode& node)
1203 ImplRet(MakeIndex(node.GetContainer()))
1205
1214 YF_API size_t
1215 GetLastIndexOf(const ValueNode::Container&);
1216 inline PDefH(size_t, GetLastIndexOf, const ValueNode& term)
1217 ImplRet(GetLastIndexOf(term.GetContainer()))
1219
1225 template<typename _tParam, typename... _tParams>
1226 inline ValueNode
1227 AsIndexNode(_tParam&& arg, _tParams&&... args)
1228 {
1229 return AsNode(MakeIndex(yforward(arg)), yforward(args)...);
1230 }
1231
1232
1239 using NodeSequence = yimpl(YSLib::vector)<ValueNode>;
1240
1241
1246 class YF_API NodeLiteral final
1247 {
1248 private:
1249 ValueNode node;
1250
1251 public:
1253 NodeLiteral(const ValueNode& nd)
1254 : node(nd)
1255 {}
1257 NodeLiteral(ValueNode&& nd)
1258 : node(std::move(nd))
1259 {}
1260 NodeLiteral(const string& str)
1261 : node(NoContainer, str)
1262 {}
1263 NodeLiteral(const string& str, string val)
1264 : node(NoContainer, str, std::move(val))
1265 {}
1266 template<typename _tLiteral = NodeLiteral>
1267 NodeLiteral(const string& str, std::initializer_list<_tLiteral> il)
1268 : node(NoContainer, str, NodeSequence(il.begin(), il.end()))
1269 {}
1271 template<typename _tLiteral = NodeLiteral, class _tString,
1272 typename... _tParams>
1273 NodeLiteral(ListContainerTag, _tString&& str,
1274 std::initializer_list<_tLiteral> il, _tParams&&... args)
1275 : node(ValueNode::Container(il.begin(), il.end()), yforward(str),
1276 yforward(args)...)
1277 {}
1278 DefDeCopyMoveCtorAssignment(NodeLiteral)
1279
1280 DefCvt(ynothrow, ValueNode&, node)
1281 DefCvt(const ynothrow, const ValueNode&, node)
1282 };
1283
1289 template<typename _tString, typename _tLiteral = NodeLiteral>
1290 inline NodeLiteral
1291 AsNodeLiteral(_tString&& name, std::initializer_list<_tLiteral> il)
1292 {
1293 return {ListContainer, yforward(name), il};
1294 }
1295
1296 } // namespace YSLib;
1297
1298 #endif
1299
YSLib::ValueNode::ValueNode
ValueNode(tuple< _tParams1... > args1, tuple< _tParams2... > args2, tuple< _tParams3... > args3)
Definition: ValueNode.h:150
YSLib::PackNodes
ValueNode PackNodes(_tString &&name, _tParams &&...args)
取以指定分量为参数对应初始化得到的值类型节点为子节点的值类型节点。
Definition: ValueNode.h:1142
DefFwdTmpl
#define DefFwdTmpl(_q, _t, _n,...)
传递模板。
Definition: YBaseMacro.h:327
NPL::dst
YF_API const char src const string const char * dst
Definition: Dependency.h:95
YSLib::MakeNode
ValueNode MakeNode(_tString &&str, _tParams &&...args)
传递指定名称和退化值参数构造值类型节点。
Definition: ValueNode.h:1076
YSLib::ValueNode::DefDeCtor
DefDeCtor(ValueNode) ValueNode(Container con)
构造：使用容器对象。
Definition: ValueNode.h:86
YSLib::ValueNode::Access
_type & Access(ValueNode &node)
访问节点的指定类型对象。 空实例或类型检查失败 。
Definition: ValueNode.h:728
YSLib::ValueNode::AddChild
bool AddChild(_tKey &&k, ValueNode &&node)
Definition: ValueNode.h:354
YSLib::GetLastIndexOf
size_t GetLastIndexOf(const ValueNode::Container &con)
Definition: ValueNode.cpp:199
ystdex::make_from_tuple
_type make_from_tuple(_tTuple &&t)
从元组构造指定类型的值。
Definition: tuple.hpp:129
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
ystdex::to_string
std::string to_string(const std::thread::id &)
转换 thread::id 为字符串表示。
ystdex::dep_ops::totally_ordered
details::flat_ops< _type, _type2, _tOpt, less_than_comparable, equality_comparable > totally_ordered
Definition: operators.hpp:367
DefBoolNeg
#define DefBoolNeg(_spec,...)
定义表示显式转换 bool 操作符及其否定的 operator! 。
Definition: YBaseMacro.h:228
YSLib::ValueNode::const_iterator
const_iterator
Definition: ValueNode.h:701
YSLib::ValueNode::AddValueTo
static bool AddValueTo(Container &con, _tString &&str, _tParams &&...args)
向容器添加参数指定值的子节点。
Definition: ValueNode.h:409
ystdex::make_observer
observer_ptr< _type > make_observer(_type *p)
Definition: pointer.hpp:326
path.hpp
抽象路径模板。
YSLib::MakeIndex
MakeIndex
Definition: ValueNode.h:1202
platform::Deref
yconstfn auto Deref(_type &&p) -> decltype(*p)
断言并解引用非空指针。
Definition: Debug.h:451
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
NPL::x
const TermNode &term ynothrow const TermNode &term ynothrow const TermNode &term ynothrow TermNode &term const TermNode &term ValueNode &node const ValueNode &node const _type & x
Definition: SContext.h:94
YSLib::NodeLiteral::NodeLiteral
NodeLiteral(const string &str, std::initializer_list< _tLiteral > il)
Definition: ValueNode.h:1267
YSLib::ValueNode::SelectChildren
Container SelectChildren(_func f) const
复制满足条件的子节点。
Definition: ValueNode.h:556
ystdex::cpp2014::rbegin
auto rbegin(_tRange &c) -> decltype(c.rbegin())
Definition: range.hpp:94
CHRLib::f
f(d, s)
YSLib::ValueNode::AddValue
bool AddValue(const_iterator hint, _tKey &&k, _tParams &&...args)
Definition: ValueNode.h:395
ystdex::is_interoperable
判断指定类型之间是否可转换。
Definition: type_traits.hpp:960
YSLib::ValueNode::SplitChildren
Container SplitChildren(_func f)
转移满足条件的子节点。
Definition: ValueNode.h:571
YSLib::GetValuePtrOf
observer_ptr< const ValueObject > GetValuePtrOf(observer_ptr< const ValueNode > p_node)
Definition: ValueNode.cpp:150
ystdex::mapped_set::key_type
_type key_type
Definition: set.hpp:163
YSLib::ValueNode::AddChild
void AddChild(const_iterator hint, _tKey &&k, ValueNode &&node)
Definition: ValueNode.h:371
ystdex::operator<
bool operator<(const optional< _type > &x, const optional< _type > &y)
Definition: optional.h:485
ystdex::cpp2014::enable_if_t
typename enable_if< _bCond, _type >::type enable_if_t
Definition: type_traits.hpp:343
ystdex::enable_if_inconvertible_t
enable_if_t<!is_convertible< _tFrom, _tTo >::value, _type > enable_if_inconvertible_t
Definition: type_traits.hpp:1057
DefDeCopyMoveCtorAssignment
#define DefDeCopyMoveCtorAssignment(_t)
Definition: YBaseMacro.h:202
CHRLib::args
_tParams && args
Definition: CharacterProcessing.h:538
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:679
platform::containers::string
basic_string< char > string
Definition: Container.h:101
ystdex::mapped_set::find
iterator find(const key_type &x)
Definition: set.hpp:522
YSLib::AccessNode
const ValueNode & AccessNode(const ValueNode &node, const _tKey &name)
Definition: ValueNode.h:866
YSLib::NoContainer
yconstexpr const struct YSLib::NoContainerTag NoContainer
ystdex::cpp2011::end
_type * end(_type(&&array)[_vN])
Definition: range.hpp:54
ystdex::mapped_set::emplace
std::pair< iterator, bool > emplace(_tParams &&...args)
Definition: set.hpp:377
ystdex::try_emplace
std::pair< typename _tAssocCon::iterator, bool > try_emplace(_tAssocCon &con, _tKey &&k, _tParams &&...args)
Definition: container.hpp:1230
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:1022
YSLib::ValueNode::AddValue
bool AddValue(_tKey &&k, _tParams &&...args)
添加参数指定值的子节点。
Definition: ValueNode.h:387
ystdex::cpp2014::rend
auto rend(_tRange &c) -> decltype(c.rend())
Definition: range.hpp:119
YSLib::ValueNode::ThrowWrongNameFound
static YB_NORETURN void ThrowWrongNameFound()
抛出名称错误异常。
Definition: ValueNode.cpp:67
YSLib::ValueNode::reverse_iterator
Container::reverse_iterator reverse_iterator
Definition: ValueNode.h:70
YSLib::ValueNode::const_reverse_iterator
Container::const_reverse_iterator const_reverse_iterator
Definition: ValueNode.h:72
ystdex::insert_or_assign_hint
std::pair< typename _tAssocCon::iterator, bool > insert_or_assign_hint(_tAssocCon &con, typename _tAssocCon::const_iterator hint, _tKey &&k, _tParam &&arg)
Definition: container.hpp:1267
YSLib::ValueNode::Value
ValueObject Value
Definition: ValueNode.h:84
YSLib::ValueNode::PlaceValue
ValueObject & PlaceValue(_tString &&str, _tParams &&...args)
初始化的值对象引用。
Definition: ValueNode.h:529
YSLib::ValueNode::Place
_type & Place(_tString &&str, _tParams &&...args)
若指定名称子节点不存在则按指定值初始化。
Definition: ValueNode.h:507
YSLib::ValueNode::Container
ystdex::mapped_set< ValueNode, ystdex::less<>> Container
Definition: ValueNode.h:62
YSLib::PDefH
PDefH(Environment &, FetchEnvironment,) ImplRet(FetchGlobalInstance().GetEnvironmentRef()) inline PDefH(GUIHost &
取单一环境对象引用。
YSLib::NodeLiteral::NodeLiteral
NodeLiteral(ListContainerTag, _tString &&str, std::initializer_list< _tLiteral > il, _tParams &&...args)
Definition: ValueNode.h:1273
YSLib::NodeLiteral::NodeLiteral
NodeLiteral(ValueNode &&nd)
Definition: ValueNode.h:1257
ystdex::decay_copy
enable_if_convertible_t< _type, decay_t< _type >, decay_t< _type > > decay_copy(_type &&arg)
退化复制。
Definition: utility.hpp:228
YSLib::UnpackToNode
UnpackToNode
Definition: ValueNode.h:1101
YSLib::AsNode
typename _tParams ValueNode AsNode(_tString &&str, _tParams &&...args)
Definition: ValueNode.h:1065
DefDeMoveAssignment
#define DefDeMoveAssignment(_t)
Definition: YBaseMacro.h:191
YSLib::ValueNode::ValueNode
ValueNode(tuple< _tParams1... > args1)
原地构造：使用容器、名称和值的参数元组。
Definition: ValueNode.h:138
YSLib::ValueObject
值类型对象类。
Definition: YObject.h:539
ystdex::set_value_move
const _type & set_value_move(const _type &x)
转移集合元素。
Definition: set.hpp:49
YSLib::AsIndexNode
const ValueNode &node ImplRet(MakeIndex(node.GetContainer())) YF_API size_t GetLastIndexOf(const ValueNode typename _tParams ValueNode AsIndexNode(_tParam &&arg, _tParams &&...args)
Definition: ValueNode.h:1227
ystdex::transformed_iterator
变换迭代器。
Definition: iterator.hpp:216
YSLib::ValueNode::insert_or_assign
iterator insert_or_assign(const_iterator hint, _tKey &&k, _tParam &&arg)
Definition: ValueNode.h:659
YSLib::ValueNode::ValueNode
ValueNode(const pair< _tIn, _tIn > &pr)
构造：使用输入迭代器对。
Definition: ValueNode.h:119
YSLib::SetContentWith
_fCallable void SetContentWith(ValueNode &dst, _tNode &node, _fCallable f)
Definition: ValueNode.h:1172
ystdex
特性测试宏。
Definition: ydef.h:822
YSLib::AccessNodePtr
YF_API observer_ptr< ValueNode > AccessNodePtr(ValueNode::Container &, const string &) ynothrow
访问节点指针。
Definition: ValueNode.cpp:113
YSLib::i
return i
Definition: YCoreUtilities.h:176
DefDeCopyMoveCtor
#define DefDeCopyMoveCtor(_t)
Definition: YBaseMacro.h:173
ystdex::mapped_set::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: set.hpp:193
YSLib::CollectNodes
ValueNode::Container CollectNodes(std::initializer_list< _tElem > il)
取指定值类型节点为成员的节点容器。
Definition: ValueNode.h:1124
YF_API
#define YF_API
Definition: Platform.h:56
YSLib::yimpl
YF_API yimpl(GUIApplication &) FetchGlobalInstance()
取全局应用程序实例。
YSLib::ValueNode::CreateWith
Container CreateWith(_fCallable f) const
Definition: ValueNode.h:488
ystdex::path
一般路径模板。
Definition: path.hpp:123
YSLib::RemoveEmptyChildren
YF_API void RemoveEmptyChildren(ValueNode::Container &) ynothrow
移除空子节点。
Definition: ValueNode.cpp:158
YSLib::ListContainer
yconstexpr const struct YSLib::ListContainerTag ListContainer
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
ystdex::try_emplace_hint
std::pair< typename _tAssocCon::iterator, bool > try_emplace_hint(_tAssocCon &con, typename _tAssocCon::const_iterator hint, _tKey &&k, _tParams &&...args)
Definition: container.hpp:1241
YSLib::StringifyToNode
ValueNode StringifyToNode(_tString &&str, _tParams &&...args)
取指定名称和转换为字符串的值类型节点。
Definition: ValueNode.h:1089
YSLib::ValueNode::name
string name
Definition: ValueNode.h:75
YSLib::NodeLiteral
包装节点的组合字面量。
Definition: ValueNode.h:1246
YSLib::ValueNode::ynothrow
const const ValueNode &node const ynothrow ValueNode & ynothrow
Definition: ValueNode.h:697
ynothrowv
#define ynothrowv
YSLib 无异常抛出保证验证：有条件地使用无异常抛出规范。
Definition: ydef.h:786
YSLib::RemoveHead
YF_API void RemoveHead(ValueNode::Container &) ynothrowv
移除首个子节点。
Definition: ValueNode.cpp:164
YSLib::AccessChildPtr
observer_ptr< _type > AccessChildPtr(ValueNode &node, _tParams &&...args) ynothrow
访问指定名称的子节点的指定类型对象的指针。
Definition: ValueNode.h:1025
YSLib::ValueNode
值类型节点。
Definition: ValueNode.h:58
std
Definition: memory.hpp:1183
YSLib::ImplRet
ImplRet(FetchGlobalInstance().GetGUIHostRef()) YF_API void Execute(GUIApplication &
执行程序主消息循环。
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
YSLib::ValueNode::AddChild
void AddChild(const_iterator hint, _tKey &&k, const ValueNode &node)
Definition: ValueNode.h:364
YSLib::NodeSequence
yimpl(YSLib::vector)< ValueNode > NodeSequence
节点序列容器。
Definition: ValueNode.h:1239
YSLib::GetValueOf
ValueObject GetValueOf(observer_ptr< const ValueNode > p_node)
Definition: ValueNode.cpp:144
set.hpp
集合容器。
YSLib::NodeLiteral::NodeLiteral
NodeLiteral(const string &str, string val)
Definition: ValueNode.h:1263
YSLib::AccessChild
_type & AccessChild(ValueNode &node, _tParams &&...args)
访问子节点的指定类型对象。
Definition: ValueNode.h:1009
ystdex::mapped_set
允许指定不同于值类型的键的集合。
Definition: set.hpp:160
YSLib::NodeLiteral::NodeLiteral
NodeLiteral(const ValueNode &nd)
Definition: ValueNode.h:1253
DefCvt
#define DefCvt(_q, _t,...)
Definition: YBaseMacro.h:206
YSLib::ValueNode::ValueNode
ValueNode(NoContainerTag, _tString &&str, _tParams &&...args)
构造：使用字符串引用和值类型对象构造参数。
Definition: ValueNode.h:101
YB_NORETURN
#define YB_NORETURN
指定无返回值函数。
Definition: ydef.h:504
YModules.h
YSLib::UI::name
yconstfn const string & name
Definition: Loader.h:130
YSLib::ValueObject::Access
_type & Access()
访问指定类型对象。 空实例或类型检查失败 。
Definition: YObject.h:754
YSLib::Text::str
const char const char * str
Definition: TextFile.h:81
ystdex::insert_or_assign
std::pair< typename _tAssocCon::iterator, bool > insert_or_assign(_tAssocCon &con, _tKey &&k, _tParam &&arg)
Definition: container.hpp:1259
CHRLib::c
c
Definition: CharacterProcessing.h:81
ystdex::mapped_set::insert
std::pair< iterator, bool > insert(const value_type &x)
Definition: set.hpp:395
ystdex::copy_and_swap
_type & copy_and_swap(_type &obj, const _type2 &new_val)
复制后交换。
Definition: utility.hpp:170
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:995
ystdex::addrof
一元 & 操作。
Definition: functor.hpp:437
YPP_Comma
#define YPP_Comma
替换为逗号的预处理记号。
Definition: ydef.h:225
YSLib::NodeLiteral::node
ValueNode node
Definition: ValueNode.h:1249
YSLib::ValueNode::key_type
typename Container::key_type key_type
Definition: ValueNode.h:64
YSLib::ValueNode::ValueNode
ValueNode(const pair< _tIn, _tIn > &pr, _tString &&str)
构造：使用输入迭代器对、字符串引用和值参数。
Definition: ValueNode.h:128
YSLib::ValueNode::ValueNode
ValueNode(Container con, _tString &&str, _tParams &&...args)
构造：使用容器对象、字符串引用和值类型对象构造参数。
Definition: ValueNode.h:109
ystdex::invoke
result_of_t< _fCallable &&(_tParams &&...)> invoke(_fCallable &&f, _tParams &&...args)
调用可调用对象。
Definition: functional.hpp:339
YSLib::ValueNode::try_emplace
iterator try_emplace(const_iterator hint, _tKey &&k, _tParams &&...args)
Definition: ValueNode.h:710
ystdex::mapped_set::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: set.hpp:192
YSLib::ValueNode::AccessPtr
auto AccessPtr(observer_ptr< _tNodeOrPointer > p) ynothrow-> decltype(YSLib::AccessPtr< _type >(*p))
访问节点的指定类型对象指针。
Definition: ValueNode.h:764
ystdex::cpp2011::begin
_type * begin(_type(&&array)[_vN])
Definition: range.hpp:46
YSLib::ValueNode::CreateRecursively
static Container CreateRecursively(const Container &con, _fCallable f)
Definition: ValueNode.h:465
YSLib::NoContainerTag
标记不使用容器。
Definition: ValueNode.h:46
ystdex::size
auto size(const _tRange &c) -> decltype(c.size())
类容器访问。
Definition: range.hpp:233
ystdex::erase_first
bool erase_first(_tAssocCon &con, const _tKey &k)
删除指定关联容器中等价于指定键的起始元素。
Definition: container.hpp:749
YSLib::NodeLiteral::NodeLiteral
NodeLiteral(const string &str)
Definition: ValueNode.h:1260
YSLib::vo
vo
Definition: YApplication.h:231
YSLib::ValueNode::try_emplace
std::pair< iterator, bool > try_emplace(_tKey &&k, _tParams &&...args)
Definition: ValueNode.h:703
YSLib::ListContainerTag
标记列表构造容器。
Definition: ValueNode.h:43
YSLib::ValueNode::PlaceUnchecked
_type & PlaceUnchecked(_tString &&str, _tParams &&...args)
Definition: ValueNode.h:519
ystdex::for_each_if
_func for_each_if(_tIn first, _tIn last, _fPred pred, _func f)
Definition: algorithm.hpp:161
ystdex::ref
lref< _type > ref(_type &t)
构造引用包装。
Definition: ref.hpp:132
ystdex::string_view
basic_string_view< char > string_view
Definition: string_view.hpp:415
YSLib::ValueNode::AccessPtr
observer_ptr< _type > AccessPtr(ValueNode &node) ynothrow
访问节点的指定类型对象指针。
Definition: ValueNode.h:746
ynoexcept
#define ynoexcept(...)
YSLib 无异常抛出保证：指定特定的异常规范。
Definition: ydef.h:746
CHRLib::p
const auto p(d)
YSLib::IsPrefixedIndex
YF_API bool IsPrefixedIndex(string_view, char= '$')
判断字符串是否是前缀索引：一个指定字符和非负整数的组合。
Definition: ValueNode.cpp:172
YSLib::ValueNode::ValueNode
ValueNode(tuple< _tParams1... > args1, tuple< _tParams2... > args2)
Definition: ValueNode.h:143
YSLib::swap
void swap(ValueNode &x, ValueNode &y) ynothrow
Definition: ValueNode.cpp:73
ystdex::details::insert_or_assign
std::pair< typename _tAssocCon::iterator, bool > insert_or_assign(std::pair< typename _tAssocCon::iterator, bool > pr, _tAssocCon &con, _tKey &&k, _tParam &&arg)
Definition: container.hpp:1112