acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
_impl.h
1
#pragma once
2
3
4
5
#include "file/_impl.h"
6
#include "filesystem/_impl.h"
7
8
9
namespace
file
10
{
11
12
13
}
// namespace file
14
15
16
//template < class T >
17
//bool file_context::output(::file::file * pfileOut, T * p, bool (T:: * pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
18
//{
19
//
20
// ::file::path pathDownloading;
21
//
22
// try
23
// {
24
//
25
// //stream outputstream(pparticle, FIRST_VERSION);
26
//
27
// //if (!prepare_output(pparticle, outputstream, pathDownloading, os))
28
// //{
29
//
30
// // return false;
31
//
32
// //}
33
//
34
// //stream inputstream(pparticle, FIRST_VERSION);
35
//
36
// //if (!prepare_input(pparticle, inputstream, is))
37
// //{
38
//
39
// // return false;
40
//
41
// //}
42
//
43
// if (!(p->*pfnOuput)(pfileOut, pfileIn))
44
// {
45
//
46
// return false;
47
//
48
// }
49
//
50
// }
51
// catch (...)
52
// {
53
//
54
// return false;
55
//
56
// }
57
//
58
// //try
59
// //{
60
//
61
// // if (!post_output(pparticle, os.m_pfile->GetFilePath(), pathDownloading))
62
// // {
63
//
64
// // return false;
65
//
66
// // }
67
//
68
// //}
69
// //catch (...)
70
// //{
71
//
72
// // return false;
73
//
74
// //}
75
//
76
// return true;
77
//
78
//}
79
80
81
//template < class T >
82
//bool ::file::system::output(::particle * pparticle, const ::file::path & pathOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
83
//{
84
85
// ::file::path pathDownloading;
86
87
// try
88
// {
89
90
// stream os(pparticle, FIRST_VERSION);
91
92
// if (!prepare_output(pparticle, os, pathDownloading, pathOut, nullptr))
93
// {
94
95
// return false;
96
97
// }
98
99
// stream is(pparticle, FIRST_VERSION);
100
101
// if (!prepare_input(pparticle, is, pfileIn))
102
// {
103
104
// return false;
105
106
// }
107
108
// if (!(i32_point->*pfnOuput)(&os, &is))
109
110
// {
111
112
// return false;
113
114
// }
115
116
// }
117
// catch (...)
118
// {
119
120
// return false;
121
122
// }
123
124
125
// try
126
// {
127
128
// if (!post_output(pparticle, pathOut, pathDownloading))
129
// {
130
131
// return false;
132
133
// }
134
135
// }
136
// catch (...)
137
// {
138
139
// return false;
140
141
// }
142
143
// return true;
144
145
//}
146
147
148
//template < class T >
149
//bool system::output(::particle * pparticle, const ::file::path & pathOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
150
//{
151
152
// ::file::path pathDownloading;
153
154
// try
155
// {
156
157
// stream os(pparticle, FIRST_VERSION);
158
159
// if (!prepare_output(pparticle, os, pathDownloading, pathOut, nullptr))
160
// {
161
162
// return false;
163
164
// }
165
166
// if (!prepare_input(pparticle, is, pfileIn))
167
// {
168
169
// return false;
170
171
// }
172
173
// if (!(p->*pfnOuput)(&os, &is))
174
// {
175
176
// return false;
177
178
// }
179
180
// }
181
// catch (...)
182
// {
183
184
// return false;
185
186
// }
187
188
// try
189
// {
190
191
// if (!post_output(pparticle, pathOut, pathDownloading))
192
// {
193
194
// return false;
195
196
// }
197
198
// }
199
// catch (...)
200
// {
201
202
// return false;
203
204
// }
205
206
// return true;
207
//}
208
209
210
//template < class T >
211
//bool ::file::system::output(::particle * pparticle, ::file::file * pfileOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), const ::file::path & pathIn)
212
//{
213
214
// ::file::path pathDownloading;
215
216
// try
217
// {
218
219
// stream os(pparticle, FIRST_VERSION);
220
221
// if (!prepare_output(pparticle, os, pathDownloading, "", pfileOut))
222
// {
223
224
// return false;
225
226
// }
227
228
// stream is(pparticle, FIRST_VERSION);
229
230
// if (!prepare_input(pparticle, is, pathIn))
231
// {
232
233
// return false;
234
235
// }
236
237
// if (!(p->*pfnOuput)(&os, &is))
238
// {
239
240
// return false;
241
242
// }
243
244
// }
245
// catch (...)
246
// {
247
248
// return false;
249
250
// }
251
252
// return true;
253
254
//}
255
256
257
//template < class T >
258
//bool ::file::system::output(::particle * pparticle, ::file::file * pfileOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
259
//{
260
261
// ::file::path pathDownloading;
262
263
// try
264
// {
265
266
// stream os(pparticle, FIRST_VERSION);
267
268
// if (!prepare_output(pparticle, os, pathDownloading, "", pfileOut))
269
// {
270
271
// return false;
272
273
// }
274
275
// stream is(pparticle, FIRST_VERSION);
276
277
// if (!prepare_input(pparticle, is, pfileIn))
278
// {
279
280
// return false;
281
282
// }
283
284
// if (!(p->*pfnOuput)(&os, &is))
285
286
// {
287
288
// return false;
289
290
// }
291
292
// }
293
// catch (...)
294
// {
295
296
// return false;
297
298
// }
299
300
// return true;
301
302
//}
303
304
305
//template < class T >
306
//bool system::output(::particle * pparticle, ::file::file * pfileOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
307
//{
308
309
// ::file::path pathDownloading;
310
311
// try
312
// {
313
314
// stream os(pparticle, FIRST_VERSION);
315
316
// if (!prepare_output(pparticle, os, pathDownloading, "", pfileOut))
317
// {
318
319
// return false;
320
321
// }
322
323
// if (!prepare_input(pparticle, is, pfileIn))
324
// {
325
326
// return false;
327
328
// }
329
330
// if (!(p->*pfnOuput)(&os, &is))
331
332
// {
333
334
// return false;
335
336
// }
337
338
// }
339
// catch (...)
340
// {
341
342
// return false;
343
344
// }
345
346
// return true;
347
348
//}
349
350
351
//template < class T >
352
//bool ::file::system::output(::particle * pparticle, ::file::file * pfileOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), const ::file::path & pathIn)
353
//{
354
355
// ::file::path pathDownloading;
356
357
// try
358
// {
359
360
// stream is(pparticle, FIRST_VERSION);
361
362
// if (!prepare_input(pparticle, is, pathIn))
363
// {
364
365
// return false;
366
367
// }
368
369
// if (!(i32_point->*pfnOuput)(os, is))
370
371
// {
372
373
// return false;
374
375
// }
376
377
// }
378
// catch (...)
379
// {
380
381
// return false;
382
383
// }
384
385
// return true;
386
387
//}
388
389
390
//template < class T >
391
//bool ::file::system::output(::particle * pparticle, ::file::file & os, T * point, bool (T::*pfnOuput)(::file::file &, ::file::file &), ::file::file * pfileIn)
392
393
//{
394
395
// ::file::path pathDownloading;
396
397
// try
398
// {
399
400
// stream is(pparticle, FIRST_VERSION);
401
402
// if (!prepare_input(pparticle, is, pfileIn))
403
// {
404
405
// return false;
406
407
// }
408
409
// if (!(i32_point->*pfnOuput)(os, is))
410
411
// {
412
413
// return false;
414
415
// }
416
417
// }
418
// catch (...)
419
// {
420
421
// return false;
422
423
// }
424
425
// return true;
426
427
//}
428
429
430
//template < class T >
431
//bool system::output(::particle * pparticle, ::file::file & os, T * point, bool (T::*pfnOuput)(::file::file &, ::file::file &), ::file::file * preader)
432
//{
433
434
// ::file::path pathDownloading;
435
436
// try
437
// {
438
439
// stream is;
440
441
// if (!prepare_input(pparticle, is, preader))
442
// {
443
444
// return false;
445
446
// }
447
448
// if (!(i32_point->*pfnOuput)(os, is))
449
450
// {
451
452
// return false;
453
454
// }
455
456
// }
457
// catch (...)
458
// {
459
460
// return false;
461
462
// }
463
464
// return true;
465
466
//}
467
468
//}
469
470
//template < class T >
471
//bool file_context::output(::file::file * pfileOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
472
//{
473
//
474
// return file()->output(get_app(), pfileOut, p, pfnOuput, pfileIn);
475
//
476
//}
477
478
479
//template < class T >
480
//bool application::output(const ::file::path & pathOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
481
//{
482
483
// return file()->output(get_app(), pathOut, p, pfnOuput, pfileIn);
484
485
//}
486
487
488
//template < class T >
489
//bool application::output(const ::file::path & pathOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
490
//{
491
492
// return file()->output(get_app(), pathOut, point, pfnOuput, istream);
493
494
//}
495
496
497
//template < class T >
498
//bool application::output(::file::file * pfileOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), const ::file::path & pathIn)
499
//{
500
501
// return file()->output(get_app(), pfileOut, point, pfnOuput, pathIn);
502
503
504
//}
505
506
507
//template < class T >
508
//bool application::output(::file::file * pfileOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
509
//{
510
511
// return file()->output(get_app(), pfileOut, p, pfnOuput, pfileIn);
512
513
//}
514
515
516
//template < class T >
517
//bool application::output(::file::file * pfileOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
518
//{
519
520
// return file()->output(get_app(), pfileOut, p, pfnOuput, pfileIn);
521
522
//}
523
524
525
//template < class T >
526
//bool application::output(::file::file * pfileOut, T * p, bool (T::* pfnOuput)(::file::file*, ::file::file*), ::file::file * pfileIn)
527
//{
528
529
// return file()->output(get_app(), os, p, pfnOuput, pathIn);
530
531
//}
532
533
534
//template < class T >
535
//bool application::output(::file::file * pfileOut, T * p, bool (T::*pfnOuput)(::file::file *, ::file::file *), ::file::file * pfileIn)
536
//{
537
538
// return file()->output(get_app(), os, p, pfnOuput, pfileIn);
539
540
//}
541
542
543
//template < class T >
544
//bool application::output(::file::file& os, T * point, bool (T::*pfnOuput)(::file::file &, ::file::file &), ::file::file & istream)
545
546
//{
547
548
// return file()->output(get_app(), os, point, pfnOuput, istream);
549
550
551
//}
552
553
554
//} // namespace file
555
556
557
//inline ::file::path operator + (const ::scoped_string & scopedstr,const ::file::path & path) { return ::file::path(str + string(path)); }
558
//inline ::file::path operator + (const ::scoped_string & scopedstr,const ::file::path & path) { return ::file::path(scopedstr + string(path)); }
559
// xxxabc inline ::file::path operator + (const ::payload & payload,const ::file::path & path) { return ::file::path(payload.string() + string(path)); }
560
//inline ::file::path operator / (const ::scoped_string & scopedstr,const ::file::path & path) { ::file::path i32_point(str); return point / path; }
561
//inline ::file::path operator / (const ::scoped_string & scopedstr,const ::file::path & path) { ::file::path i32_point(scopedstr); return point / path; }
562
// xxxabc inline ::file::path operator / (const ::payload & payload,const ::file::path & path) { ::file::path i32_point(payload.get_file_path()); return point / path; }
563
564
565
566
// template < class ARRAY >
567
// bool file_put_array(const ::file::path & path, ARRAY & a, ::platform::application * papp)
568
// {
569
570
571
// try
572
// {
573
574
// if (papp == nullptr)
575
// {
576
577
// papp = get_app();
578
579
// }
580
581
// if (papp == nullptr)
582
// {
583
584
// return false;
585
586
// }
587
588
// file_pointer pfile = App(papp).file()->get_file(path, ::file::e_open_create | ::file::e_open_write | ::file::e_open_binary | ::file::e_open_defer_create_directory);
589
590
// if (pfile.is_null())
591
// {
592
593
// return false;
594
595
// }
596
597
// stream stream(pfile, FIRST_VERSION);
598
599
// ::collection::count count = a.get_count();
600
601
// stream.write(count);
602
603
// for (::collection::index index = 0; index < count; index++)
604
// {
605
606
// stream << a.element_at(index);
607
608
// }
609
610
// return true;
611
612
// }
613
// catch (...)
614
// {
615
616
// }
617
618
// return false;
619
620
// }
621
622
623
// template < class ARRAY >
624
// bool file_as_array(ARRAY & a, const ::file::path & path, ::platform::application * papp)
625
// {
626
627
// try
628
// {
629
630
// if (papp == nullptr)
631
// {
632
633
// papp = get_app();
634
635
// }
636
637
// if (papp == nullptr)
638
// {
639
640
// return false;
641
642
// }
643
644
// file_pointer pfile = App(papp).file()->get_file(path, ::file::e_open_read | ::file::e_open_binary);
645
646
// if (pfile.is_null())
647
// {
648
649
// return false;
650
651
// }
652
653
// stream istream(pfile, FIRST_VERSION);
654
655
// ::collection::count count;
656
657
// istream.read(count);
658
659
// if (istream.fail())
660
// {
661
662
// return false;
663
664
// }
665
666
// a.allocate(count);
667
668
// for (::collection::index index = 0; index < count; index++)
669
// {
670
671
// istream >> a.element_at(index);
672
673
// if (istream.fail())
674
// {
675
676
// return false;
677
678
// }
679
680
// }
681
682
// a.on_after_read();
683
684
// return true;
685
686
// }
687
// catch (...)
688
// {
689
690
691
// }
692
693
// return false;
694
695
// }
696
697
698
699
//inline stream & operator << (stream & s, const ::file::path_object & path)
700
//{
701
//
702
// return s << (const ::file::path&)path;
703
//
704
//}
705
//
706
//
707
//inline stream & operator >>(stream & s, ::file::path_object & path)
708
//{
709
//
710
// return s >> (::file::path &)path;
711
//
712
//}
713
714
// namespace file
715
//{
716
717
//inline string path_object::to_string() const
718
//{
719
720
// return (const path&)*this;
721
722
//}
723
724
725
726
727
728
729
730
//} // namespace file
731
732
733
734
735
736
inline
const_char_pointer FormatArgument(const ::file::path & value)
noexcept
737
{
738
return
value.c_str();
739
}
740
741
742
template
< >
743
inline ::hash32 as_hash32 < const ::file::path & >(const ::file::path & key)
744
{
745
746
return ::as_hash32((
const
string
&) key);
747
748
}
749
750
751
//inline stream & operator << (stream & s, const ::file::path & path)
752
//{
753
//
754
// return s << (const string &)path;
755
//
756
//}
757
758
759
//inline stream & operator >> (stream & s, ::file::path & path)
760
//{
761
//
762
// string str;
763
//
764
// s >> str;
765
//
766
// path = str;
767
//
768
// return s;
769
//
770
//}
771
772
773
774
775
file
Definition
filesystem.h:16
filesystem
_impl.h
Generated by
1.17.0