@@ -163,82 +163,70 @@ class edge_descriptor final {
163163 return this ->_properties .get ();
164164 }
165165
166- friend gl_attr_force_inline std::ostream& operator <<(
167- std::ostream& os, const edge_descriptor& edge
168- ) {
169- return edge._write (os);
166+ friend std::ostream& operator <<(std::ostream& os, const edge_descriptor& edge) {
167+ using enum io::detail::option_bit;
168+
169+ if (io::is_option_set (os, verbose))
170+ return edge._verbose_write (os);
171+ else
172+ return edge._concise_write (os);
170173 }
171174
172175private:
173- std::ostream& _write (std::ostream& os) const
176+ std::ostream& _verbose_write (std::ostream& os) const
174177 requires std::same_as<directional_tag, undirected_t>
175178 {
176- using io::detail::option_bit;
177-
178- if constexpr (not traits::c_writable<properties_type>) {
179- return this ->_write_no_properties (os);
180- }
181- else {
182- if (not io::is_option_set (os, option_bit::with_connection_properties))
183- return this ->_write_no_properties (os);
184-
185- if (io::is_option_set (os, option_bit::verbose))
186- return os
187- << " [id: " << this ->_id << " | endpoints: {" << this ->_vertices .first << " , "
188- << this ->_vertices .second << " } | " << this ->_properties .get () << ' ]' ;
189- else
190- return os << ' {' << this ->_vertices .first << " , " << this ->_vertices .second << " }["
191- << this ->_properties .get () << ' ]' ;
192- }
179+ using enum io::detail::option_bit;
180+
181+ os << " [id: " << this ->_id << " | endpoints: {" << this ->_vertices .first << " , "
182+ << this ->_vertices .second << ' }' ;
183+ if constexpr (traits::c_writable<properties_type>)
184+ if (io::is_option_set (os, with_connection_properties))
185+ os << " | " << this ->_properties .get ();
186+ os << ' ]' ;
187+
188+ return os;
193189 }
194190
195- // TODO: rm
196- std::ostream& _write_no_properties (std::ostream& os) const
191+ std::ostream& _concise_write (std::ostream& os) const
197192 requires std::same_as<directional_tag, undirected_t>
198193 {
199- using io::detail::option_bit;
194+ using enum io::detail::option_bit;
200195
201- if (io::is_option_set (os, option_bit::verbose))
202- return os << " [id: " << this ->_id << " | endpoints: {" << this ->_vertices .first << " , "
203- << this ->_vertices .second << " }]" ;
204- else
205- return os << ' {' << this ->_vertices .first << " , " << this ->_vertices .second << ' }' ;
196+ os << ' {' << this ->_vertices .first << " , " << this ->_vertices .second << ' }' ;
197+ if constexpr (traits::c_writable<properties_type>)
198+ if (io::is_option_set (os, with_vertex_properties))
199+ os << ' [' << this ->_properties .get () << ' ]' ;
200+
201+ return os;
206202 }
207203
208- std::ostream& _write (std::ostream& os) const
204+ std::ostream& _verbose_write (std::ostream& os) const
209205 requires std::same_as<directional_tag, directed_t>
210206 {
211- using io::detail::option_bit;
212-
213- if constexpr (not traits::c_writable<properties_type>) {
214- return this ->_write_no_properties (os);
215- }
216- else {
217- if (not io::is_option_set (os, option_bit::with_connection_properties))
218- return this ->_write_no_properties (os);
219-
220- if (io::is_option_set (os, option_bit::verbose))
221- return os
222- << " [id: " << this ->_id << " | source: " << this ->_vertices .first
223- << " , target: " << this ->_vertices .second << " | " << this ->_properties .get ()
224- << ' ]' ;
225- else
226- return os << ' (' << this ->_vertices .first << " , " << this ->_vertices .second << " )["
227- << this ->_properties .get () << ' ]' ;
228- }
207+ using enum io::detail::option_bit;
208+
209+ os << " [id: " << this ->_id << " | source: " << this ->_vertices .first
210+ << " , target: " << this ->_vertices .second ;
211+ if constexpr (traits::c_writable<properties_type>)
212+ if (io::is_option_set (os, with_connection_properties))
213+ os << " | " << this ->_properties .get ();
214+ os << ' ]' ;
215+
216+ return os;
229217 }
230218
231- // TODO: rm
232- std::ostream& _write_no_properties (std::ostream& os) const
219+ std::ostream& _concise_write (std::ostream& os) const
233220 requires std::same_as<directional_tag, directed_t>
234221 {
235- using io::detail::option_bit;
222+ using enum io::detail::option_bit;
236223
237- if (io::is_option_set (os, option_bit::verbose))
238- return os << " [id: " << this ->_id << " | source: " << this ->_vertices .first
239- << " , target: " << this ->_vertices .second << ' ]' ;
240- else
241- return os << ' (' << this ->_vertices .first << " , " << this ->_vertices .second << ' )' ;
224+ os << ' (' << this ->_vertices .first << " , " << this ->_vertices .second << ' )' ;
225+ if constexpr (traits::c_writable<properties_type>)
226+ if (io::is_option_set (os, with_vertex_properties))
227+ os << ' [' << this ->_properties .get () << ' ]' ;
228+
229+ return os;
242230 }
243231
244232 id_type _id;
0 commit comments