acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_template_inline_functions.h
1// Created by camilo on 2022-11-08 23:10 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5template < prototype_number NUMBER1, prototype_number NUMBER2 >
6void cast_copy(NUMBER1 & n1, NUMBER2 n2)
7{
8
9 n1 = (NUMBER1) n2;
10
11}
12
13
14template < typename A, typename B >
15inline void swap(A & a, B & b)
16{
17
18 auto t = a;
19
20 a = b;
21
22 b = t;
23
24}
25
26
27template < typename TYPE >
28constexpr memsize index_of(const TYPE * p, const TYPE * pBegin)
29{
30
31 return ::is_set(p) ? (::memsize)(p - pBegin) : -1;
32
33}
34
35template < prototype_character CHARACTER >
36constexpr bool string_compare_prefix(::i32 & ordering, const CHARACTER * pszA, const CHARACTER * pszB) noexcept
37{
38
39 if (::is_empty(pszA))
40 {
41
42 if (::is_empty(pszB))
43 {
44
45 ordering = 0;
46
47 return true;
48
49 }
50 else
51 {
52
53 ordering = -1;
54
55 return true;
56
57 }
58
59 }
60 else if (::is_empty(pszB))
61 {
62
63 ordering = 1;
64
65 return true;
66
67 }
68
69 return false;
70
71}
72
73template < prototype_character CHARACTER >
74constexpr bool string_order_prefix(::std::strong_ordering & ordering, const CHARACTER * pszA, const CHARACTER * pszB) noexcept
75{
76
77 if (::is_empty(pszA))
78 {
79
80 if (::is_empty(pszB))
81 {
82
83 ordering = ::std::strong_ordering::equal;
84
85 return true;
86
87 }
88 else
89 {
90
91 ordering = ::std::strong_ordering::less;
92
93 return true;
94
95 }
96
97 }
98 else if (::is_empty(pszB))
99 {
100
101 ordering = ::std::strong_ordering::greater;
102
103 return true;
104
105 }
106
107 return false;
108
109}
110
111
112
115template < typename TYPE >
116void reverse(TYPE * begin, TYPE * end)
117{
118
119 while (true)
120 {
121
122 end--;
123
124 if (end <= begin) return;
125
126 ::swap(*begin, *end);
127
128 begin++;
129
130 }
131
132}
133
134#include "acme/prototype/collection/pair.h"
135//template < typename A, typename B >
136//struct as_p
137//{
138// A a; B b; };
139//
140
141//template<typename A, typename B>
142//auto as_ab(A a, B b)
143//{
144//
145// return _as_ab<A, B>{a, b};
146//
147//}
148
149//auto f() { return many{ string(),5.7, unmovable() }; };
150
151
152template < prototype_signed SIGNED >
153constexpr auto as_absolute_unsigned(SIGNED i)
154{
155
156 bool bNegative;
157
158 return ::make_pair{ (typename std::make_unsigned<SIGNED>::type) ((bNegative = i < 0) ? -i : i), bNegative };
159
160}
161//::pair<::i32, ::i32> ia;
162//inline ::u64 make64_from32(::u32 l, ::u32 h)
163//{
164//
165// return ((::u64)l) | (((::u64)h) << 32);
166//
167//}
168//
169//
170//inline bool is_memory_segment_ok(const void* p, memsize size, bool bReadWrite)
171//{
172//
173//#ifdef DEEP_DEBUG
174//
175// ::u8* pbyte = (::u8*)p;
176//
177// if (bReadWrite)
178// {
179//
180// for (::collection::index i = 0; i < size; i++)
181// {
182//
183// ::u8& b = *pbyte;
184//
185// b++; // tests read/write of ::u8 b
186//
187// b--; // restablish it
188//
189// }
190//
191// }
192// else
193// {
194//
195// ::i32 sum = 0;
196//
197// for (::collection::index i = 0; i < size; i++)
198// {
199//
200// ::u8& b = *pbyte;
201//
202// sum += b; // tests read of ::u8 b
203//
204// }
205//
206// }
207//
208//#endif // DEEP_DEBUG
209//
210// return ::is_set(p);
211//
212//}
213//
214//
215//inline bool is_string_ok(const ::wide_character* pwsz, memsize nMaxLength)
216//{
217//
218// return ::is_memory_segment_ok(pwsz, nMaxLength);
219//
220//}
221//
222//
223//inline bool is_string_ok(const ::scoped_string & scopedstr, memsize nMaxLength)
224//{
225//
226// return ::is_memory_segment_ok(scopedstr, nMaxLength);
227//
228//}
229//
230//
231//
232//inline ::i32_bool address_overlaps(const void* pszDst, const void* pszSrc, character_count srclen)
233//{
234//
235// return (((::u8*)pszSrc) <= ((::u8*)pszDst) && ((::u8*)pszSrc) + srclen > ((::u8*)pszDst))
236// || (((::u8*)pszDst) <= ((::u8*)pszSrc) && ((::u8*)pszDst) + srclen > ((::u8*)pszSrc));
237//
238//}
239//
240
241
242//template < typename TYPE > inline TYPE*& __defer_new(TYPE*& p)
243//{
244//
245// if (!p) p = allocateø TYPE();
246//
247// return p;
248//
249//}
250
251
252inline const ::particle * context_trace_object() { return general_trace_object(); }
253
254
255#ifdef CPP17
256
257template <typename PRED, typename ... Args >
258inline bool _returns_true(PRED pred, const true_type& predicate_returns_void, bool bOnVoid, Args... args)
259{
260 pred(args...);
261 return bOnVoid;
262}
263
264template <typename PRED, typename ... Args >
265inline bool _returns_true(PRED pred, const false_type& predicate_returns_void, bool, Args... args)
266{
267 return (bool)pred(args...);
268}
269
270template <typename PRED, typename ... Args >
271inline bool returns_true(PRED pred, bool bOnVoid, Args... args)
272{
273
274 return _returns_true(pred, is_void<decltype(pred(args...))>, bOnVoid, args...);
275
276}
277
278template <typename PRED, typename ... Args >
279inline bool _returns_false(PRED pred, const true_type& predicate_returns_void, bool bOnVoid, Args... args)
280{
281 pred(args...);
282 return bOnVoid;
283}
284
285template <typename PRED, typename ... Args >
286inline bool _returns_false(PRED pred, const false_type& predicate_returns_void, bool, Args... args)
287{
288 return !(bool)pred(args...);
289}
290
291template <typename PRED, typename ... Args >
292inline bool returns_false(PRED pred, bool bOnVoid, Args... args)
293{
294
295 return _returns_false(pred, is_void < decltype(pred(args...)) >, bOnVoid, args...);
296
297}
298
299#endif
300
301//
302//
303//inline const ::particle* trace_object(const ::particle* pparticle) { return pparticle; }
304//
305//
306//inline bool failed(const ::payload& payload) { return !::succeeded(payload); }
307//
308//
309//
310//inline ::i32 read_char(::u8*& pdata, memsize& s, char_pointer pch)
311//{
312//
313// if (s < 1)
314// {
315//
316// return 0;
317//
318// }
319//
320// *pch = (::i8)*pdata;
321//
322// pdata++;
323//
324// s--;
325//
326// return 1;
327//
328//}
329//
330
331
332
333
334template < typename TYPE >
335inline bool is_reference_null(const TYPE& t)
336{
337
338 return is_null(&t);
339
340}
341
342
343template < typename TYPE >
344inline bool is_reference_set(const TYPE& t)
345{
346
347 return is_set(&t);
348
349}
350
351//
352//
353//inline bool is_impact_group(::u64 u, ::u64 uGroup) { return u >= uGroup && u < uGroup + 1000; }
354//
355//
356//inline bool is_impact_subgroup(::u64 u, ::u64 uGroup) { return u >= uGroup && u < uGroup + 100; }
357//
358//
359//inline bool is_file_or_folder(const ::file::enum_type& etype)
360//{
361//
362// return (etype & ::file::e_type_file_or_folder) > ::file::e_type_exists;
363//
364//}
365//
366//
367//inline bool exists(const ::file::enum_type& etype)
368//{
369//
370// return etype & ::file::e_type_exists;
371//
372//}
373//
374
375template < class T >
376inline void __dynamic_cast(T*& ptarget, T* psource)
377{
378
379 ptarget = psource;
380
381}
382
383
384template < class T , typename T2 >
385inline void __dynamic_cast(T * & ptarget, T2 * psource)
386{
387
388 ptarget = dynamic_cast < T * >(psource);
389
390}
391
392
393template < typename T1, typename T2 >
394inline bool __sort(T1& t1, T2& t2)
395{
396
397 if (t2 >= t1)
398 {
399
400 return false;
401
402 }
403
404 auto t = t2;
405
406 t2 = t1;
407
408 t1 = t;
409
410 return true;
411
412}
413
414
415//
416//inline ::i64 ansi_to_i64(const_char_pointer psz, const_char_pointer *ppszEnd, ::i32 iBase)
417//{
418//
419// return strtoll(scopedstr, (::ansi_character **) ppszEnd, iBase);
420//
421//}
422//
423//inline ::u64 ansi_to_u64(const_char_pointer psz, const_char_pointer *ppszEnd, ::i32 iBase)
424//{
425//
426// return strtoull(scopedstr, (::ansi_character **) ppszEnd, iBase);
427//
428//}
429//
430//
431//inline ::i32 ansi_to_int(const_char_pointer psz, const_char_pointer *ppszEnd, ::i32 iBase)
432//{
433//
434//#ifdef WINDOWS
435//
436// return strtol(scopedstr, (::ansi_character **) ppszEnd, iBase);
437//
438//#else
439//
440// long l = strtol(scopedstr, (::ansi_character **) ppszEnd, iBase);
441//
442// if(l > INT_MAX)
443// {
444//
445// errno = ERANGE;
446//
447// return INT_MAX;
448//
449// }
450// else if(l < INT_MIN)
451// {
452//
453// errno = ERANGE;
454//
455// return INT_MIN;
456//
457// }
458//
459// return (::i32) l;
460//
461//#endif
462//
463//}
464//
465//
466//inline ::u32 ansi_to_u32(const_char_pointer psz, const_char_pointer *ppszEnd, ::i32 iBase)
467//{
468//
469//#ifdef WINDOWS
470//
471// return strtoul(scopedstr, (::ansi_character **) ppszEnd, iBase);
472//
473//#else
474//
475// ulong ul = strtoul(scopedstr, (::ansi_character **) ppszEnd, iBase);
476//
477// if(ul > UINT_MAX)
478// {
479//
480// errno = ERANGE;
481//
482// return UINT_MAX;
483//
484// }
485//
486// return (::u32) ul;
487//
488//#endif
489//
490//}
491//
492//
493
494template < prototype_integral SECOND, prototype_integral NANOSECOND >
495constexpr void normalize_second_nanosecond(SECOND & second, NANOSECOND & nanosecond)
496{
497
498 auto extrasecond = nanosecond > 0 ? (nanosecond / 1'000'000'000) : ((nanosecond / 1'000'000'000) - 1);
499
500 second += extrasecond;
501
502 nanosecond -= extrasecond * 1'000'000'000;
503
504}
505
506
507
508template < prototype_integral SECOND1, prototype_integral NANOSECOND1, prototype_integral SECOND2, prototype_integral NANOSECOND2 >
509constexpr void add_second_nanosecond(SECOND1 & second1, NANOSECOND1 & nanosecond1, const SECOND2 & second2, const NANOSECOND2 & nanosecond2)
510{
511
512 auto nanos = nanosecond1 + nanosecond2;
513
514 auto extrasecond = nanos > 0 ? (nanos / 1'000'000'000) : ((nanos / 1'000'000'000) - 1);
515
516 second1 = second1 + second2 + extrasecond;
517
518 nanosecond1 = nanos - extrasecond * 1'000'000'000;
519
520}
521
522
523
524template < prototype_integral SECOND1, prototype_integral NANOSECOND1, prototype_integral SECOND2, prototype_integral NANOSECOND2 >
525constexpr void subtract_second_nanosecond(SECOND1 & second1, NANOSECOND1 & nanosecond1, const SECOND2 & second2, const NANOSECOND2 & nanosecond2)
526{
527
528 auto nanos = nanosecond1 - nanosecond2;
529
530 auto extrasecond = nanos > 0 ? (nanos / 1'000'000'000) : ((nanos / 1'000'000'000) - 1);
531
532 second1 = second1 - second2 + extrasecond;
533
534 nanosecond1 = nanos - extrasecond * 1'000'000'000;
535
536}
537
538
539template < typename TYPE >
540constexpr TYPE * find_first_null_character(TYPE * p)
541{
542
543 TYPE t{};
544
545 while (*p != t)
546 {
547
548 p++;
549
550 }
551
552 return p;
553
554}
555
556
557template < typename TYPE, ::comparison::equality < TYPE > EQUALITY >
558constexpr const TYPE * find_first_null_character(const TYPE * p, EQUALITY equality)
559{
560
561 TYPE t{};
562
563 while (!equality.equals(*p, t))
564 {
565
566 p++;
567
568 }
569
570 return p;
571
572}
573
574
575template < prototype_fundamental INTEGRAL >
576constexpr ::collection::count count_until_zero_item_type(const INTEGRAL * p)
577{
578
579 ::collection::count c = 0;
580
581 while (*p)
582 {
583
584 p++;
585
586 c++;
587
588 }
589
590 return c;
591
592}
593
594
595
596template < prototype_character CHARACTER >
597constexpr void null_terminate(CHARACTER * & p)
598{
599
600 *p = (CHARACTER)0;
601
602}
603
604
605template < prototype_character CHARACTER >
606constexpr void append_and_step_if_true(bool b, CHARACTER *& p, CHARACTER character)
607{
608
609 if (b) *p++ = character;
610
611}
612
613
614template < prototype_iterator ITERATOR, prototype_iterator BEGIN >
615constexpr bool iterator_is_before_begin(ITERATOR p, BEGIN)
616{
617
618 return p.is_null();
619
620}
621
622
623
624template < prototype_iterator ITERATOR, prototype_iterator END >
625constexpr bool iterator_is_end(ITERATOR p, END pend)
626{
627
628 return p.is_null() || p == pend;
629
630}
631
632
633template < prototype_iterator ITERATOR, prototype_iterator BEGIN, prototype_iterator END >
634constexpr bool iterator_is_ok(ITERATOR p, BEGIN, END pend)
635{
636
637 return p.is_ok() && p != pend;
638
639}
640
641
642template < typename TYPE, typename BEGIN >
643constexpr bool iterator_is_before_begin(const TYPE * p, const BEGIN * begin)
644{
645
646 return p < begin;
647
648}
649
650
651template < typename TYPE, typename END >
652constexpr bool iterator_is_end(const TYPE * p, const END * end)
653{
654
655 return p >= end;
656
657}
658
659
660template < typename TYPE, typename BEGIN, typename END >
661constexpr bool iterator_is_ok(const TYPE * p, const BEGIN * begin, const END * end)
662{
663
664 return p >= begin && p < end;
665
666}
667
668
669template < typename ITEM, ::comparison::equality < ITEM > EQUALITY >
670bool is_empty(const ITEM * p, EQUALITY equality)
671{
672
673 return ::is_null(p) || equality.equals(*p, 0);
674
675}
676
677
678template < typename ITEM, ::comparison::equality < ITEM > EQUALITY >
679constexpr bool _initialize_null_terminated_contains_null_terminated(bool & b, const ITEM * pz, const ITEM * pzPrefix, EQUALITY equality)
680{
681
682 if (::is_empty(pzPrefix, equality))
683 {
684
685 b = true;
686
687 return true;
688
689 }
690
691 if (::is_empty(pz, equality))
692 {
693
694 b = false;
695
696 return true;
697
698 }
699
700
701 return false;
702
703}
704
705
706template < typename ITEM, ::comparison::equality < ITEM > EQUALITY >
707constexpr bool _null_terminated_begins_null_terminated(const ITEM * pz, const ITEM * pzPrefix, EQUALITY equality)
708{
709
710 do
711 {
712
713 if (!equality.equals(*pz, *pzPrefix))
714 {
715
716 return false;
717
718 }
719
720 pz++;
721
722 pzPrefix++;
723
724 } while (!equality.equals(*pz,0) && !equality.equals(*pzPrefix, 0));
725
726 return equality.equals(*pzPrefix, 0);
727
728}
729
730
731template < typename ITEM, ::comparison::equality < ITEM > EQUALITY >
732constexpr bool null_terminated_begins_null_terminated(const ITEM * pz, const ITEM * pzPrefix, EQUALITY equality)
733{
734
735 bool b;
736
737 if (_initialize_null_terminated_contains_null_terminated(b, pz, pzPrefix, equality))
738 {
739
740 return b;
741
742 }
743
744 return _null_terminated_begins_null_terminated(pz, pzPrefix, equality);
745
746}
747
748
749#include "acme/prototype/mathematics/_.h"
750
751
752template < typename TYPE >
753TYPE * clipped_add(TYPE * p, ::collection::count c, const non_const<TYPE> * begin, const non_const<TYPE> * end)
754{
755
756 if (c > 0)
757 {
758
759 p = minimum(p + c, end);
760
761 }
762 else
763 {
764
765 p = maximum(p + c, begin - 1);
766
767 }
768
769 return p;
770
771}
772
773
774
775
776
777template < prototype_iterator ITERATOR, typename T1, typename T2 >
778ITERATOR clipped_add(ITERATOR p, ::collection::count c, T1, T2)
779{
780
781 if (c > 0)
782 {
783
784 while (p.is_set() && c > 0)
785 {
786
787 p = p.next();
788
789 c--;
790
791 }
792
793
794 }
795 else
796 {
797
798 while (p.is_set() && c < 0)
799 {
800
801 p = p.back();
802
803 c++;
804
805 }
806
807
808 }
809
810 return p;
811
812}
813
814
815
816template < prototype_signed SIGNED >
817bool found(SIGNED s)
818{
819
820 return s >= 0;
821
822}
823
824
825template < typename T >
826bool found(const T * p)
827{
828
829 return ::is_set(p);
830
831}
832
833
834template < prototype_signed SIGNED >
835bool not_found(SIGNED s)
836{
837
838 return !found(s);
839
840}
841
842
843template < typename T >
844bool not_found(const T * p)
845{
846
847 return !found(p);
848
849}
850
851
852//template < prototype_floating FLOATING, ::i32 len >
853//inline ::string as_string(FLOATING f, const_char_pointer pszFormat = "%f");
854
855
856template < typename BOOLEAN, typename ASSIGNED, typename ASSIGNEE >
857inline void set_if_different(BOOLEAN& bSetIfChanged, ASSIGNED& left, const ASSIGNEE& right)
858{
859
860 if (left != right)
861 {
862
863 bSetIfChanged = true;
864
865 left = right;
866
867 }
868
869}
870
871
872
873template < prototype_XYDim XYDim, typename X, typename Y, typename W, typename H >
874inline XYDim & set_dim(XYDim & rectTarget, X x, Y y, W w, H h)
875{
876
877 cast_copy(rectTarget.X, x);
878 cast_copy(rectTarget.Y, y);
879 cast_copy(rectTarget.Width, w);
880 cast_copy(rectTarget.Height, h);
881
882 return rectTarget;
883
884}
885
886
887//template < prototype_rectangle RECTANGLE1, prototype_rectangle RECTANGLE2 >
888//void copy(RECTANGLE1 & rectangle1, const RECTANGLE2 & rectangle2)
889//{
890//
891// cast_copy(rectangle1.left , rectangle2.left );
892// cast_copy(rectangle1.top , rectangle2.top );
893// cast_copy(rectangle1.right , rectangle2.right );
894// cast_copy(rectangle1.bottom , rectangle2.bottom );
895//
896//}
897
898
899template < prototype_rectangle RECTANGLE, prototype_xydim XYDIM >
900void copy(RECTANGLE & rectangle, const XYDIM & xydim)
901{
902
903 cast_copy(rectangle.left , xydim.x);
904 cast_copy(rectangle.top , xydim.y);
905 cast_copy(rectangle.right , xydim.x + xydim.width);
906 cast_copy(rectangle.bottom , xydim.y + xydim.height);
907
908}
909
910
911template < prototype_origin_size ORIGIN_SIZE, prototype_rectangle RECTANGLE >
912void copy(ORIGIN_SIZE & originsize, const RECTANGLE & rectangle)
913{
914
915 cast_copy(originsize.origin.x , rectangle.left);
916 cast_copy(originsize.origin.y , rectangle.top);
917 cast_copy(originsize.size.width , rectangle.right - rectangle.left);
918 cast_copy(originsize.size.height , rectangle.bottom - rectangle.top);
919
920}
921
922
923template < prototype_rectangle RECTANGLE1, prototype_origin_size RECTANGLE2 >
924void copy(RECTANGLE1 & rectangle1, const RECTANGLE2 & rectangle2)
925{
926
927 cast_copy(rectangle1.left , rectangle2.origin.x);
928 cast_copy(rectangle1.top , rectangle2.origin.y);
929 cast_copy(rectangle1.right , rectangle2.origin.x + rectangle2.size.width);
930 cast_copy(rectangle1.bottom , rectangle2.origin.y + rectangle2.size.height);
931
932}
933
934
935// template < prototype_rectangle RECTANGLE, origin_size ORIGIN_SIZE >
936// constexpr void copy(RECTANGLE& rectangle, const ORIGIN_SIZE& origin_size)
937// {
938
939// rectangle.left = (decltype(rectangle.left))origin_size.origin.x;
940// rectangle.top = (decltype(rectangle.top))origin_size.origin.y;
941// rectangle.right = (decltype(rectangle.right))(origin_size.origin.x + origin_size.size.width);
942// rectangle.bottom = (decltype(rectangle.bottom))(origin_size.origin.y + origin_size.size.height);
943
944// }
945
946
947// template < origin_size ORIGIN_SIZE, prototype_rectangle RECTANGLE >
948// constexpr void copy(ORIGIN_SIZE& origin_size, const RECTANGLE& rectangle)
949// {
950
951// origin_size.origin.x = (decltype(origin_size.origin.x))rectangle.left;
952// origin_size.origin.y = (decltype(origin_size.origin.y))rectangle.top;
953// origin_size.size.width = (decltype(origin_size.size.width))(rectangle.right - rectangle.left);
954// origin_size.size.height = (decltype(origin_size.size.height))(rectangle.bottom - rectangle.top);
955
956// }
957
958
959
960
961
962
963
964template < prototype_XY POINT1, prototype_point POINT2 >
965void copy(POINT1 point1, const POINT2 & point2)
966{
967
968 cast_copy(point1.X, point2.x);
969 cast_copy(point1.Y, point2.y);
970
971}
972
973
974template < prototype_point POINT1, prototype_XY POINT2 >
975void copy(POINT1 & point1, const POINT2 & point2)
976{
977
978 cast_copy(point1.x, point2.X);
979 cast_copy(point1.y, point2.Y);
980
981}
982
983
984template < prototype_rectangle RECTANGLE1, prototype_rectangle RECTANGLE2 >
985void copy(RECTANGLE1 & rectangle1, const RECTANGLE2 & rectangle2)
986{
987
988 cast_copy(rectangle1.left, rectangle2.left);
989 cast_copy(rectangle1.top, rectangle2.top);
990 cast_copy(rectangle1.right, rectangle2.right);
991 cast_copy(rectangle1.bottom, rectangle2.bottom);
992
993}
994
995
996template < prototype_XYDim XYDim, prototype_rectangle RECTANGLE >
997void copy(XYDim & xydim, const RECTANGLE & rectangle)
998{
999
1000 cast_copy(xydim.X, rectangle.left);
1001 cast_copy(xydim.Y, rectangle.top);
1002 cast_copy(xydim.Width, rectangle.right - rectangle.left);
1003 cast_copy(xydim.Height, rectangle.bottom - rectangle.top);
1004
1005}
1006
1007
1008template < prototype_rectangle RECTANGLE, prototype_XYDim XYDim >
1009void copy(RECTANGLE & rectangle, const XYDim & xydim)
1010{
1011
1012 cast_copy(rectangle.left, xydim.X);
1013 cast_copy(rectangle.top, xydim.Y);
1014 cast_copy(rectangle.right, xydim.X + xydim.Width);
1015 cast_copy(rectangle.bottom, xydim.Y + xydim.Height);
1016
1017}
1018
1019
1020template < prototype_xydim XYDIM, prototype_rectangle RECTANGLE >
1021void copy(XYDIM & xydim, const RECTANGLE & rectangle)
1022{
1023
1024 cast_copy(xydim.x, rectangle.left);
1025 cast_copy(xydim.y, rectangle.top);
1026 cast_copy(xydim.width, rectangle.right - rectangle.left);
1027 cast_copy(xydim.height, rectangle.bottom - rectangle.top);
1028
1029}
1030
1031
1032template < prototype_XYDim XYDim1, prototype_XYDim XYDim2 >
1033void copy(XYDim1 & xydim1, const XYDim2 & xydim2)
1034{
1035
1036 cast_copy(xydim1.X, xydim2.X);
1037 cast_copy(xydim1.Y, xydim2.Y);
1038 cast_copy(xydim1.Width, xydim2.Width);
1039 cast_copy(xydim1.Height, xydim2.Height);
1040
1041}
1042
1043
1044template < prototype_point POINT1, prototype_point POINT2 >
1045void copy(POINT1 & point1, const POINT2 & point2)
1046{
1047
1048 cast_copy(point1.x, point2.x);
1049 cast_copy(point1.y, point2.y);
1050
1051}
1052
1053
1054template < prototype_point POINT1, raw_primitive_point POINT2 >
1055void copy(POINT1 & point1, const POINT2 & point2)
1056{
1057
1058 cast_copy(point1.x, point2.x);
1059 cast_copy(point1.y, point2.y);
1060
1061}
1062
1063
1064template < raw_primitive_point POINT1, prototype_point POINT2 >
1065void copy(POINT1 & point1, const POINT2 & point2)
1066{
1067
1068 cast_copy(point1.x, point2.x);
1069 cast_copy(point1.y, point2.y);
1070
1071}
1072
1073
1074template < prototype_point POINT, prototype_size SIZE >
1075void copy(POINT & point, const SIZE & size)
1076{
1077
1078 cast_copy(point.x, size.cx);
1079 cast_copy(point.y, size.cy);
1080
1081}
1082
1083
1084template < prototype_size SIZE_TYPE1, prototype_size SIZE_TYPE2 >
1085void copy(SIZE_TYPE1 & size1, const SIZE_TYPE2 & size2)
1086{
1087
1088 cast_copy(size1.cx, size2.cx);
1089 cast_copy(size1.cy, size2.cy);
1090
1091}
1092
1093
1094template < typename CHAR_STRING >
1095inline bool is_string_empty(CHAR_STRING p) { return ::is_null(p) || *p == '\0'; }
1096
1097
Definition aaa_character.h:10
Definition aaa_nanosecond.h:9
Definition aaa_second.h:9