Changeset 797

Show
Ignore:
Timestamp:
07/07/08 23:30:02 (5 months ago)
Author:
andrei
Message:

$(LI Fixed documentation in $(B std.typecons))

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/phobos/std/typecons.d

    r715 r797  
    2525{ 
    2626    Openmode m = Openmode.READ; 
    27     string s = toString(m); 
     27    string s = enumToString(m); 
    2828    assert(s == "READ"); 
    2929    Openmode m1; 
    30     assert(fromString(s, m1) && m1 == m); 
     30    assert(enumFromString(s, m1) && m1 == m); 
    3131} 
    3232 
     
    250250    static if (first) 
    251251    { 
    252         enum string enumParserImpl = "bool enumFromString(string s, ref "~name~" v) {\n" 
     252        enum string enumParserImpl = "bool enumFromString(string s, ref " 
     253            ~name~" v) {\n" 
    253254            ~enumParserImpl!(name, false, T) 
    254255            ~"return false;\n}\n"; 
     
    316317---- 
    317318enum Abc { A, B = 5, C } 
    318 string toString(Abc v) { ... } 
    319 Abc fromString(string s) { ... } 
    320 ---- 
    321  
    322 The $(D_PARAM toString) function generates the unqualified names of the 
    323 enumerated values, i.e. "A", "B", and "C". The $(D_PARAM fromString) 
    324 function expects one of "A", "B", and "C", and throws an exception in 
    325 any other case. 
     319string enumToString(Abc v) { ... } 
     320Abc enumFromString(string s) { ... } 
     321---- 
     322 
     323The $(D_PARAM enumToString) function generates the unqualified names 
     324of the enumerated values, i.e. "A", "B", and "C". The $(D_PARAM 
     325enumFromString) function expects one of "A", "B", and "C", and throws 
     326an exception in any other case. 
    326327 
    327328A base type can be specified for the enumeration like this: