acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_impl_write_text_stream.h
1//
2// Created by camilo on 23/12/22.
3//
4#pragma once
5
6
7
8
9// public PARTICLE_FLAGS,
10// public print_formatting
11//{
12//public:
13
14
15// FILE * m_pfile;
16// ::i8 m_chSeparator = ' ';
17//#ifdef WINDOWS
18// const_char_pointer m_pszEolSeparator = "\r\n";
19//#else
20// const_char_pointer m_pszEolSeparator = "\n";
21//#endif
22
24//inline write_text_stream < FILE >::write_text_stream()
25//{
26//
27//
28//}
29//
30//
32//inline write_text_stream < FILE >::write_text_stream(FILE* pfile)
33//{
34//
35// m_pfile = pfile;
36//
37// //set_ok_flag();
38//
39// //if (pfile->has_storing_flag())
40// //{
41//
42// // defer_set_storing_flag();
43//
44// //}
45//
46//}
47//
48//
49//
52//
54//write_text_stream < FILE >::~write_text_stream()
55//{
56//
57//
58//}
59//
60//
61// // void destroy() ;
62//
63// //void destroy() {}
64//
65// //string as_string() const;
66//
67//
68// //FILE * get_file() { return m_pfile; }
69//
70//
71// //::file::file* get_file()
72// //{
73//
74// // return m_pfile;
75//
76// //}
77//
78// //template < prototype_integral INTEGRAL >
79// //void number_read(TYPE& t)
80// //{
81//
82// // const ::i8 endptr = nullptr;
83//
84// // auto hn = strtoull(m_str, &endptr, 10);
85//
86// // if (!endptr)
87// // {
88//
89// // set_fail_flag();
90//
91// // }
92// // else
93// // {
94//
95// //
96//
97// // }
98//
99// // ::copy(t, str);
100//
101// //}
102//
110//
112//template < prototype_number NUMBER >
113//void write_text_stream < FILE >::write_number(NUMBER number)
114//{
115//
116// print(as_string(number));
117//
118//}
119//
120//
122//template < prototype_number NUMBER >
123//void write_text_stream < FILE >::write_number(NUMBER number, const_char_pointer pszFormat)
124//{
125//
126// print(as_string(number, pszFormat));
127//
128//}
129//
130// /*template < typename TYPE >
131// void number_exchange(TYPE& t)
132// {
133//
134// has_loading_flag() ? number_read(t) : number_write(t);
135//
136// }*/
137//
138//
139// //template < typename TYPE >
140// //void string_read(TYPE& t)
141// //{
142//
143// // string str = read_string();
144//
145// // ::from_string(t, str);
146//
147// //}
148//
149//
150// //template < typename TYPE >
151// //void string_write(const TYPE& t)
152// //{
153//
154// // string str;
155//
156// // str = as_string(t);
157//
158// // print(str);
159//
160// //}
161//
162//
163// //template < typename TYPE >
164// //void string_exchange(TYPE& t)
165// //{
166//
167// // has_loading_flag() ? string_read(t) : string_write(t);
168//
169// //}
170//
171//
172// //template < typename TYPE >
173// //void network_payload_exchange(TYPE& t);
174//
175//
176// /*template < typename TYPE >
177// void write_only(TYPE & t) { is_loading() ? throw_exception(error_io) : operator <<(t); }
178//
179// template < typename TYPE >
180// void exchange(const ::atom & atom, TYPE & t) { ::__string_exchange(*this, t); }*/
181//
182// // template < typename FILE >
183// void write_text_stream < FILE >::append_format(const_char_pointer pszFormat, ...)
184// {
185//
186// ::string strText;
187//
188// ASSERT(is_string_ok(scopedstrFormat));
189//
190// va_list argList;
191//
192// va_start(argList, pszFormat);
193//
194// strText.formatf_arguments(scopedstrFormat, argList);
195//
196// va_end(argList);
197//
198// print(strText);
199//
200// }
201//
202//
203// //bool is_stream_null();
204// //bool is_stream_set();
205//
206// //void close() {}
207//
208//
210//void write_text_stream < FILE >::new_line()
211//{
212//
213// if (this->fmtflags() & ::file::separated)
214// {
215//
216// m_pfile->unget_if(m_chSeparator);
217//
218// }
219//
220// print(m_pszEolSeparator);
221//
222//}
223//
224//
226//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(bool b)
227//{
228//
229// if(b)
230// {
231//
232// print("1");
233//
234// }
235// else
236// {
237//
238// print("0");
239//
240// }
241//
242// if (this->fmtflags() & ::file::separated)
243// {
244//
245// print(m_chSeparator);
246//
247// }
248//
249// return *this;
250//
251//}
252//
253//
255//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(::i8 ch)
256//{
257//
258// write(&ch, 1);
259//
260// if (this->fmtflags() & ::file::separated)
261// {
262//
263// print(m_chSeparator);
264//
265// }
266//
267// return *this;
268//
269//}
270//
271//
273//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(enum_start_reference)
274//{
275//
276// return *this;
277//
278//}
279//
280//
282//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(uchar uch)
283//{
284//
285// write(&uch, 1);
286//
287// if (this->fmtflags() & ::file::separated)
288// {
289//
290// print(m_chSeparator);
291//
292// }
293//
294// return *this;
295//
296//}
297//
298//
299//#ifdef WINDOWS
300//
301//
303//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(unichar wch)
304//{
305//
306// ::i8 sz[10];
307//
308// wd16_to_ansi(sz, &wch, 1);
309//
310// print(sz);
311//
312// if (this->fmtflags() & ::file::separated)
313// {
314//
315// print(m_chSeparator);
316//
317// }
318//
319// return *this;
320//
321//}
322//
323//
324//#endif
325//
326//
328//template < prototype_signed_not_8bit SIGNED >
329//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(SIGNED i)
330//{
331//
332// write_number(i);
333//
334// if (this->fmtflags() & ::file::separated)
335// {
336//
337// print(m_chSeparator);
338//
339// }
340//
341// return *this;
342//
343//}
344//
345//
347//template < prototype_unsigned_not_8bit UNSIGNED >
348//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(UNSIGNED u)
349//{
350//
351// write_number(u);
352//
353// if (this->fmtflags() & ::file::separated)
354// {
355//
356// print(m_chSeparator);
357//
358// }
359//
360// return *this;
361//
362//}
363//
364//
366//template < typename T >
367//void write_text_stream < FILE >::print_string_copy(const T& t)
368//{
369//
370// ::string str;
371//
372// ::copy(str, t);
373//
374// print(str);
375//
376//}
377//
378//
379//
380// //write_text_stream& operator <<(::i32 i)
381// //{
382//
383// // write_integer(i);
384//
385// // print(m_chSeparator);
386//
387// // return *this;
388//
389// //}
390//
391//
392// //write_text_stream& operator <<(::u32 u)
393// //{
394//
395// // write_natural(u);
396//
397// // print(m_chSeparator);
398//
399// // return *this;
400//
401// //}
402//
403//
404// //write_text_stream& operator <<(::i64 i)
405// //{
406//
407// // write_integer(i);
408//
409// // print(m_chSeparator);
410//
411// // return *this;
412//
413// //}
414//
415//
416// //write_text_stream& operator <<(::u64 u)
417// //{
418//
419// // write_natural(u);
420//
421// // print(m_chSeparator);
422//
423// // return *this;
424//
425// //}
426//
427//
429//template < prototype_floating FLOATING >
430//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(FLOATING f)
431//{
432//
433// string strFormat;
434//
435// strFormat.formatf("%%0%d.%df", m_pprintingformat->m_width, m_pprintingformat->m_precision);
436//
440//
441// write_number(f, strFormat);
442//
443// if (this->fmtflags() & ::file::separated)
444// {
445//
446// print(m_chSeparator);
447//
448// }
449//
450// return *this;
451//
452//}
453//
454//
482//
483// // void write(const ::i32_point & point) ;
484// // void write(const ::i32_size & size) ;
485// // void write(const ::i32_rectangle &rectangle) ;
486//
487//
489//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(const_char_pointer psz)
490//{
491//
492// if (this->fmtflags() & ::file::network_payload)
493// {
494//
495// print("\"");
496//
497// }
498//
499// print(scopedstr);
500//
501// if (this->fmtflags() & ::file::network_payload)
502// {
503//
504// print("\"");
505//
506// }
507//
508// if (this->fmtflags() & ::file::separated)
509// {
510//
511// print(m_chSeparator);
512//
513// }
514//
515// return *this;
516//
517//}
518//
519//
521//write_text_stream < FILE > & write_text_stream < FILE >::operator <<(const ::scoped_string & scopedstr)
522// {
523//
524// return this->operator <<((const ::scoped_string &)str);
525//
526// }
527//
528// //text_stream & operator <<(const ::atom & atom) ;
529// // template < typename FILE >
530// write_text_stream < FILE > & write_text_stream < FILE >::operator <<(const ::scoped_string & scopedstr)
531// {
532//
533// if (this->fmtflags() & ::file::network_payload)
534// {
535//
536// print("\"");
537//
538// }
539//
540// print(scopedstr);
541//
542// if (this->fmtflags() & ::file::network_payload)
543// {
544//
545// print("\"");
546//
547// }
548//
549// if (this->fmtflags() & ::file::separated)
550// {
551//
552// print(m_chSeparator);
553//
554// }
555//
556// return *this;
557//
558// }
559//
560//
561// // template < typename FILE >
562// template < prototype_character CHARACTER2, character_count sizeMaximumLength >
563// write_text_stream < FILE > & write_text_stream < FILE >::operator <<(const ::inline_string < CHARACTER2, sizeMaximumLength > & inlinestring)
564// {
565//
566// if (this->fmtflags() & ::file::network_payload)
567// {
568//
569// print("\"");
570//
571// }
572//
573// write(inlinestring.data(), inlinestring.size());
574//
575// if (this->fmtflags() & ::file::network_payload)
576// {
577//
578// print("\"");
579//
580// }
581//
582// if (this->fmtflags() & ::file::separated)
583// {
584//
585// print(m_chSeparator);
586//
587// }
588//
589// return *this;
590//
591// }
592//
593//
594// //text_stream & operator <<(const ::property_set & set) ;
595//
596//
597// // template < typename FILE >
598// template < typename TYPE >
599// write_text_stream < FILE > & write_text_stream < FILE >::write(const TYPE& t)
600// {
601//
602// return *this << t;
603//
604// }
605//
606// // void network_payload_write(const ::matter & matter);
607//
608//
610//void write_text_stream < FILE >::raw_print(const ::scoped_string & scopedstr)
611// {
612//
613// print(str);
614//
615// }
616//
617//
618// //void print_number(const ::scoped_string & scopedstr)
619// //{
620//
621// // print_number(str);
622//
623// //}
624//
625// //::string get_location() const;
626//
627// //::filesize get_position() const ;
628// // template < typename FILE >
629// void write_text_stream < FILE >::write(const void* psz, character_count s)
630// {
631//
632// m_pfile->write({ psz, s });
633//
634// }
635//
636// //operator void* () { return this; }
637//
660//
662//
663//
694//
695//
703//
704//
706//void write_text_stream < FILE >::print(const ::scoped_string& str)
707//{
708//
709// m_pfile->write(str.as_block());
710//
711//}
712//