www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9716] New: Feature request for std.stdio

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bioinfornatics gmail.com



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: -------
Mar 14 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9716




17:29:05 PDT ---
By example we can do with it a range to manage both stream and file

http://dpaste.dzfl.pl/1f2bcf39

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 17 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9716


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



I suggest you to give a more precise title to this issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 17 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9716




01:05:51 PDT ---
English is not my first language so if you have a good one. You are welcome :-)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2013