77// //////////////////////////////////////////////////////////////////////////
88
99#pragma once
10+ #include " xrCore/FixedVector.h"
1011
1112template <typename P>
1213struct CComparer
@@ -15,174 +16,174 @@ struct CComparer
1516 struct CHelper
1617 {
1718 template <bool a>
18- IC static bool compare (const T& _1 , const T& _2 , const P& p)
19+ IC static bool compare (const T& a1 , const T& a2 , const P& p)
1920 {
20- return ( p (_1, _2) );
21+ return p (a1, a2 );
2122 }
2223
2324 template <>
24- IC static bool compare<true >(const T& _1 , const T& _2 , const P& p)
25+ IC static bool compare<true >(const T& a1 , const T& a2 , const P& p)
2526 {
26- return ( CComparer::compare (*_1 , *_2 , p) );
27+ return CComparer::compare (*a1 , *a2 , p);
2728 }
2829 };
2930
30- IC static bool compare (LPCSTR _1 , LPCSTR _2 , const P& p) { return ( p (_1, _2) ); }
31- IC static bool compare (LPSTR _1 , LPSTR _2 , const P& p) { return ( p (_1, _2) ); }
32- IC static bool compare (const shared_str& _1 , const shared_str& _2 , const P& p) { return ( p (_1, _2) ); }
31+ IC static bool compare (LPCSTR s1 , LPCSTR s2 , const P& p) { return p (s1, s2 ); }
32+ IC static bool compare (LPSTR s1 , LPSTR s2 , const P& p) { return p (s1, s2 ); }
33+ IC static bool compare (const shared_str& s1 , const shared_str& s2 , const P& p) { return p (s1, s2 ); }
3334 template <typename T1, typename T2>
34- IC static bool compare (const std::pair<T1, T2>& _1 , const std::pair<T1, T2>& _2 , const P& p)
35+ IC static bool compare (const std::pair<T1, T2>& p1 , const std::pair<T1, T2>& p2 , const P& p)
3536 {
36- return ( compare (_1 .first , _2 .first , p) && compare (_1 .second , _2 .second , p) );
37+ return compare (p1 .first , p2 .first , p) && compare (p1 .second , p2 .second , p);
3738 }
3839
3940 template <typename T, int size>
40- IC static bool compare (const svector<T, size>& _1 , const svector<T, size>& _2 , const P& p)
41+ IC static bool compare (const svector<T, size>& v1 , const svector<T, size>& v2 , const P& p)
4142 {
42- if (_1 .size () != _2 .size ())
43- return ( p () );
43+ if (v1 .size () != v2 .size ())
44+ return p ( );
4445
45- svector<T, size>::const_iterator I = _1 .begin (), J = _2 .begin ();
46- svector<T, size>::const_iterator E = _1 .end ();
46+ svector<T, size>::const_iterator I = v1 .begin (), J = v2 .begin ();
47+ svector<T, size>::const_iterator E = v1 .end ();
4748 for (; I != E; ++I, ++J)
4849 if (!compare (*I, *J, p))
49- return ( false ) ;
50- return ( true ) ;
50+ return false ;
51+ return true ;
5152 }
5253
5354 template <typename T1, typename T2>
54- IC static bool compare (const std::queue<T1, T2>& __1 , const std::queue<T1, T2>& __2 , const P& p)
55+ IC static bool compare (const std::queue<T1, T2>& q1 , const std::queue<T1, T2>& q2 , const P& p)
5556 {
56- std::queue<T1, T2> _1 = __1 ;
57- std::queue<T1, T2> _2 = __2 ;
57+ std::queue<T1, T2> lq1 = q1 ;
58+ std::queue<T1, T2> lq2 = q2 ;
5859
59- if (_1 .size () != _2 .size ())
60- return ( p () );
60+ if (lq1 .size () != lq2 .size ())
61+ return p ( );
6162
62- for (; !_1 .empty (); _1 .pop (), _2 .pop ())
63- if (!compare (_1 .front (), _2 .front (), p))
64- return ( false ) ;
65- return ( true ) ;
63+ for (; !lq1 .empty (); lq1 .pop (), lq2 .pop ())
64+ if (!compare (lq1 .front (), lq2 .front (), p))
65+ return false ;
66+ return true ;
6667 }
6768
68- template <template <typename _1 , typename _2 > class T1 , typename T2, typename T3>
69- IC static bool compare (const T1<T2, T3>& __1 , const T1<T2, T3>& __2 , const P& p, bool )
69+ template <template <typename T1X , typename T2X > class T1 , typename T2, typename T3>
70+ IC static bool compare (const T1<T2, T3>& a1 , const T1<T2, T3>& a2 , const P& p, bool )
7071 {
71- T1<T2, T3> _1 = __1 ;
72- T1<T2, T3> _2 = __2 ;
72+ T1<T2, T3> la1 = a1 ;
73+ T1<T2, T3> la2 = a2 ;
7374
74- if (_1 .size () != _2 .size ())
75- return ( p () );
75+ if (la1 .size () != la2 .size ())
76+ return p ( );
7677
77- for (; !_1 .empty (); _1 .pop (), _2 .pop ())
78- if (!compare (_1 .top (), _2 .top (), p))
79- return ( false ) ;
80- return ( true ) ;
78+ for (; !la1 .empty (); la1 .pop (), la2 .pop ())
79+ if (!compare (la1 .top (), la2 .top (), p))
80+ return false ;
81+ return true ;
8182 }
8283
83- template <template <typename _1 , typename _2 , typename _3 > class T1 , typename T2, typename T3, typename T4>
84- IC static bool compare (const T1<T2, T3, T4>& __1 , const T1<T2, T3, T4>& __2 , const P& p, bool )
84+ template <template <typename T1X , typename T2X , typename T3X > class T1 , typename T2, typename T3, typename T4>
85+ IC static bool compare (const T1<T2, T3, T4>& a1 , const T1<T2, T3, T4>& a2 , const P& p, bool )
8586 {
86- T1<T2, T3, T4> _1 = __1 ;
87- T1<T2, T3, T4> _2 = __2 ;
87+ T1<T2, T3, T4> la1 = a1 ;
88+ T1<T2, T3, T4> la2 = a2 ;
8889
89- if (_1 .size () != _2 .size ())
90- return ( p () );
90+ if (la1 .size () != la2 .size ())
91+ return p ( );
9192
92- for (; !_1 .empty (); _1 .pop (), _2 .pop ())
93- if (!compare (_1 .top (), _2 .top (), p))
94- return ( false ) ;
95- return ( true ) ;
93+ for (; !la1 .empty (); la1 .pop (), la2 .pop ())
94+ if (!compare (la1 .top (), la2 .top (), p))
95+ return false ;
96+ return true ;
9697 }
9798
9899 template <typename T1, typename T2>
99- IC static bool compare (const xr_stack<T1, T2>& _1 , const xr_stack<T1, T2>& _2 , const P& p)
100+ IC static bool compare (const xr_stack<T1, T2>& s1 , const xr_stack<T1, T2>& s2 , const P& p)
100101 {
101- return ( compare (_1, _2 , p, true ) );
102+ return compare (s1, s2 , p, true );
102103 }
103104
104105 template <typename T1, typename T2, typename T3>
105106 IC static bool compare (
106- const std::priority_queue<T1, T2, T3>& _1 , const std::priority_queue<T1, T2, T3>& _2 , const P& p)
107+ const std::priority_queue<T1, T2, T3>& q1 , const std::priority_queue<T1, T2, T3>& q2 , const P& p)
107108 {
108- return ( compare (_1, _2 , p, true ) );
109+ return compare (q1, q2 , p, true );
109110 }
110111
111112 struct CHelper3
112113 {
113114 template <typename T>
114- IC static bool compare (const T& _1 , const T& _2 , const P& p)
115+ IC static bool compare (const T& a1 , const T& a2 , const P& p)
115116 {
116- if (_1 .size () != _2 .size ())
117- return ( p () );
117+ if (a1 .size () != a2 .size ())
118+ return p ( );
118119
119- T::const_iterator I = _1 .begin (), J = _2 .begin ();
120- T::const_iterator E = _1 .end ();
120+ T::const_iterator I = a1 .begin (), J = a2 .begin ();
121+ T::const_iterator E = a1 .end ();
121122 for (; I != E; ++I, ++J)
122123 if (!CComparer::compare (*I, *J, p))
123- return ( false ) ;
124- return ( true ) ;
124+ return false ;
125+ return true ;
125126 }
126127 };
127128
128129 template <typename T>
129130 struct CHelper4
130131 {
131132 template <bool a>
132- IC static bool compare (const T& _1 , const T& _2 , const P& p)
133+ IC static bool compare (const T& a1 , const T& a2 , const P& p)
133134 {
134- return ( CHelper<T>::compare<object_type_traits::is_pointer<T>::value>(_1, _2 , p) );
135+ return CHelper<T>::compare<object_type_traits::is_pointer<T>::value>(a1, a2 , p);
135136 }
136137
137138 template <>
138- IC static bool compare<true >(const T& _1 , const T& _2 , const P& p)
139+ IC static bool compare<true >(const T& a1 , const T& a2 , const P& p)
139140 {
140- return ( CHelper3::compare (_1, _2 , p) );
141+ return CHelper3::compare (a1, a2 , p);
141142 }
142143 };
143144
144145 template <typename T>
145- IC static bool compare (const T& _1 , const T& _2 , const P& p)
146+ IC static bool compare (const T& a1 , const T& a2 , const P& p)
146147 {
147- return ( CHelper4<T>::compare<object_type_traits::is_stl_container<T>::value>(_1, _2 , p) );
148+ return CHelper4<T>::compare<object_type_traits::is_stl_container<T>::value>(a1, a2 , p);
148149 }
149150};
150151
151152template <typename P>
152153IC bool compare (LPCSTR p0, LPSTR p1, const P& p)
153154{
154- return ( p (p0, p1) );
155+ return p (p0, p1);
155156}
156157
157158template <typename P>
158159IC bool compare (LPSTR p0, LPCSTR p1, const P& p)
159160{
160- return ( p (p0, p1) );
161+ return p (p0, p1);
161162}
162163
163164template <typename T, typename P>
164165IC bool compare (const T& p0, const T& p1, const P& p)
165166{
166- return ( CComparer<P>::compare (p0, p1, p) );
167+ return CComparer<P>::compare (p0, p1, p);
167168}
168169
169170namespace object_comparer
170171{
171172namespace detail
172173{
173- template <template <typename _1 > class P >
174+ template <template <typename TX > class P >
174175struct comparer
175176{
176177 template <typename T>
177- IC bool operator ()(const T& _1 , const T& _2 ) const
178+ IC bool operator ()(const T& a1 , const T& a2 ) const
178179 {
179- return ( P<T>()(_1, _2) );
180+ return P<T>()(a1, a2 );
180181 }
181- IC bool operator ()() const { return ( P<bool >()(false , true ) ); }
182- IC bool operator ()(LPCSTR _1 , LPCSTR _2 ) const { return (P<int >()(xr_strcmp (_1, _2 ), 0 )); }
183- IC bool operator ()(LPSTR _1 , LPSTR _2 ) const { return (P<int >()(xr_strcmp (_1, _2 ), 0 )); }
184- IC bool operator ()(LPCSTR _1 , LPSTR _2 ) const { return (P<int >()(xr_strcmp (_1, _2 ), 0 )); }
185- IC bool operator ()(LPSTR _1 , LPCSTR _2 ) const { return (P<int >()(xr_strcmp (_1, _2 ), 0 )); }
182+ IC bool operator ()() const { return P<bool >()(false , true ); }
183+ IC bool operator ()(LPCSTR s1 , LPCSTR s2 ) const { return (P<int >()(xr_strcmp (s1, s2 ), 0 )); }
184+ IC bool operator ()(LPSTR s1 , LPSTR s2 ) const { return (P<int >()(xr_strcmp (s1, s2 ), 0 )); }
185+ IC bool operator ()(LPCSTR s1 , LPSTR s2 ) const { return (P<int >()(xr_strcmp (s1, s2 ), 0 )); }
186+ IC bool operator ()(LPSTR s1 , LPCSTR s2 ) const { return (P<int >()(xr_strcmp (s1, s2 ), 0 )); }
186187};
187188};
188189};
0 commit comments