[Issue 9716] New: Feature request for std.stdio
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 14 03:45:21 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9716
Summary: Feature request for std.stdio
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bioinfornatics at gmail.com
--- Comment #0 from bioinfornatics <bioinfornatics at gmail.com> 2013-03-14 03:45:19 PDT ---
Dear,
When you need to manage various file format and trying to fit as a phobos File
it appear below feature could be really interesting.
by example you have a parser you want to construct is from various file type
you can grant some methods.
-----------------------------------------------------------
template isFileType(F)
{
enum bool isFileType = is(typeof(
{
ubyte[] buf;
F f = void; // can define a FileType object
if (f.eof) {} // can test for end of file
if (f.isOpen) {} // can test for opened file
f.name; // can invoke name
f.close(); // can invoke close
r.write(); // can invoke write()
r.rawWrite( "" ); // can invoke rawWrite()
r.rawRead( buf ); // can invoke rawRead()
}));
}
struct FileType( F ) if( isFileType( F ) )
{
F _f;
this( F file ){
_f = file;
}
alias _f this;
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list