Created
July 5, 2017 08:30
-
-
Save kotet/d06125b1d3b14f101742b1411d83c46f to your computer and use it in GitHub Desktop.
binary.h in D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mixin template binary(T) | |
{ | |
mixin(() { | |
import std.conv : to; | |
import std.range : chain, only, iota; | |
import std.string : rightJustify, format; | |
string result = ""; | |
foreach (n; iota(0, T.max).chain(T.max.only)) | |
{ | |
size_t maxlen = format("%b", T.max).length; | |
string representation = format("%b", n); | |
foreach (minWidth; representation.length .. maxlen + 1) | |
{ | |
result ~= "enum " ~ T.stringof ~ " B" ~ rightJustify(representation, | |
minWidth, '0') ~ " = " ~ to!string(n) ~ ";"; | |
} | |
} | |
return result; | |
}()); | |
} | |
unittest | |
{ | |
mixin binary!(ubyte); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import object; | |
template binary(T) | |
{ | |
mixin(() | |
{ | |
import std.conv : to; | |
import std.range : chain, only, iota; | |
import std.string : rightJustify, format; | |
string result = ""; | |
foreach (n; iota(0, T.max).chain(T.max.only)) | |
{ | |
size_t maxlen = format("%b", T.max).length; | |
string representation = format("%b", n); | |
foreach (minWidth; representation.length .. maxlen + 1) | |
{ | |
result ~= "enum " ~ T.stringof ~ " B" ~ rightJustify(representation, minWidth, '0') ~ " = " ~ to!string | |
(n) ~ ";"; | |
} | |
} | |
return result; | |
} | |
()); | |
} | |
unittest | |
{ | |
enum ubyte B0 = cast(ubyte)0u; | |
enum ubyte B00 = cast(ubyte)0u; | |
enum ubyte B000 = cast(ubyte)0u; | |
enum ubyte B0000 = cast(ubyte)0u; | |
enum ubyte B00000 = cast(ubyte)0u; | |
enum ubyte B000000 = cast(ubyte)0u; | |
enum ubyte B0000000 = cast(ubyte)0u; | |
enum ubyte B00000000 = cast(ubyte)0u; | |
enum ubyte B1 = cast(ubyte)1u; | |
enum ubyte B01 = cast(ubyte)1u; | |
enum ubyte B001 = cast(ubyte)1u; | |
enum ubyte B0001 = cast(ubyte)1u; | |
enum ubyte B00001 = cast(ubyte)1u; | |
enum ubyte B000001 = cast(ubyte)1u; | |
enum ubyte B0000001 = cast(ubyte)1u; | |
enum ubyte B00000001 = cast(ubyte)1u; | |
enum ubyte B10 = cast(ubyte)2u; | |
enum ubyte B010 = cast(ubyte)2u; | |
enum ubyte B0010 = cast(ubyte)2u; | |
enum ubyte B00010 = cast(ubyte)2u; | |
enum ubyte B000010 = cast(ubyte)2u; | |
enum ubyte B0000010 = cast(ubyte)2u; | |
enum ubyte B00000010 = cast(ubyte)2u; | |
enum ubyte B11 = cast(ubyte)3u; | |
enum ubyte B011 = cast(ubyte)3u; | |
enum ubyte B0011 = cast(ubyte)3u; | |
enum ubyte B00011 = cast(ubyte)3u; | |
enum ubyte B000011 = cast(ubyte)3u; | |
enum ubyte B0000011 = cast(ubyte)3u; | |
enum ubyte B00000011 = cast(ubyte)3u; | |
enum ubyte B100 = cast(ubyte)4u; | |
enum ubyte B0100 = cast(ubyte)4u; | |
enum ubyte B00100 = cast(ubyte)4u; | |
enum ubyte B000100 = cast(ubyte)4u; | |
enum ubyte B0000100 = cast(ubyte)4u; | |
enum ubyte B00000100 = cast(ubyte)4u; | |
enum ubyte B101 = cast(ubyte)5u; | |
enum ubyte B0101 = cast(ubyte)5u; | |
enum ubyte B00101 = cast(ubyte)5u; | |
enum ubyte B000101 = cast(ubyte)5u; | |
enum ubyte B0000101 = cast(ubyte)5u; | |
enum ubyte B00000101 = cast(ubyte)5u; | |
enum ubyte B110 = cast(ubyte)6u; | |
enum ubyte B0110 = cast(ubyte)6u; | |
enum ubyte B00110 = cast(ubyte)6u; | |
enum ubyte B000110 = cast(ubyte)6u; | |
enum ubyte B0000110 = cast(ubyte)6u; | |
enum ubyte B00000110 = cast(ubyte)6u; | |
enum ubyte B111 = cast(ubyte)7u; | |
enum ubyte B0111 = cast(ubyte)7u; | |
enum ubyte B00111 = cast(ubyte)7u; | |
enum ubyte B000111 = cast(ubyte)7u; | |
enum ubyte B0000111 = cast(ubyte)7u; | |
enum ubyte B00000111 = cast(ubyte)7u; | |
enum ubyte B1000 = cast(ubyte)8u; | |
enum ubyte B01000 = cast(ubyte)8u; | |
enum ubyte B001000 = cast(ubyte)8u; | |
enum ubyte B0001000 = cast(ubyte)8u; | |
enum ubyte B00001000 = cast(ubyte)8u; | |
enum ubyte B1001 = cast(ubyte)9u; | |
enum ubyte B01001 = cast(ubyte)9u; | |
enum ubyte B001001 = cast(ubyte)9u; | |
enum ubyte B0001001 = cast(ubyte)9u; | |
enum ubyte B00001001 = cast(ubyte)9u; | |
enum ubyte B1010 = cast(ubyte)10u; | |
enum ubyte B01010 = cast(ubyte)10u; | |
enum ubyte B001010 = cast(ubyte)10u; | |
enum ubyte B0001010 = cast(ubyte)10u; | |
enum ubyte B00001010 = cast(ubyte)10u; | |
enum ubyte B1011 = cast(ubyte)11u; | |
enum ubyte B01011 = cast(ubyte)11u; | |
enum ubyte B001011 = cast(ubyte)11u; | |
enum ubyte B0001011 = cast(ubyte)11u; | |
enum ubyte B00001011 = cast(ubyte)11u; | |
enum ubyte B1100 = cast(ubyte)12u; | |
enum ubyte B01100 = cast(ubyte)12u; | |
enum ubyte B001100 = cast(ubyte)12u; | |
enum ubyte B0001100 = cast(ubyte)12u; | |
enum ubyte B00001100 = cast(ubyte)12u; | |
enum ubyte B1101 = cast(ubyte)13u; | |
enum ubyte B01101 = cast(ubyte)13u; | |
enum ubyte B001101 = cast(ubyte)13u; | |
enum ubyte B0001101 = cast(ubyte)13u; | |
enum ubyte B00001101 = cast(ubyte)13u; | |
enum ubyte B1110 = cast(ubyte)14u; | |
enum ubyte B01110 = cast(ubyte)14u; | |
enum ubyte B001110 = cast(ubyte)14u; | |
enum ubyte B0001110 = cast(ubyte)14u; | |
enum ubyte B00001110 = cast(ubyte)14u; | |
enum ubyte B1111 = cast(ubyte)15u; | |
enum ubyte B01111 = cast(ubyte)15u; | |
enum ubyte B001111 = cast(ubyte)15u; | |
enum ubyte B0001111 = cast(ubyte)15u; | |
enum ubyte B00001111 = cast(ubyte)15u; | |
enum ubyte B10000 = cast(ubyte)16u; | |
enum ubyte B010000 = cast(ubyte)16u; | |
enum ubyte B0010000 = cast(ubyte)16u; | |
enum ubyte B00010000 = cast(ubyte)16u; | |
enum ubyte B10001 = cast(ubyte)17u; | |
enum ubyte B010001 = cast(ubyte)17u; | |
enum ubyte B0010001 = cast(ubyte)17u; | |
enum ubyte B00010001 = cast(ubyte)17u; | |
enum ubyte B10010 = cast(ubyte)18u; | |
enum ubyte B010010 = cast(ubyte)18u; | |
enum ubyte B0010010 = cast(ubyte)18u; | |
enum ubyte B00010010 = cast(ubyte)18u; | |
enum ubyte B10011 = cast(ubyte)19u; | |
enum ubyte B010011 = cast(ubyte)19u; | |
enum ubyte B0010011 = cast(ubyte)19u; | |
enum ubyte B00010011 = cast(ubyte)19u; | |
enum ubyte B10100 = cast(ubyte)20u; | |
enum ubyte B010100 = cast(ubyte)20u; | |
enum ubyte B0010100 = cast(ubyte)20u; | |
enum ubyte B00010100 = cast(ubyte)20u; | |
enum ubyte B10101 = cast(ubyte)21u; | |
enum ubyte B010101 = cast(ubyte)21u; | |
enum ubyte B0010101 = cast(ubyte)21u; | |
enum ubyte B00010101 = cast(ubyte)21u; | |
enum ubyte B10110 = cast(ubyte)22u; | |
enum ubyte B010110 = cast(ubyte)22u; | |
enum ubyte B0010110 = cast(ubyte)22u; | |
enum ubyte B00010110 = cast(ubyte)22u; | |
enum ubyte B10111 = cast(ubyte)23u; | |
enum ubyte B010111 = cast(ubyte)23u; | |
enum ubyte B0010111 = cast(ubyte)23u; | |
enum ubyte B00010111 = cast(ubyte)23u; | |
enum ubyte B11000 = cast(ubyte)24u; | |
enum ubyte B011000 = cast(ubyte)24u; | |
enum ubyte B0011000 = cast(ubyte)24u; | |
enum ubyte B00011000 = cast(ubyte)24u; | |
enum ubyte B11001 = cast(ubyte)25u; | |
enum ubyte B011001 = cast(ubyte)25u; | |
enum ubyte B0011001 = cast(ubyte)25u; | |
enum ubyte B00011001 = cast(ubyte)25u; | |
enum ubyte B11010 = cast(ubyte)26u; | |
enum ubyte B011010 = cast(ubyte)26u; | |
enum ubyte B0011010 = cast(ubyte)26u; | |
enum ubyte B00011010 = cast(ubyte)26u; | |
enum ubyte B11011 = cast(ubyte)27u; | |
enum ubyte B011011 = cast(ubyte)27u; | |
enum ubyte B0011011 = cast(ubyte)27u; | |
enum ubyte B00011011 = cast(ubyte)27u; | |
enum ubyte B11100 = cast(ubyte)28u; | |
enum ubyte B011100 = cast(ubyte)28u; | |
enum ubyte B0011100 = cast(ubyte)28u; | |
enum ubyte B00011100 = cast(ubyte)28u; | |
enum ubyte B11101 = cast(ubyte)29u; | |
enum ubyte B011101 = cast(ubyte)29u; | |
enum ubyte B0011101 = cast(ubyte)29u; | |
enum ubyte B00011101 = cast(ubyte)29u; | |
enum ubyte B11110 = cast(ubyte)30u; | |
enum ubyte B011110 = cast(ubyte)30u; | |
enum ubyte B0011110 = cast(ubyte)30u; | |
enum ubyte B00011110 = cast(ubyte)30u; | |
enum ubyte B11111 = cast(ubyte)31u; | |
enum ubyte B011111 = cast(ubyte)31u; | |
enum ubyte B0011111 = cast(ubyte)31u; | |
enum ubyte B00011111 = cast(ubyte)31u; | |
enum ubyte B100000 = cast(ubyte)32u; | |
enum ubyte B0100000 = cast(ubyte)32u; | |
enum ubyte B00100000 = cast(ubyte)32u; | |
enum ubyte B100001 = cast(ubyte)33u; | |
enum ubyte B0100001 = cast(ubyte)33u; | |
enum ubyte B00100001 = cast(ubyte)33u; | |
enum ubyte B100010 = cast(ubyte)34u; | |
enum ubyte B0100010 = cast(ubyte)34u; | |
enum ubyte B00100010 = cast(ubyte)34u; | |
enum ubyte B100011 = cast(ubyte)35u; | |
enum ubyte B0100011 = cast(ubyte)35u; | |
enum ubyte B00100011 = cast(ubyte)35u; | |
enum ubyte B100100 = cast(ubyte)36u; | |
enum ubyte B0100100 = cast(ubyte)36u; | |
enum ubyte B00100100 = cast(ubyte)36u; | |
enum ubyte B100101 = cast(ubyte)37u; | |
enum ubyte B0100101 = cast(ubyte)37u; | |
enum ubyte B00100101 = cast(ubyte)37u; | |
enum ubyte B100110 = cast(ubyte)38u; | |
enum ubyte B0100110 = cast(ubyte)38u; | |
enum ubyte B00100110 = cast(ubyte)38u; | |
enum ubyte B100111 = cast(ubyte)39u; | |
enum ubyte B0100111 = cast(ubyte)39u; | |
enum ubyte B00100111 = cast(ubyte)39u; | |
enum ubyte B101000 = cast(ubyte)40u; | |
enum ubyte B0101000 = cast(ubyte)40u; | |
enum ubyte B00101000 = cast(ubyte)40u; | |
enum ubyte B101001 = cast(ubyte)41u; | |
enum ubyte B0101001 = cast(ubyte)41u; | |
enum ubyte B00101001 = cast(ubyte)41u; | |
enum ubyte B101010 = cast(ubyte)42u; | |
enum ubyte B0101010 = cast(ubyte)42u; | |
enum ubyte B00101010 = cast(ubyte)42u; | |
enum ubyte B101011 = cast(ubyte)43u; | |
enum ubyte B0101011 = cast(ubyte)43u; | |
enum ubyte B00101011 = cast(ubyte)43u; | |
enum ubyte B101100 = cast(ubyte)44u; | |
enum ubyte B0101100 = cast(ubyte)44u; | |
enum ubyte B00101100 = cast(ubyte)44u; | |
enum ubyte B101101 = cast(ubyte)45u; | |
enum ubyte B0101101 = cast(ubyte)45u; | |
enum ubyte B00101101 = cast(ubyte)45u; | |
enum ubyte B101110 = cast(ubyte)46u; | |
enum ubyte B0101110 = cast(ubyte)46u; | |
enum ubyte B00101110 = cast(ubyte)46u; | |
enum ubyte B101111 = cast(ubyte)47u; | |
enum ubyte B0101111 = cast(ubyte)47u; | |
enum ubyte B00101111 = cast(ubyte)47u; | |
enum ubyte B110000 = cast(ubyte)48u; | |
enum ubyte B0110000 = cast(ubyte)48u; | |
enum ubyte B00110000 = cast(ubyte)48u; | |
enum ubyte B110001 = cast(ubyte)49u; | |
enum ubyte B0110001 = cast(ubyte)49u; | |
enum ubyte B00110001 = cast(ubyte)49u; | |
enum ubyte B110010 = cast(ubyte)50u; | |
enum ubyte B0110010 = cast(ubyte)50u; | |
enum ubyte B00110010 = cast(ubyte)50u; | |
enum ubyte B110011 = cast(ubyte)51u; | |
enum ubyte B0110011 = cast(ubyte)51u; | |
enum ubyte B00110011 = cast(ubyte)51u; | |
enum ubyte B110100 = cast(ubyte)52u; | |
enum ubyte B0110100 = cast(ubyte)52u; | |
enum ubyte B00110100 = cast(ubyte)52u; | |
enum ubyte B110101 = cast(ubyte)53u; | |
enum ubyte B0110101 = cast(ubyte)53u; | |
enum ubyte B00110101 = cast(ubyte)53u; | |
enum ubyte B110110 = cast(ubyte)54u; | |
enum ubyte B0110110 = cast(ubyte)54u; | |
enum ubyte B00110110 = cast(ubyte)54u; | |
enum ubyte B110111 = cast(ubyte)55u; | |
enum ubyte B0110111 = cast(ubyte)55u; | |
enum ubyte B00110111 = cast(ubyte)55u; | |
enum ubyte B111000 = cast(ubyte)56u; | |
enum ubyte B0111000 = cast(ubyte)56u; | |
enum ubyte B00111000 = cast(ubyte)56u; | |
enum ubyte B111001 = cast(ubyte)57u; | |
enum ubyte B0111001 = cast(ubyte)57u; | |
enum ubyte B00111001 = cast(ubyte)57u; | |
enum ubyte B111010 = cast(ubyte)58u; | |
enum ubyte B0111010 = cast(ubyte)58u; | |
enum ubyte B00111010 = cast(ubyte)58u; | |
enum ubyte B111011 = cast(ubyte)59u; | |
enum ubyte B0111011 = cast(ubyte)59u; | |
enum ubyte B00111011 = cast(ubyte)59u; | |
enum ubyte B111100 = cast(ubyte)60u; | |
enum ubyte B0111100 = cast(ubyte)60u; | |
enum ubyte B00111100 = cast(ubyte)60u; | |
enum ubyte B111101 = cast(ubyte)61u; | |
enum ubyte B0111101 = cast(ubyte)61u; | |
enum ubyte B00111101 = cast(ubyte)61u; | |
enum ubyte B111110 = cast(ubyte)62u; | |
enum ubyte B0111110 = cast(ubyte)62u; | |
enum ubyte B00111110 = cast(ubyte)62u; | |
enum ubyte B111111 = cast(ubyte)63u; | |
enum ubyte B0111111 = cast(ubyte)63u; | |
enum ubyte B00111111 = cast(ubyte)63u; | |
enum ubyte B1000000 = cast(ubyte)64u; | |
enum ubyte B01000000 = cast(ubyte)64u; | |
enum ubyte B1000001 = cast(ubyte)65u; | |
enum ubyte B01000001 = cast(ubyte)65u; | |
enum ubyte B1000010 = cast(ubyte)66u; | |
enum ubyte B01000010 = cast(ubyte)66u; | |
enum ubyte B1000011 = cast(ubyte)67u; | |
enum ubyte B01000011 = cast(ubyte)67u; | |
enum ubyte B1000100 = cast(ubyte)68u; | |
enum ubyte B01000100 = cast(ubyte)68u; | |
enum ubyte B1000101 = cast(ubyte)69u; | |
enum ubyte B01000101 = cast(ubyte)69u; | |
enum ubyte B1000110 = cast(ubyte)70u; | |
enum ubyte B01000110 = cast(ubyte)70u; | |
enum ubyte B1000111 = cast(ubyte)71u; | |
enum ubyte B01000111 = cast(ubyte)71u; | |
enum ubyte B1001000 = cast(ubyte)72u; | |
enum ubyte B01001000 = cast(ubyte)72u; | |
enum ubyte B1001001 = cast(ubyte)73u; | |
enum ubyte B01001001 = cast(ubyte)73u; | |
enum ubyte B1001010 = cast(ubyte)74u; | |
enum ubyte B01001010 = cast(ubyte)74u; | |
enum ubyte B1001011 = cast(ubyte)75u; | |
enum ubyte B01001011 = cast(ubyte)75u; | |
enum ubyte B1001100 = cast(ubyte)76u; | |
enum ubyte B01001100 = cast(ubyte)76u; | |
enum ubyte B1001101 = cast(ubyte)77u; | |
enum ubyte B01001101 = cast(ubyte)77u; | |
enum ubyte B1001110 = cast(ubyte)78u; | |
enum ubyte B01001110 = cast(ubyte)78u; | |
enum ubyte B1001111 = cast(ubyte)79u; | |
enum ubyte B01001111 = cast(ubyte)79u; | |
enum ubyte B1010000 = cast(ubyte)80u; | |
enum ubyte B01010000 = cast(ubyte)80u; | |
enum ubyte B1010001 = cast(ubyte)81u; | |
enum ubyte B01010001 = cast(ubyte)81u; | |
enum ubyte B1010010 = cast(ubyte)82u; | |
enum ubyte B01010010 = cast(ubyte)82u; | |
enum ubyte B1010011 = cast(ubyte)83u; | |
enum ubyte B01010011 = cast(ubyte)83u; | |
enum ubyte B1010100 = cast(ubyte)84u; | |
enum ubyte B01010100 = cast(ubyte)84u; | |
enum ubyte B1010101 = cast(ubyte)85u; | |
enum ubyte B01010101 = cast(ubyte)85u; | |
enum ubyte B1010110 = cast(ubyte)86u; | |
enum ubyte B01010110 = cast(ubyte)86u; | |
enum ubyte B1010111 = cast(ubyte)87u; | |
enum ubyte B01010111 = cast(ubyte)87u; | |
enum ubyte B1011000 = cast(ubyte)88u; | |
enum ubyte B01011000 = cast(ubyte)88u; | |
enum ubyte B1011001 = cast(ubyte)89u; | |
enum ubyte B01011001 = cast(ubyte)89u; | |
enum ubyte B1011010 = cast(ubyte)90u; | |
enum ubyte B01011010 = cast(ubyte)90u; | |
enum ubyte B1011011 = cast(ubyte)91u; | |
enum ubyte B01011011 = cast(ubyte)91u; | |
enum ubyte B1011100 = cast(ubyte)92u; | |
enum ubyte B01011100 = cast(ubyte)92u; | |
enum ubyte B1011101 = cast(ubyte)93u; | |
enum ubyte B01011101 = cast(ubyte)93u; | |
enum ubyte B1011110 = cast(ubyte)94u; | |
enum ubyte B01011110 = cast(ubyte)94u; | |
enum ubyte B1011111 = cast(ubyte)95u; | |
enum ubyte B01011111 = cast(ubyte)95u; | |
enum ubyte B1100000 = cast(ubyte)96u; | |
enum ubyte B01100000 = cast(ubyte)96u; | |
enum ubyte B1100001 = cast(ubyte)97u; | |
enum ubyte B01100001 = cast(ubyte)97u; | |
enum ubyte B1100010 = cast(ubyte)98u; | |
enum ubyte B01100010 = cast(ubyte)98u; | |
enum ubyte B1100011 = cast(ubyte)99u; | |
enum ubyte B01100011 = cast(ubyte)99u; | |
enum ubyte B1100100 = cast(ubyte)100u; | |
enum ubyte B01100100 = cast(ubyte)100u; | |
enum ubyte B1100101 = cast(ubyte)101u; | |
enum ubyte B01100101 = cast(ubyte)101u; | |
enum ubyte B1100110 = cast(ubyte)102u; | |
enum ubyte B01100110 = cast(ubyte)102u; | |
enum ubyte B1100111 = cast(ubyte)103u; | |
enum ubyte B01100111 = cast(ubyte)103u; | |
enum ubyte B1101000 = cast(ubyte)104u; | |
enum ubyte B01101000 = cast(ubyte)104u; | |
enum ubyte B1101001 = cast(ubyte)105u; | |
enum ubyte B01101001 = cast(ubyte)105u; | |
enum ubyte B1101010 = cast(ubyte)106u; | |
enum ubyte B01101010 = cast(ubyte)106u; | |
enum ubyte B1101011 = cast(ubyte)107u; | |
enum ubyte B01101011 = cast(ubyte)107u; | |
enum ubyte B1101100 = cast(ubyte)108u; | |
enum ubyte B01101100 = cast(ubyte)108u; | |
enum ubyte B1101101 = cast(ubyte)109u; | |
enum ubyte B01101101 = cast(ubyte)109u; | |
enum ubyte B1101110 = cast(ubyte)110u; | |
enum ubyte B01101110 = cast(ubyte)110u; | |
enum ubyte B1101111 = cast(ubyte)111u; | |
enum ubyte B01101111 = cast(ubyte)111u; | |
enum ubyte B1110000 = cast(ubyte)112u; | |
enum ubyte B01110000 = cast(ubyte)112u; | |
enum ubyte B1110001 = cast(ubyte)113u; | |
enum ubyte B01110001 = cast(ubyte)113u; | |
enum ubyte B1110010 = cast(ubyte)114u; | |
enum ubyte B01110010 = cast(ubyte)114u; | |
enum ubyte B1110011 = cast(ubyte)115u; | |
enum ubyte B01110011 = cast(ubyte)115u; | |
enum ubyte B1110100 = cast(ubyte)116u; | |
enum ubyte B01110100 = cast(ubyte)116u; | |
enum ubyte B1110101 = cast(ubyte)117u; | |
enum ubyte B01110101 = cast(ubyte)117u; | |
enum ubyte B1110110 = cast(ubyte)118u; | |
enum ubyte B01110110 = cast(ubyte)118u; | |
enum ubyte B1110111 = cast(ubyte)119u; | |
enum ubyte B01110111 = cast(ubyte)119u; | |
enum ubyte B1111000 = cast(ubyte)120u; | |
enum ubyte B01111000 = cast(ubyte)120u; | |
enum ubyte B1111001 = cast(ubyte)121u; | |
enum ubyte B01111001 = cast(ubyte)121u; | |
enum ubyte B1111010 = cast(ubyte)122u; | |
enum ubyte B01111010 = cast(ubyte)122u; | |
enum ubyte B1111011 = cast(ubyte)123u; | |
enum ubyte B01111011 = cast(ubyte)123u; | |
enum ubyte B1111100 = cast(ubyte)124u; | |
enum ubyte B01111100 = cast(ubyte)124u; | |
enum ubyte B1111101 = cast(ubyte)125u; | |
enum ubyte B01111101 = cast(ubyte)125u; | |
enum ubyte B1111110 = cast(ubyte)126u; | |
enum ubyte B01111110 = cast(ubyte)126u; | |
enum ubyte B1111111 = cast(ubyte)127u; | |
enum ubyte B01111111 = cast(ubyte)127u; | |
enum ubyte B10000000 = cast(ubyte)128u; | |
enum ubyte B10000001 = cast(ubyte)129u; | |
enum ubyte B10000010 = cast(ubyte)130u; | |
enum ubyte B10000011 = cast(ubyte)131u; | |
enum ubyte B10000100 = cast(ubyte)132u; | |
enum ubyte B10000101 = cast(ubyte)133u; | |
enum ubyte B10000110 = cast(ubyte)134u; | |
enum ubyte B10000111 = cast(ubyte)135u; | |
enum ubyte B10001000 = cast(ubyte)136u; | |
enum ubyte B10001001 = cast(ubyte)137u; | |
enum ubyte B10001010 = cast(ubyte)138u; | |
enum ubyte B10001011 = cast(ubyte)139u; | |
enum ubyte B10001100 = cast(ubyte)140u; | |
enum ubyte B10001101 = cast(ubyte)141u; | |
enum ubyte B10001110 = cast(ubyte)142u; | |
enum ubyte B10001111 = cast(ubyte)143u; | |
enum ubyte B10010000 = cast(ubyte)144u; | |
enum ubyte B10010001 = cast(ubyte)145u; | |
enum ubyte B10010010 = cast(ubyte)146u; | |
enum ubyte B10010011 = cast(ubyte)147u; | |
enum ubyte B10010100 = cast(ubyte)148u; | |
enum ubyte B10010101 = cast(ubyte)149u; | |
enum ubyte B10010110 = cast(ubyte)150u; | |
enum ubyte B10010111 = cast(ubyte)151u; | |
enum ubyte B10011000 = cast(ubyte)152u; | |
enum ubyte B10011001 = cast(ubyte)153u; | |
enum ubyte B10011010 = cast(ubyte)154u; | |
enum ubyte B10011011 = cast(ubyte)155u; | |
enum ubyte B10011100 = cast(ubyte)156u; | |
enum ubyte B10011101 = cast(ubyte)157u; | |
enum ubyte B10011110 = cast(ubyte)158u; | |
enum ubyte B10011111 = cast(ubyte)159u; | |
enum ubyte B10100000 = cast(ubyte)160u; | |
enum ubyte B10100001 = cast(ubyte)161u; | |
enum ubyte B10100010 = cast(ubyte)162u; | |
enum ubyte B10100011 = cast(ubyte)163u; | |
enum ubyte B10100100 = cast(ubyte)164u; | |
enum ubyte B10100101 = cast(ubyte)165u; | |
enum ubyte B10100110 = cast(ubyte)166u; | |
enum ubyte B10100111 = cast(ubyte)167u; | |
enum ubyte B10101000 = cast(ubyte)168u; | |
enum ubyte B10101001 = cast(ubyte)169u; | |
enum ubyte B10101010 = cast(ubyte)170u; | |
enum ubyte B10101011 = cast(ubyte)171u; | |
enum ubyte B10101100 = cast(ubyte)172u; | |
enum ubyte B10101101 = cast(ubyte)173u; | |
enum ubyte B10101110 = cast(ubyte)174u; | |
enum ubyte B10101111 = cast(ubyte)175u; | |
enum ubyte B10110000 = cast(ubyte)176u; | |
enum ubyte B10110001 = cast(ubyte)177u; | |
enum ubyte B10110010 = cast(ubyte)178u; | |
enum ubyte B10110011 = cast(ubyte)179u; | |
enum ubyte B10110100 = cast(ubyte)180u; | |
enum ubyte B10110101 = cast(ubyte)181u; | |
enum ubyte B10110110 = cast(ubyte)182u; | |
enum ubyte B10110111 = cast(ubyte)183u; | |
enum ubyte B10111000 = cast(ubyte)184u; | |
enum ubyte B10111001 = cast(ubyte)185u; | |
enum ubyte B10111010 = cast(ubyte)186u; | |
enum ubyte B10111011 = cast(ubyte)187u; | |
enum ubyte B10111100 = cast(ubyte)188u; | |
enum ubyte B10111101 = cast(ubyte)189u; | |
enum ubyte B10111110 = cast(ubyte)190u; | |
enum ubyte B10111111 = cast(ubyte)191u; | |
enum ubyte B11000000 = cast(ubyte)192u; | |
enum ubyte B11000001 = cast(ubyte)193u; | |
enum ubyte B11000010 = cast(ubyte)194u; | |
enum ubyte B11000011 = cast(ubyte)195u; | |
enum ubyte B11000100 = cast(ubyte)196u; | |
enum ubyte B11000101 = cast(ubyte)197u; | |
enum ubyte B11000110 = cast(ubyte)198u; | |
enum ubyte B11000111 = cast(ubyte)199u; | |
enum ubyte B11001000 = cast(ubyte)200u; | |
enum ubyte B11001001 = cast(ubyte)201u; | |
enum ubyte B11001010 = cast(ubyte)202u; | |
enum ubyte B11001011 = cast(ubyte)203u; | |
enum ubyte B11001100 = cast(ubyte)204u; | |
enum ubyte B11001101 = cast(ubyte)205u; | |
enum ubyte B11001110 = cast(ubyte)206u; | |
enum ubyte B11001111 = cast(ubyte)207u; | |
enum ubyte B11010000 = cast(ubyte)208u; | |
enum ubyte B11010001 = cast(ubyte)209u; | |
enum ubyte B11010010 = cast(ubyte)210u; | |
enum ubyte B11010011 = cast(ubyte)211u; | |
enum ubyte B11010100 = cast(ubyte)212u; | |
enum ubyte B11010101 = cast(ubyte)213u; | |
enum ubyte B11010110 = cast(ubyte)214u; | |
enum ubyte B11010111 = cast(ubyte)215u; | |
enum ubyte B11011000 = cast(ubyte)216u; | |
enum ubyte B11011001 = cast(ubyte)217u; | |
enum ubyte B11011010 = cast(ubyte)218u; | |
enum ubyte B11011011 = cast(ubyte)219u; | |
enum ubyte B11011100 = cast(ubyte)220u; | |
enum ubyte B11011101 = cast(ubyte)221u; | |
enum ubyte B11011110 = cast(ubyte)222u; | |
enum ubyte B11011111 = cast(ubyte)223u; | |
enum ubyte B11100000 = cast(ubyte)224u; | |
enum ubyte B11100001 = cast(ubyte)225u; | |
enum ubyte B11100010 = cast(ubyte)226u; | |
enum ubyte B11100011 = cast(ubyte)227u; | |
enum ubyte B11100100 = cast(ubyte)228u; | |
enum ubyte B11100101 = cast(ubyte)229u; | |
enum ubyte B11100110 = cast(ubyte)230u; | |
enum ubyte B11100111 = cast(ubyte)231u; | |
enum ubyte B11101000 = cast(ubyte)232u; | |
enum ubyte B11101001 = cast(ubyte)233u; | |
enum ubyte B11101010 = cast(ubyte)234u; | |
enum ubyte B11101011 = cast(ubyte)235u; | |
enum ubyte B11101100 = cast(ubyte)236u; | |
enum ubyte B11101101 = cast(ubyte)237u; | |
enum ubyte B11101110 = cast(ubyte)238u; | |
enum ubyte B11101111 = cast(ubyte)239u; | |
enum ubyte B11110000 = cast(ubyte)240u; | |
enum ubyte B11110001 = cast(ubyte)241u; | |
enum ubyte B11110010 = cast(ubyte)242u; | |
enum ubyte B11110011 = cast(ubyte)243u; | |
enum ubyte B11110100 = cast(ubyte)244u; | |
enum ubyte B11110101 = cast(ubyte)245u; | |
enum ubyte B11110110 = cast(ubyte)246u; | |
enum ubyte B11110111 = cast(ubyte)247u; | |
enum ubyte B11111000 = cast(ubyte)248u; | |
enum ubyte B11111001 = cast(ubyte)249u; | |
enum ubyte B11111010 = cast(ubyte)250u; | |
enum ubyte B11111011 = cast(ubyte)251u; | |
enum ubyte B11111100 = cast(ubyte)252u; | |
enum ubyte B11111101 = cast(ubyte)253u; | |
enum ubyte B11111110 = cast(ubyte)254u; | |
enum ubyte B11111111 = cast(ubyte)255u; | |
} | |
Demangle!uint | |
struct Demangle | |
{ | |
uint value; | |
string rest; | |
} | |
Flag!"unsafe" | |
enum Flag : bool | |
{ | |
Flag no = cast(Flag)false, | |
Flag yes = cast(Flag)true, | |
} | |
Flag!"pipeOnPop" | |
enum Flag : bool | |
{ | |
Flag no = cast(Flag)false, | |
Flag yes = cast(Flag)true, | |
} | |
opEquals!(CodepointInterval) | |
const pure nothrow @nogc @safe bool opEquals(CodepointInterval val) | |
{ | |
assert(&this, "null this"); | |
return this._tuple[0] == val._tuple[0] && this._tuple[1] == val._tuple[1]; | |
} | |
TrieEntry!(bool, 8, 4, 9) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
TrieEntry!(ushort, 8, 7, 6) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
TrieEntry!(bool, 8, 5, 8) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
TrieEntry!(bool, 8, 6, 7) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
TrieEntry!(bool, 7, 4, 4, 6) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
SliceOverIndexed!(Grapheme) | |
struct SliceOverIndexed | |
{ | |
enum bool assignableIndex = true; | |
enum bool assignableSlice = false; | |
auto const pure nothrow @nogc @safe dchar opIndex(ulong idx) | |
in | |
{ | |
assert(idx < this.to - this.from); | |
} | |
body | |
{ | |
{ | |
assert(idx < this.to - this.from); | |
} | |
assert(&this, "null this"); | |
return (*this.arr).opIndex(this.from + idx); | |
} | |
static if (assignableIndex) | |
{ | |
pure nothrow @nogc @safe void opIndexAssign(dchar val, ulong idx) | |
in | |
{ | |
assert(idx < this.to - this.from); | |
} | |
body | |
{ | |
{ | |
assert(idx < this.to - this.from); | |
} | |
assert(&this, "null this"); | |
(*this.arr).opIndexAssign(val, this.from + idx); | |
} | |
} | |
auto pure nothrow @nogc @safe SliceOverIndexed!(Grapheme) opSlice(ulong a, ulong b) | |
{ | |
assert(&this, "null this"); | |
return SliceOverIndexed(this.from + a, this.from + b, this.arr); | |
} | |
void opSliceAssign(T)(T val, size_t start, size_t end) | |
{ | |
(*arr)[start + from..end + from] = val; | |
} | |
auto pure nothrow @nogc @safe SliceOverIndexed!(Grapheme) opSlice() | |
{ | |
assert(&this, "null this"); | |
return SliceOverIndexed(this.from, this.to, this.arr); | |
} | |
const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return this.to - this.from; | |
} | |
auto const pure nothrow @nogc @safe ulong opDollar() | |
{ | |
assert(&this, "null this"); | |
return this.length(); | |
} | |
const pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this.from == this.to; | |
} | |
auto const pure nothrow @nogc @property @safe dchar front() | |
{ | |
assert(&this, "null this"); | |
return (*this.arr).opIndex(this.from); | |
} | |
static if (assignableIndex) | |
{ | |
pure nothrow @nogc @property @safe void front(dchar val) | |
{ | |
assert(&this, "null this"); | |
(*this.arr).opIndexAssign(val, this.from); | |
} | |
} | |
auto const pure nothrow @nogc @property @safe dchar back() | |
{ | |
assert(&this, "null this"); | |
return (*this.arr).opIndex(this.to - 1LU); | |
} | |
static if (assignableIndex) | |
{ | |
pure nothrow @nogc @property @safe void back(dchar val) | |
{ | |
assert(&this, "null this"); | |
(*this.arr).opIndexAssign(val, this.to - 1LU); | |
} | |
} | |
auto inout pure nothrow @nogc @property @safe inout(SliceOverIndexed!(Grapheme)) save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
this.from++; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.to--; | |
} | |
const bool opEquals(T)(auto ref T arr) | |
{ | |
if (arr.length != length) | |
return false; | |
for (size_t i = 0; | |
i < length; i++) | |
{ | |
if (this[i] != arr[i]) | |
return false; | |
} | |
return true; | |
} | |
private | |
{ | |
alias Item = dchar; | |
ulong from; | |
ulong to; | |
Grapheme* arr; | |
} | |
} | |
opEquals!(SliceOverIndexed!(Grapheme)) | |
const pure nothrow @nogc @safe bool opEquals(SliceOverIndexed!(Grapheme) arr) | |
{ | |
assert(&this, "null this"); | |
if (arr.length() != this.length()) | |
return false; | |
{ | |
ulong i = 0LU; | |
for (; i < this.length(); i++) | |
{ | |
if (cast(uint)this.opIndex(i) != cast(uint)arr.opIndex(i)) | |
return false; | |
} | |
} | |
return true; | |
} | |
Flag!"allocateGC" | |
enum Flag : bool | |
{ | |
Flag no = cast(Flag)false, | |
Flag yes = cast(Flag)true, | |
} | |
Flag!"keepTerminator" | |
enum Flag : bool | |
{ | |
Flag no = cast(Flag)false, | |
Flag yes = cast(Flag)true, | |
} | |
CommonType!(int, ubyte) | |
alias CommonType = int; | |
CommonType!int | |
alias CommonType = int; | |
isFloatingPoint!int | |
enum bool isFloatingPoint = false; | |
Unqual!int | |
alias Unqual = int; | |
isIntegral!int | |
enum bool isIntegral = true; | |
IntegralTypeOf!int | |
alias IntegralTypeOf = int; | |
isAggregateType!int | |
enum bool isAggregateType = false; | |
OriginalType!int | |
alias OriginalType = int; | |
ModifyTypePreservingTQ!(Impl, int) | |
alias ModifyTypePreservingTQ = int; | |
Modifier!int | |
alias Impl = int; | |
TypeTuple!() | |
alias AliasSeq = (); | |
TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong) | |
alias AliasSeq = (byte, ubyte, short, ushort, int, uint, long, ulong); | |
staticIndexOf!(int, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = 4; | |
genericIndexOf!(int, byte, ubyte, short, ushort, int, uint, long, ulong) | |
OldAlias!int | |
alias OldAlias = int; | |
isAggregateType!byte | |
enum bool isAggregateType = false; | |
OldAlias!byte | |
alias OldAlias = byte; | |
isSame!(int, byte) | |
enum bool isSame = false; | |
expectType!int | |
expectType!byte | |
genericIndexOf!(int, ubyte, short, ushort, int, uint, long, ulong) | |
isAggregateType!ubyte | |
enum bool isAggregateType = false; | |
OldAlias!ubyte | |
alias OldAlias = ubyte; | |
isSame!(int, ubyte) | |
enum bool isSame = false; | |
expectType!ubyte | |
genericIndexOf!(int, short, ushort, int, uint, long, ulong) | |
isAggregateType!short | |
enum bool isAggregateType = false; | |
OldAlias!short | |
alias OldAlias = short; | |
isSame!(int, short) | |
enum bool isSame = false; | |
expectType!short | |
genericIndexOf!(int, ushort, int, uint, long, ulong) | |
isAggregateType!ushort | |
enum bool isAggregateType = false; | |
OldAlias!ushort | |
alias OldAlias = ushort; | |
isSame!(int, ushort) | |
enum bool isSame = false; | |
expectType!ushort | |
genericIndexOf!(int, int, uint, long, ulong) | |
isSame!(int, int) | |
enum bool isSame = true; | |
iota!(int, ubyte) | |
auto pure nothrow @nogc @safe Result iota(int begin, ubyte end) | |
{ | |
import std.conv : unsigned; | |
alias Value = int; | |
static struct Result | |
{ | |
private | |
{ | |
int current; | |
int pastLast; | |
} | |
pure nothrow @nogc @safe this(int current, int pastLast) | |
{ | |
if (current < pastLast) | |
{ | |
assert(cast(ulong)unsigned(pastLast - current) <= 18446744073709551615LU); | |
this.current = current; | |
this.pastLast = pastLast; | |
} | |
else | |
{ | |
this.current = (this.pastLast = current); | |
} | |
return this; | |
} | |
const pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this.current == this.pastLast; | |
} | |
inout pure nothrow @nogc @property @safe inout(int) front() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty()); | |
return this.current; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty()); | |
this.current += 1; | |
} | |
inout pure nothrow @nogc @property @safe inout(int) back() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty()); | |
return this.pastLast - 1; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty()); | |
this.pastLast -= 1; | |
} | |
auto pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
inout pure nothrow @nogc @safe inout(int) opIndex(ulong n) | |
{ | |
assert(&this, "null this"); | |
assert(n < this.length()); | |
return cast(inout(int))(cast(ulong)this.current + n); | |
} | |
inout pure nothrow @nogc @safe inout(Result) opSlice() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
inout pure nothrow @nogc @safe inout(Result) opSlice(ulong lower, ulong upper) | |
{ | |
assert(&this, "null this"); | |
assert(upper >= lower && upper <= this.length()); | |
return Result(0, 0).this(cast(int)(cast(ulong)this.current + lower), cast(int)(cast(ulong)this.pastLast - (this.length() - upper))); | |
} | |
const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.pastLast - this.current); | |
} | |
alias opDollar = const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.pastLast - this.current); | |
} | |
; | |
} | |
return Result(0, 0).this(begin, cast(int)end); | |
} | |
Unqual!ubyte | |
alias Unqual = ubyte; | |
isSomeChar!int | |
enum bool isSomeChar = false; | |
TypeTuple!(char, wchar, dchar) | |
alias AliasSeq = (char, wchar, dchar); | |
staticIndexOf!(int, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(int, char, wchar, dchar) | |
isAggregateType!char | |
enum bool isAggregateType = false; | |
OldAlias!char | |
alias OldAlias = char; | |
isSame!(int, char) | |
enum bool isSame = false; | |
expectType!char | |
genericIndexOf!(int, wchar, dchar) | |
isAggregateType!wchar | |
enum bool isAggregateType = false; | |
OldAlias!wchar | |
alias OldAlias = wchar; | |
isSame!(int, wchar) | |
enum bool isSame = false; | |
expectType!wchar | |
genericIndexOf!(int, dchar) | |
isAggregateType!dchar | |
enum bool isAggregateType = false; | |
OldAlias!dchar | |
alias OldAlias = dchar; | |
isSame!(int, dchar) | |
enum bool isSame = false; | |
expectType!dchar | |
genericIndexOf!int | |
unsigned!int | |
auto pure nothrow @nogc @safe uint unsigned(int x) | |
{ | |
return cast(uint)x; | |
} | |
Unsigned!int | |
alias Unsigned = uint; | |
ModifyTypePreservingTQ!(Impl, int) | |
alias ModifyTypePreservingTQ = uint; | |
Modifier!int | |
alias Impl = uint; | |
isUnsigned!int | |
enum bool isUnsigned = false; | |
isSigned!int | |
enum bool isSigned = true; | |
Unqual!uint | |
alias Unqual = uint; | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
CommonType!ubyte | |
alias CommonType = ubyte; | |
only!ubyte | |
auto pure nothrow @nogc @safe OnlyResult!(ubyte, 1LU) only(ubyte _param_0) | |
{ | |
return OnlyResult(cast(ubyte)0u, true).this(_param_0); | |
} | |
OnlyResult!(ubyte, 1LU) | |
struct OnlyResult | |
{ | |
pure nothrow @nogc @property @safe ubyte front() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty(), "Attempting to fetch the front of an empty Only range"); | |
return this._value; | |
} | |
pure nothrow @nogc @property @safe ubyte back() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty(), "Attempting to fetch the back of an empty Only range"); | |
return this._value; | |
} | |
const pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this._empty; | |
} | |
const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)!this._empty; | |
} | |
auto pure nothrow @nogc @property @safe OnlyResult!(ubyte, 1LU) save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
assert(!this._empty, "Attempting to popFront an empty Only range"); | |
this._empty = true; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
assert(!this._empty, "Attempting to popBack an empty Only range"); | |
this._empty = true; | |
} | |
alias opDollar = const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)!this._empty; | |
} | |
; | |
private this()(auto ref T value) | |
{ | |
this._value = value; | |
this._empty = false; | |
} | |
pure nothrow @nogc @safe ubyte opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
assert(!this._empty && i == 0LU, "Attempting to fetch an out of bounds index from an Only range"); | |
return this._value; | |
} | |
pure nothrow @nogc @safe OnlyResult!(ubyte, 1LU) opSlice() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe OnlyResult!(ubyte, 1LU) opSlice(ulong from, ulong to) | |
{ | |
assert(&this, "null this"); | |
assert(from <= to, "Attempting to slice an Only range with a larger first argument than the second."); | |
assert(to <= this.length(), "Attempting to slice using an out of bounds index on an Only range"); | |
OnlyResult!(ubyte, 1LU) copy = this; | |
copy._empty = this._empty || from == to; | |
return copy; | |
} | |
private ubyte _value; | |
private bool _empty = true; | |
} | |
__ctor!() | |
pure nothrow @nogc @safe this(ref ubyte value) | |
{ | |
this._value = value; | |
this._empty = false; | |
return this; | |
} | |
RTInfo!(OnlyResult!(ubyte, 1LU)) | |
enum typeof(null) RTInfo = null; | |
staticMap!(Unqual, Result, OnlyResult!(ubyte, 1LU)) | |
alias staticMap = (Result, OnlyResult!(ubyte, 1LU)); | |
staticMap!(Unqual, Result) | |
alias staticMap = (Result); | |
F!(Result) | |
alias Unqual = Result; | |
AliasSeq!(Result) | |
alias AliasSeq = (Result); | |
staticMap!(Unqual, OnlyResult!(ubyte, 1LU)) | |
alias staticMap = (OnlyResult!(ubyte, 1LU)); | |
F!(OnlyResult!(ubyte, 1LU)) | |
alias Unqual = OnlyResult!(ubyte, 1LU); | |
AliasSeq!(OnlyResult!(ubyte, 1LU)) | |
alias AliasSeq = (OnlyResult!(ubyte, 1LU)); | |
AliasSeq!(Result, OnlyResult!(ubyte, 1LU)) | |
alias AliasSeq = (Result, OnlyResult!(ubyte, 1LU)); | |
allSatisfy!(isInputRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isInputRange, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool isInputRange = true; | |
allSatisfy!(isInputRange, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool isInputRange = true; | |
staticMap!(ElementType, Result, OnlyResult!(ubyte, 1LU)) | |
alias staticMap = (int, ubyte); | |
staticMap!(ElementType, Result) | |
alias staticMap = (int); | |
F!(Result) | |
alias ElementType = int; | |
AliasSeq!int | |
alias AliasSeq = (int); | |
staticMap!(ElementType, OnlyResult!(ubyte, 1LU)) | |
alias staticMap = (ubyte); | |
F!(OnlyResult!(ubyte, 1LU)) | |
alias ElementType = ubyte; | |
AliasSeq!ubyte | |
alias AliasSeq = (ubyte); | |
AliasSeq!(int, ubyte) | |
alias AliasSeq = (int, ubyte); | |
chain!(Result, OnlyResult!(ubyte, 1LU)) | |
auto pure nothrow @nogc @safe Result chain(Result _param_0, OnlyResult!(ubyte, 1LU) _param_1) | |
{ | |
static struct Result | |
{ | |
private | |
{ | |
alias R = (Result, OnlyResult!(ubyte, 1LU)); | |
alias RvalueElementType = int; | |
private enum sameET(A) = is(.ElementType!A | |
== RvalueElementType); | |
enum bool allSameType = false; | |
static if (allSameType) | |
{ | |
alias ElementType = ref RvalueElementType; | |
} | |
else | |
{ | |
alias ElementType = int; | |
} | |
static if (false && allSatisfy!(hasLvalueElements, R) | |
) | |
{ | |
static ref RvalueElementType fixRef(ref RvalueElementType val) | |
{ | |
return val; | |
} | |
} | |
else | |
{ | |
static pure nothrow @nogc @safe int fixRef(int val) | |
{ | |
return val; | |
} | |
} | |
(Result, OnlyResult!(ubyte, 1LU)) source; | |
public | |
{ | |
pure nothrow @nogc @safe this(Result _param_0, OnlyResult!(ubyte, 1LU) _param_1) | |
{ | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
Result v = _param_0; | |
this.__source_field_0 = v; | |
} | |
{ | |
enum ulong i = 1LU; | |
OnlyResult!(ubyte, 1LU) v = _param_1; | |
this.__source_field_1 = v; | |
} | |
} | |
return this; | |
} | |
import std.meta : anySatisfy; | |
static if (anySatisfy!(isInfinite, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool anySatisfy = false; | |
) | |
{ | |
enum bool empty = false; | |
} | |
else | |
{ | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (!this.__source_field_0.empty()) | |
return false; | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (!this.__source_field_1.empty()) | |
return false; | |
} | |
} | |
return true; | |
} | |
} | |
static if (allSatisfy!(isForwardRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
auto pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
Result result = this; | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
result.__source_field_0 = result.__source_field_0.save(); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
result.__source_field_1 = result.__source_field_1.save(); | |
} | |
} | |
return result; | |
} | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
this.__source_field_0.popFront(); | |
return ; | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
this.__source_field_1.popFront(); | |
return ; | |
} | |
} | |
} | |
auto pure nothrow @nogc @property @safe int front() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
return fixRef(this.__source_field_0.front()); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
return fixRef(cast(int)this.__source_field_1.front()); | |
} | |
} | |
assert(false); | |
} | |
static if (false && allSatisfy!(hasAssignableElements, R) | |
) | |
{ | |
@property void front(RvalueElementType v) | |
{ | |
foreach (i, Unused; R) | |
{ | |
if (source[i].empty) | |
continue; | |
source[i].front = v; | |
return ; | |
} | |
assert(false); | |
} | |
} | |
static if (allSatisfy!(hasMobileElements, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
pure nothrow @nogc @safe int moveFront() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
return moveFront(this.__source_field_0); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
return cast(int)moveFront(this.__source_field_1); | |
} | |
} | |
assert(false); | |
} | |
} | |
static if (allSatisfy!(isBidirectionalRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
auto pure nothrow @nogc @property @safe int back() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
return fixRef(cast(int)this.__source_field_1.back()); | |
} | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
return fixRef(this.__source_field_0.back()); | |
} | |
} | |
assert(false); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
this.__source_field_1.popBack(); | |
return ; | |
} | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
this.__source_field_0.popBack(); | |
return ; | |
} | |
} | |
} | |
static if (allSatisfy!(hasMobileElements, Result, OnlyResult!(ubyte, 1LU)) | |
) | |
{ | |
pure nothrow @nogc @safe int moveBack() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
return cast(int)moveBack(this.__source_field_1); | |
} | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
return moveBack(this.__source_field_0); | |
} | |
} | |
assert(false); | |
} | |
} | |
static if (false && allSatisfy!(hasAssignableElements, R) | |
) | |
{ | |
@property void back(RvalueElementType v) | |
{ | |
foreach_reverse (i, Unused; R) | |
{ | |
if (source[i].empty) | |
continue; | |
source[i].back = v; | |
return ; | |
} | |
assert(false); | |
} | |
} | |
} | |
static if (allSatisfy!(hasLength, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
ulong result = 0LU; | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
result += this.__source_field_0.length(); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
result += this.__source_field_1.length(); | |
} | |
} | |
return result; | |
} | |
alias opDollar = pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
ulong result = 0LU; | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
result += this.__source_field_0.length(); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
result += this.__source_field_1.length(); | |
} | |
} | |
return result; | |
} | |
; | |
} | |
static if (allSatisfy!(isRandomAccessRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
auto pure nothrow @nogc @safe int opIndex(ulong index) | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Range = Result; | |
immutable immutable(ulong) length = this.__source_field_0.length(); | |
if (index < length) | |
return fixRef(this.__source_field_0.opIndex(index)); | |
index -= length; | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Range = OnlyResult!(ubyte, 1LU); | |
immutable immutable(ulong) length = this.__source_field_1.length(); | |
if (index < length) | |
return fixRef(cast(int)this.__source_field_1.opIndex(index)); | |
index -= length; | |
} | |
} | |
assert(false); | |
} | |
static if (allSatisfy!(hasMobileElements, Result, OnlyResult!(ubyte, 1LU)) | |
) | |
{ | |
pure nothrow @nogc @safe int moveAt(ulong index) | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Range = Result; | |
immutable immutable(ulong) length = this.__source_field_0.length(); | |
if (index < length) | |
return moveAt(this.__source_field_0, index); | |
index -= length; | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Range = OnlyResult!(ubyte, 1LU); | |
immutable immutable(ulong) length = this.__source_field_1.length(); | |
if (index < length) | |
return cast(int)moveAt(this.__source_field_1, index); | |
index -= length; | |
} | |
} | |
assert(false); | |
} | |
} | |
static if (false && allSatisfy!(hasAssignableElements, R) | |
) | |
{ | |
void opIndexAssign(ElementType v, size_t index) | |
{ | |
foreach (i, Range; R) | |
{ | |
static if (isInfinite!Range | |
) | |
{ | |
source[i][index] = v; | |
} | |
else | |
{ | |
immutable length = source[i].length; | |
if (index < length) | |
{ | |
source[i][index] = v; | |
return ; | |
} | |
index -= length; | |
} | |
} | |
assert(false); | |
} | |
} | |
} | |
static if (true && true) | |
{ | |
auto pure nothrow @nogc @safe Result opSlice(ulong begin, ulong end) | |
{ | |
assert(&this, "null this"); | |
Result result = this; | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
immutable immutable(ulong) len = result.__source_field_0.length(); | |
if (len < begin) | |
{ | |
result.__source_field_0 = result.__source_field_0.opSlice(len, len); | |
begin -= len; | |
} | |
else | |
{ | |
result.__source_field_0 = result.__source_field_0.opSlice(begin, len); | |
break; | |
} | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
immutable immutable(ulong) len = result.__source_field_1.length(); | |
if (len < begin) | |
{ | |
result.__source_field_1 = result.__source_field_1.opSlice(len, len); | |
begin -= len; | |
} | |
else | |
{ | |
result.__source_field_1 = result.__source_field_1.opSlice(begin, len); | |
break; | |
} | |
} | |
} | |
ulong cut = this.length(); | |
cut = cut <= end ? 0LU : cut - end; | |
unrolled { | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
immutable immutable(ulong) len = result.__source_field_1.length(); | |
if (cut > len) | |
{ | |
result.__source_field_1 = result.__source_field_1.opSlice(0LU, 0LU); | |
cut -= len; | |
} | |
else | |
{ | |
result.__source_field_1 = result.__source_field_1.opSlice(0LU, len - cut); | |
break; | |
} | |
} | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
immutable immutable(ulong) len = result.__source_field_0.length(); | |
if (cut > len) | |
{ | |
result.__source_field_0 = result.__source_field_0.opSlice(0LU, 0LU); | |
cut -= len; | |
} | |
else | |
{ | |
result.__source_field_0 = result.__source_field_0.opSlice(0LU, len - cut); | |
break; | |
} | |
} | |
} | |
return result; | |
} | |
} | |
} | |
} | |
Result __source_field_0; | |
OnlyResult!(ubyte, 1LU) __source_field_1; | |
} | |
return Result(Result(0, 0), OnlyResult(cast(ubyte)0u, true)).this(_param_0, _param_1); | |
} | |
allSatisfy!(sameET, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = false; | |
allSatisfy!(sameET, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool sameET = true; | |
allSatisfy!(sameET, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = false; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool sameET = false; | |
anySatisfy!(isInfinite, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool anySatisfy = false; | |
anySatisfy!(isInfinite, Result) | |
enum bool anySatisfy = false; | |
F!(Result) | |
enum bool isInfinite = false; | |
anySatisfy!(isInfinite, OnlyResult!(ubyte, 1LU)) | |
enum bool anySatisfy = false; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool isInfinite = false; | |
allSatisfy!(isForwardRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isForwardRange, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool isForwardRange = true; | |
allSatisfy!(isForwardRange, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool isForwardRange = true; | |
allSatisfy!(hasMobileElements, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasMobileElements, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool hasMobileElements = true; | |
moveFront!(Result) | |
pure nothrow @nogc @safe int moveFront(Result r) | |
{ | |
return r.front(); | |
} | |
hasElaborateCopyConstructor!int | |
enum bool hasElaborateCopyConstructor = false; | |
isStaticArray!int | |
enum bool isStaticArray = false; | |
isBidirectionalRange!(Result) | |
enum bool isBidirectionalRange = true; | |
moveBack!(Result) | |
pure nothrow @nogc @safe int moveBack(Result r) | |
{ | |
return r.back(); | |
} | |
isRandomAccessRange!(Result) | |
enum bool isRandomAccessRange = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
moveAt!(Result) | |
pure nothrow @nogc @safe int moveAt(Result r, ulong i) | |
{ | |
return r.opIndex(i); | |
} | |
allSatisfy!(hasMobileElements, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool hasMobileElements = true; | |
moveFront!(OnlyResult!(ubyte, 1LU)) | |
pure nothrow @nogc @safe ubyte moveFront(OnlyResult!(ubyte, 1LU) r) | |
{ | |
return r.front(); | |
} | |
hasElaborateCopyConstructor!ubyte | |
enum bool hasElaborateCopyConstructor = false; | |
isStaticArray!ubyte | |
enum bool isStaticArray = false; | |
isBidirectionalRange!(OnlyResult!(ubyte, 1LU)) | |
enum bool isBidirectionalRange = true; | |
moveBack!(OnlyResult!(ubyte, 1LU)) | |
pure nothrow @nogc @safe ubyte moveBack(OnlyResult!(ubyte, 1LU) r) | |
{ | |
return r.back(); | |
} | |
isRandomAccessRange!(OnlyResult!(ubyte, 1LU)) | |
enum bool isRandomAccessRange = true; | |
isNarrowString!(OnlyResult!(ubyte, 1LU)) | |
enum bool isNarrowString = false; | |
isAggregateType!(OnlyResult!(ubyte, 1LU)) | |
enum bool isAggregateType = true; | |
isStaticArray!(OnlyResult!(ubyte, 1LU)) | |
enum bool isStaticArray = false; | |
hasLength!(OnlyResult!(ubyte, 1LU)) | |
enum bool hasLength = true; | |
moveAt!(OnlyResult!(ubyte, 1LU)) | |
pure nothrow @nogc @safe ubyte moveAt(OnlyResult!(ubyte, 1LU) r, ulong i) | |
{ | |
return r.opIndex(i); | |
} | |
allSatisfy!(isBidirectionalRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isBidirectionalRange, Result) | |
enum bool allSatisfy = true; | |
allSatisfy!(isBidirectionalRange, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasLength, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasLength, Result) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasLength, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isRandomAccessRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isRandomAccessRange, Result) | |
enum bool allSatisfy = true; | |
allSatisfy!(isRandomAccessRange, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasSlicing, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasSlicing, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool hasSlicing = true; | |
allSatisfy!(hasSlicing, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool hasSlicing = true; | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isSomeChar!char | |
enum bool isSomeChar = true; | |
CharTypeOf!char | |
alias CharTypeOf = char; | |
OriginalType!char | |
alias OriginalType = char; | |
ModifyTypePreservingTQ!(Impl, char) | |
alias ModifyTypePreservingTQ = char; | |
Modifier!char | |
alias Impl = char; | |
Unqual!char | |
alias Unqual = char; | |
staticIndexOf!(char, char, wchar, dchar) | |
enum int staticIndexOf = 0; | |
genericIndexOf!(char, char, wchar, dchar) | |
isSame!(char, char) | |
enum bool isSame = true; | |
format!(char, ubyte) | |
pure @safe string format(const(char[]) fmt, ubyte _param_1) | |
{ | |
import std.format : formattedWrite, FormatException; | |
import std.array : appender; | |
Appender!string w = appender(); | |
uint n = formattedWrite(w, fmt, _param_1); | |
import std.conv : text; | |
import std.exception : enforce; | |
enforce(cast(ulong)n == 1LU, delegate Throwable() => new FormatException(text("Orphan format arguments: args[", n, "..", 1LU, "]"), "/usr/include/dmd/phobos/std/format.d", 5531LU, null)); | |
return w.data(); | |
} | |
isDynamicArray!string | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!string | |
alias DynamicArrayTypeOf = string; | |
isAggregateType!string | |
enum bool isAggregateType = false; | |
OriginalType!string | |
alias OriginalType = string; | |
ModifyTypePreservingTQ!(Impl, string) | |
alias ModifyTypePreservingTQ = string; | |
Modifier!string | |
alias Impl = string; | |
Unqual!string | |
alias Unqual = string; | |
appender!string | |
pure nothrow @safe Appender!string appender() | |
{ | |
return Appender(null).this(null); | |
} | |
Appender!string | |
struct Appender | |
{ | |
import core.memory : GC; | |
private alias T = immutable(char); | |
private struct Data | |
{ | |
ulong capacity; | |
char[] arr; | |
bool canExtend = false; | |
} | |
private Data* _data; | |
pure nothrow @trusted this(string arr) | |
{ | |
this._data = new Data(0LU, null, false); | |
(*this._data).arr = cast(char[])arr; | |
if (__ctfe) | |
return this; | |
(*this._data).capacity = arr.length; | |
return this; | |
} | |
pure nothrow @safe void reserve(ulong newCapacity) | |
{ | |
assert(&this, "null this"); | |
if (this._data) | |
{ | |
if (newCapacity > (*this._data).capacity) | |
this.ensureAddable(newCapacity - (*this._data).arr.length); | |
} | |
else | |
{ | |
this.ensureAddable(newCapacity); | |
} | |
} | |
const pure nothrow @nogc @property @safe ulong capacity() | |
{ | |
assert(&this, "null this"); | |
return this._data ? (*this._data).capacity : 0LU; | |
} | |
inout pure nothrow @nogc @property @trusted string data() | |
{ | |
assert(&this, "null this"); | |
return this._data ? cast(string)(*this._data).arr : null; | |
} | |
private pure nothrow @trusted void ensureAddable(ulong nelems) | |
{ | |
if (!this._data) | |
this._data = new Data(0LU, null, false); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) reqlen = len + nelems; | |
if ((*this._data).capacity >= reqlen) | |
return ; | |
if (__ctfe) | |
{ | |
(*this._data).arr.length = reqlen; | |
(*this._data).arr = (*this._data).arr[0..len]; | |
(*this._data).capacity = reqlen; | |
} | |
else | |
{ | |
ulong newlen = appenderNewCapacity((*this._data).capacity, reqlen); | |
if ((*this._data).canExtend) | |
{ | |
immutable immutable(ulong) u = extend(cast(void*)cast(char*)(*this._data).arr, nelems * 1LU, (newlen - len) * 1LU, null); | |
if (u) | |
{ | |
(*this._data).capacity = u / 1LU; | |
return ; | |
} | |
} | |
import core.checkedint : mulu; | |
bool overflow = false; | |
const const(ulong) nbytes = mulu(newlen, 1LU, overflow); | |
if (overflow) | |
assert(0); | |
BlkInfo_ bi = qalloc(nbytes, 2u, null); | |
(*this._data).capacity = bi.size / 1LU; | |
import core.stdc.string : memcpy; | |
if (len) | |
memcpy(bi.base, cast(const(void*))cast(char*)(*this._data).arr, len * 1LU); | |
(*this._data).arr = (cast(char*)bi.base)[0..len]; | |
(*this._data).canExtend = true; | |
} | |
} | |
private enum bool canPutItem(U) = isImplicitlyConvertible!(U, T) | |
|| isSomeChar!T | |
&& isSomeChar!U | |
; | |
private enum bool canPutConstRange(Range) = isInputRange!(Unqual!Range | |
) | |
&& !isInputRange!Range | |
; | |
private enum bool canPutRange(Range) = isInputRange!Range | |
&& is(typeof(Appender.init.put(Range.init.front))); | |
void put(U)(U item) if (canPutItem!U | |
) | |
{ | |
static if (isSomeChar!T | |
&& isSomeChar!U | |
&& T.sizeof < U.sizeof) | |
{ | |
import std.utf : encode; | |
Unqual!T | |
[T.sizeof == 1 ? 4 : 2] encoded; | |
auto len = encode(encoded, item); | |
put(encoded[0..len]); | |
} | |
else | |
{ | |
import std.conv : emplaceRef; | |
ensureAddable(1); | |
immutable len = _data.arr.length; | |
auto bigData = () => _data.arr.ptr[0..len + 1](); | |
emplaceRef!(Unqual!T | |
) | |
(bigData[len], cast(Unqual!T | |
)item); | |
_data.arr = bigData; | |
} | |
} | |
void put(Range)(Range items) if (canPutConstRange!Range | |
) | |
{ | |
alias p = put!(Unqual!Range | |
) | |
; | |
p(items); | |
} | |
void put(Range)(Range items) if (canPutRange!Range | |
) | |
{ | |
static if (!(isSomeChar!T | |
&& isSomeChar!(ElementType!Range | |
) | |
&& !is(immutable(Range) == immutable(T[]))) && is(typeof(items.length) == size_t)) | |
{ | |
static if (!isSomeChar!T | |
) | |
{ | |
if (items.length == 1) | |
{ | |
put(items.front); | |
return ; | |
} | |
} | |
auto @trusted bigDataFun(size_t extra) | |
{ | |
ensureAddable(extra); | |
return _data.arr.ptr[0.._data.arr.length + extra]; | |
} | |
auto bigData = bigDataFun(items.length); | |
immutable len = _data.arr.length; | |
immutable newlen = bigData.length; | |
alias UT = Unqual!T | |
; | |
static if (is(typeof(_data.arr[] = items[])) && !hasElaborateAssign!UT | |
&& isAssignable!(UT, ElementEncodingType!Range | |
) | |
) | |
{ | |
bigData[len..newlen] = items[]; | |
} | |
else | |
{ | |
import std.conv : emplaceRef; | |
foreach (ref it; bigData[len..newlen]) | |
{ | |
emplaceRef!T | |
(it, items.front); | |
items.popFront(); | |
} | |
} | |
_data.arr = bigData; | |
} | |
else | |
{ | |
for (; !items.empty; items.popFront()) | |
{ | |
{ | |
put(items.front); | |
} | |
} | |
} | |
} | |
void opOpAssign(string op : "~", U)(U rhs) if (__traits(compiles, put(rhs))) | |
{ | |
put(rhs); | |
} | |
static if (isMutable!(immutable(char)) | |
enum bool isMutable = false; | |
) | |
{ | |
pure nothrow @trusted void clear() | |
{ | |
if (_data) | |
{ | |
_data.arr = _data.arr.ptr[0..0]; | |
} | |
} | |
pure @trusted void shrinkTo(size_t newlength) | |
{ | |
import std.exception : enforce; | |
if (_data) | |
{ | |
enforce(newlength <= _data.arr.length, "Attempting to shrink Appender with newlength > length"); | |
_data.arr = _data.arr.ptr[0..newlength]; | |
} | |
else | |
enforce(newlength == 0, "Attempting to shrink empty Appender with non-zero newlength"); | |
} | |
} | |
void toString(Writer)(scope Writer w) | |
{ | |
import std.format : formattedWrite; | |
w.formattedWrite((typeof(this)).stringof ~ "(%s)", data); | |
} | |
} | |
ElementEncodingType!string | |
alias ElementEncodingType = immutable(char); | |
StringTypeOf!string | |
alias StringTypeOf = string; | |
Unqual!(immutable(char)) | |
alias Unqual = char; | |
isMutable!(immutable(char)) | |
enum bool isMutable = false; | |
static __gshared TypeInfo_Struct _D53TypeInfo_S3std5array17__T8AppenderTAyaZ8Appender4Data6__initZ; | |
formattedWrite!(Appender!string, char, ubyte) | |
pure @safe uint formattedWrite(Appender!string w, const(char[]) fmt, ubyte _param_2) | |
{ | |
import std.conv : text, to; | |
alias FPfmt = void function(Appender!string, scope const(void)*, ref const(FormatSpec!char)) pure nothrow @safe; | |
FormatSpec!char spec = spec = FormatSpec , spec.this(fmt); | |
void function(Appender!string, scope const(void)*, ref const(FormatSpec!char)) pure nothrow @safe[1] funs = null; | |
scope const(void)*[1] argsAddresses = null; | |
if (!__ctfe) | |
{ | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Arg = ubyte; | |
funs[0] = (*function () => & formatGeneric)(); | |
argsAddresses[0] = (*function (return ref ubyte arg) => cast(const(void*))&arg)(_param_2); | |
if (0) | |
formatValue(w, _param_2, spec); | |
} | |
} | |
} | |
uint currentArg = 0u; | |
for (; spec.writeUpToNextSpec(w);) | |
{ | |
{ | |
if (cast(ulong)currentArg == 1LU && !spec.indexStart) | |
{ | |
enforceEx(fmt.length == 0LU, delegate string() => text("Orphan format specifier: %", spec.spec), "/usr/include/dmd/phobos/std/format.d", 477LU); | |
break; | |
} | |
if (spec.width == 2147483647) | |
{ | |
int width = to(getNthInt(currentArg, _param_2)); | |
if (width < 0) | |
{ | |
spec.flDash(true); | |
width = -width; | |
} | |
spec.width = width; | |
currentArg += 1u; | |
} | |
else if (spec.width < 0) | |
{ | |
uint index = cast(uint)-spec.width; | |
assert(index > 0u); | |
int width = to(getNthInt(index - 1u, _param_2)); | |
if (currentArg < index) | |
currentArg = index; | |
if (width < 0) | |
{ | |
spec.flDash(true); | |
width = -width; | |
} | |
spec.width = width; | |
} | |
if (spec.precision == 2147483647) | |
{ | |
int precision = to(getNthInt(currentArg, _param_2)); | |
if (precision >= 0) | |
spec.precision = precision; | |
else | |
spec.precision = 2147483646; | |
currentArg += 1u; | |
} | |
else if (spec.precision < 0) | |
{ | |
uint index = cast(uint)-spec.precision; | |
assert(index > 0u); | |
int precision = to(getNthInt(index - 1u, _param_2)); | |
if (currentArg < index) | |
currentArg = index; | |
if (precision >= 0) | |
spec.precision = precision; | |
else | |
spec.precision = 2147483646; | |
} | |
if (cast(int)spec.indexStart > 0) | |
{ | |
{ | |
int __key2396 = cast(int)spec.indexStart - 1; | |
int __limit2397 = cast(int)spec.indexEnd; | |
for (; __key2396 < __limit2397; __key2396 += 1) | |
{ | |
int i = __key2396; | |
if (1LU <= cast(ulong)i) | |
break; | |
if (__ctfe) | |
formatNth(w, spec, cast(ulong)i, _param_2); | |
else | |
(*funs[cast(ulong)i])(w, argsAddresses[cast(ulong)i], spec); | |
} | |
} | |
if (currentArg < cast(uint)cast(int)spec.indexEnd) | |
currentArg = cast(uint)spec.indexEnd; | |
} | |
else | |
{ | |
if (__ctfe) | |
formatNth(w, spec, cast(ulong)currentArg, _param_2); | |
else | |
(*funs[cast(ulong)currentArg])(w, argsAddresses[cast(ulong)currentArg], spec); | |
currentArg += 1u; | |
} | |
} | |
} | |
return currentArg; | |
} | |
FormatSpec!char | |
struct FormatSpec | |
{ | |
import std.ascii : isDigit; | |
import std.algorithm.searching : startsWith; | |
import std.conv : parse, text, to; | |
int width = 0; | |
int precision = 2147483646; | |
enum int DYNAMIC = 2147483647; | |
enum int UNSPECIFIED = 2147483646; | |
char spec = 's'; | |
ubyte indexStart; | |
ubyte indexEnd; | |
version (StdDdoc) | |
{ | |
bool flDash; | |
bool flZero; | |
bool flSpace; | |
bool flPlus; | |
bool flHash; | |
ubyte allFlags; | |
} | |
else | |
{ | |
union | |
{ | |
import std.bitmanip : bitfields; | |
mixin(bitfields!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
string bitfields = "private ubyte _flDash_flZero_flSpace_flPlus_flHash_;@property bool flDash() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 1U) != 0;}\x0a@property void flDash(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 1U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))1U;}\x0a@property bool flZero() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 2U) != 0;}\x0a@property void flZero(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 2U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))2U;}\x0a@property bool flSpace() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 4U) != 0;}\x0a@property void flSpace(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 4U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))4U;}\x0a@property bool flPlus() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 8U) != 0;}\x0a@property void flPlus(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 8U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))8U;}\x0a@property bool flHash() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 16U) != 0;}\x0a@property void flHash(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 16U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))16U;}\x0a"); | |
ubyte allFlags; | |
} | |
} | |
const(char)[] nested; | |
const(char)[] sep; | |
const(char)[] trailing; | |
enum string seqBefore = "["; | |
enum string seqAfter = "]"; | |
enum string keySeparator = ":"; | |
enum string seqSeparator = ", "; | |
pure nothrow @nogc @safe this(const(char[]) fmt) | |
{ | |
this.trailing = fmt; | |
return this; | |
} | |
bool writeUpToNextSpec(OutputRange)(OutputRange writer) | |
{ | |
if (trailing.empty) | |
return false; | |
for (size_t i = 0; | |
i < trailing.length; ++i) | |
{ | |
{ | |
if (trailing[i] != '%') | |
continue; | |
put(writer, trailing[0..i]); | |
trailing = trailing[i..__dollar]; | |
enforceFmt(trailing.length >= 2, "Unterminated format specifier: \"%\""); | |
trailing = trailing[1..__dollar]; | |
if (trailing[0] != '%') | |
{ | |
fillUp(); | |
return true; | |
} | |
i = 0; | |
} | |
} | |
put(writer, trailing); | |
trailing = null; | |
return false; | |
} | |
unittest | |
{ | |
import std.array; | |
Appender!(char[]) w = appender(); | |
FormatSpec!char f = f = FormatSpec , f.this("abc%sdef%sghi"); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "abc", w.data()); | |
assert(f.trailing == "def%sghi", text(f.trailing)); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "abcdef", w.data()); | |
assert(f.trailing == "ghi"); | |
f = FormatSpec(0, 2147483646, 's', cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, , null, null, null).this("ab%%cd%%ef%sg%%h%sij"); | |
w.clear(); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "ab%cd%ef" && f.trailing == "g%%h%sij", w.data()); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "ab%cd%efg%h" && f.trailing == "ij"); | |
f = FormatSpec(0, 2147483646, 's', cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, , null, null, null).this("%%%s"); | |
w.clear(); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "%" && f.trailing == ""); | |
f = FormatSpec(0, 2147483646, 's', cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, , null, null, null).this("%%%%%s%%"); | |
w.clear(); | |
for (; f.writeUpToNextSpec(w);) | |
{ | |
continue; | |
} | |
assert(w.data() == "%%%"); | |
f = FormatSpec(0, 2147483646, 's', cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, , null, null, null).this("a%%b%%c%"); | |
w.clear(); | |
assertThrown(delegate bool() => f.writeUpToNextSpec(w), null, "/usr/include/dmd/phobos/std/format.d", 1151LU); | |
assert(w.data() == "a%b%c" && f.trailing == "%"); | |
} | |
private pure @safe void fillUp() | |
{ | |
if (__ctfe) | |
{ | |
this.flDash(false); | |
this.flZero(false); | |
this.flSpace(false); | |
this.flPlus(false); | |
this.flHash(false); | |
} | |
else | |
{ | |
this.allFlags = cast(ubyte)0u; | |
} | |
this.width = 0; | |
this.precision = 2147483646; | |
this.nested = null; | |
{ | |
ulong i = 0LU; | |
for (; i < this.trailing.length;) | |
{ | |
{ | |
switch (cast(int)this.trailing[i]) | |
{ | |
case 40: | |
{ | |
ulong j = i + 1LU; | |
{ | |
uint innerParens = 0u; | |
for (;;) | |
{ | |
{ | |
enforceEx(j + 1LU < this.trailing.length, delegate string() => text("Incorrect format specifier: %", this.trailing[i..__dollar]), "/usr/include/dmd/phobos/std/format.d", 1185LU); | |
if (cast(int)this.trailing[j++] != 37) | |
{ | |
continue; | |
} | |
if (cast(int)this.trailing[j] == 45) | |
{ | |
j += 1LU; | |
enforceEx(j < this.trailing.length, delegate string() => text("Incorrect format specifier: %", this.trailing[i..__dollar]), "/usr/include/dmd/phobos/std/format.d", 1195LU); | |
} | |
if (cast(int)this.trailing[j] == 41) | |
{ | |
if (innerParens-- == 0u) | |
break; | |
} | |
else if (cast(int)this.trailing[j] == 124) | |
{ | |
if (innerParens == 0u) | |
break; | |
} | |
else if (cast(int)this.trailing[j] == 40) | |
{ | |
innerParens += 1u; | |
} | |
} | |
} | |
} | |
if (cast(int)this.trailing[j] == 124) | |
{ | |
ulong k = j; | |
{ | |
j += 1LU; | |
for (;;) | |
{ | |
{ | |
if (cast(int)this.trailing[j++] != 37) | |
continue; | |
if (cast(int)this.trailing[j] == 37) | |
j += 1LU; | |
else if (cast(int)this.trailing[j] == 41) | |
break; | |
else | |
throw new Exception(text("Incorrect format specifier: %", this.trailing[j..__dollar]), "/usr/include/dmd/phobos/std/format.d", 1223LU, null); | |
} | |
} | |
} | |
this.nested = this.trailing[i + 1LU..k - 1LU]; | |
this.sep = this.trailing[k + 1LU..j - 1LU]; | |
} | |
else | |
{ | |
this.nested = this.trailing[i + 1LU..j - 1LU]; | |
this.sep = null; | |
} | |
this.spec = '('; | |
this.trailing = this.trailing[j + 1LU..__dollar]; | |
return ; | |
} | |
case 45: | |
{ | |
this.flDash(true); | |
i += 1LU; | |
break; | |
} | |
case 43: | |
{ | |
this.flPlus(true); | |
i += 1LU; | |
break; | |
} | |
case 35: | |
{ | |
this.flHash(true); | |
i += 1LU; | |
break; | |
} | |
case 48: | |
{ | |
this.flZero(true); | |
i += 1LU; | |
break; | |
} | |
case 32: | |
{ | |
this.flSpace(true); | |
i += 1LU; | |
break; | |
} | |
case 42: | |
{ | |
if (isDigit(cast(dchar)this.trailing[i += 1LU])) | |
{ | |
this.trailing = this.trailing[1..__dollar]; | |
this.width = -parse(this.trailing); | |
i = 0LU; | |
enforceEx(cast(int)this.trailing[i++] == 36, delegate string() => "$ expected", "/usr/include/dmd/phobos/std/format.d", 1253LU); | |
} | |
else | |
{ | |
this.width = 2147483647; | |
} | |
break; | |
} | |
case 49: | |
; | |
case 50: | |
; | |
case 51: | |
; | |
case 52: | |
; | |
case 53: | |
; | |
case 54: | |
; | |
case 55: | |
; | |
case 56: | |
; | |
case 57: | |
{ | |
const(char)[] tmp = this.trailing[i..__dollar]; | |
const const(uint) widthOrArgIndex = parse(tmp); | |
enforceEx(tmp.length, delegate string() => text("Incorrect format specifier %", this.trailing[i..__dollar]), "/usr/include/dmd/phobos/std/format.d", 1265LU); | |
i = cast(ulong)arrayPtrDiff(tmp, this.trailing); | |
if (startsWith(tmp, '$')) | |
{ | |
this.indexEnd = (this.indexStart = to(widthOrArgIndex)); | |
i += 1LU; | |
} | |
else if (startsWith(tmp, ':')) | |
{ | |
this.indexStart = to(widthOrArgIndex); | |
tmp = tmp[1..__dollar]; | |
if (startsWith(tmp, '$')) | |
{ | |
this.indexEnd = cast(ubyte)255u; | |
} | |
else | |
{ | |
this.indexEnd = parse(tmp); | |
} | |
i = cast(ulong)arrayPtrDiff(tmp, this.trailing); | |
enforceEx(cast(int)this.trailing[i++] == 36, delegate string() => "$ expected", "/usr/include/dmd/phobos/std/format.d", 1288LU); | |
} | |
else | |
{ | |
this.width = to(widthOrArgIndex); | |
} | |
break; | |
} | |
case 46: | |
{ | |
if (cast(int)this.trailing[i += 1LU] == 42) | |
{ | |
if (isDigit(cast(dchar)this.trailing[i += 1LU])) | |
{ | |
this.trailing = this.trailing[i..__dollar]; | |
i = 0LU; | |
this.precision = -parse(this.trailing); | |
enforceEx(cast(int)this.trailing[i++] == 36, delegate string() => "$ expected", "/usr/include/dmd/phobos/std/format.d", 1308LU); | |
} | |
else | |
{ | |
this.precision = 2147483647; | |
} | |
} | |
else if (cast(int)this.trailing[i] == 45) | |
{ | |
this.precision = 0; | |
const(char)[] tmp = this.trailing[i..__dollar]; | |
parse(tmp); | |
i = cast(ulong)arrayPtrDiff(tmp, this.trailing); | |
} | |
else if (isDigit(cast(dchar)this.trailing[i])) | |
{ | |
const(char)[] tmp = this.trailing[i..__dollar]; | |
this.precision = parse(tmp); | |
i = cast(ulong)arrayPtrDiff(tmp, this.trailing); | |
} | |
else | |
{ | |
this.precision = 0; | |
} | |
break; | |
} | |
default: | |
{ | |
this.spec = this.trailing[i++]; | |
this.trailing = this.trailing[i..__dollar]; | |
return ; | |
} | |
} | |
} | |
} | |
} | |
throw new Exception(text("Incorrect format specifier: ", this.trailing), "/usr/include/dmd/phobos/std/format.d", 1344LU, null); | |
} | |
private bool readUpToNextSpec(R)(ref R r) | |
{ | |
import std.ascii : isLower, isWhite; | |
import std.utf : stride; | |
if (__ctfe) | |
{ | |
flDash = false; | |
flZero = false; | |
flSpace = false; | |
flPlus = false; | |
flHash = false; | |
} | |
else | |
{ | |
allFlags = 0; | |
} | |
width = 0; | |
precision = UNSPECIFIED; | |
nested = null; | |
while (trailing.length) | |
{ | |
const c = trailing[0]; | |
if (c == '%' && trailing.length > 1) | |
{ | |
const c2 = trailing[1]; | |
if (c2 == '%') | |
{ | |
assert(!r.empty); | |
if (r.front != '%') | |
break; | |
trailing = trailing[2..__dollar]; | |
r.popFront(); | |
} | |
else | |
{ | |
enforce(isLower(c2) || c2 == '*' || c2 == '(', text("'%", c2, "' not supported with formatted read")); | |
trailing = trailing[1..__dollar]; | |
fillUp(); | |
return true; | |
} | |
} | |
else | |
{ | |
if (c == ' ') | |
{ | |
while (!r.empty && isWhite(r.front)) | |
r.popFront(); | |
} | |
else | |
{ | |
enforce(!r.empty, text("parseToFormatSpec: Cannot find character '", c, "' in the input string.")); | |
if (r.front != trailing.front) | |
break; | |
r.popFront(); | |
} | |
trailing = trailing[stride(trailing, 0)..__dollar]; | |
} | |
} | |
return false; | |
} | |
private const pure @safe string getCurFmtStr() | |
{ | |
import std.array : appender; | |
Appender!string w = appender(); | |
FormatSpec!char f = f = FormatSpec , f.this("%s"); | |
put(w, '%'); | |
if (cast(int)this.indexStart != 0) | |
{ | |
formatValue(w, this.indexStart, f); | |
put(w, '$'); | |
} | |
if (this.flDash()) | |
put(w, '-'); | |
if (this.flZero()) | |
put(w, '0'); | |
if (this.flSpace()) | |
put(w, ' '); | |
if (this.flPlus()) | |
put(w, '+'); | |
if (this.flHash()) | |
put(w, '#'); | |
if (this.width != 0) | |
formatValue(w, this.width, f); | |
if (this.precision != 2147483646) | |
{ | |
put(w, '.'); | |
formatValue(w, this.precision, f); | |
} | |
put(w, this.spec); | |
return w.data(); | |
} | |
unittest | |
{ | |
import std.array; | |
Appender!string w = appender(); | |
FormatSpec!char f = f = FormatSpec , f.this("%.16f"); | |
f.writeUpToNextSpec(w); | |
assert(cast(int)f.spec == 102); | |
string fmt = f.getCurFmtStr(); | |
assert(fmt == "%.16f"); | |
} | |
private pure @safe const(char)[] headUpToNextSpec() | |
{ | |
import std.array : appender; | |
Appender!(const(char)[]) w = appender(); | |
const(char)[] tr = this.trailing; | |
for (; tr.length;) | |
{ | |
{ | |
if (cast(int)tr[0] == 37) | |
{ | |
if (tr.length > 1LU && cast(int)tr[1] == 37) | |
{ | |
tr = tr[2..__dollar]; | |
w.put('%'); | |
} | |
else | |
break; | |
} | |
else | |
{ | |
w.put(front(tr)); | |
popFront(tr); | |
} | |
} | |
} | |
return w.data(); | |
} | |
pure @safe string toString() | |
{ | |
assert(&this, "null this"); | |
return text("address = ", cast(void*)&this, "\x0awidth = ", this.width, "\x0aprecision = ", this.precision, "\x0aspec = ", this.spec, "\x0aindexStart = ", this.indexStart, "\x0aindexEnd = ", this.indexEnd, "\x0aflDash = ", this.flDash(), "\x0aflZero = ", this.flZero(), "\x0aflSpace = ", this.flSpace(), "\x0aflPlus = ", this.flPlus(), "\x0aflHash = ", this.flHash(), "\x0anested = ", this.nested, "\x0atrailing = ", this.trailing, "\x0a"); | |
} | |
} | |
bitfields!(uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
string bitfields = "private uint _fraction_exponent_sign;@property uint fraction() @safe pure nothrow @nogc const { auto result = (_fraction_exponent_sign & 8388607U) >>0U; return cast(uint) result;}\x0a@property void fraction(uint v) @safe pure nothrow @nogc { assert(v >= fraction_min, \"Value is smaller than the minimum value of bitfield 'fraction'\"); assert(v <= fraction_max, \"Value is greater than the maximum value of bitfield 'fraction'\"); _fraction_exponent_sign = cast(typeof(_fraction_exponent_sign)) ((_fraction_exponent_sign & ~cast(typeof(_fraction_exponent_sign))8388607U) | ((cast(typeof(_fraction_exponent_sign)) v << 0U) & 8388607U));}\x0aenum uint fraction_min = cast(uint)0U; enum uint fraction_max = cast(uint)8388607U; @property ubyte exponent() @safe pure nothrow @nogc const { auto result = (_fraction_exponent_sign & 2139095040U) >>23U; return cast(ubyte) result;}\x0a@property void exponent(ubyte v) @safe pure nothrow @nogc { assert(v >= exponent_min, \"Value is smaller than the minimum value of bitfield 'exponent'\"); assert(v <= exponent_max, \"Value is greater than the maximum value of bitfield 'exponent'\"); _fraction_exponent_sign = cast(typeof(_fraction_exponent_sign)) ((_fraction_exponent_sign & ~cast(typeof(_fraction_exponent_sign))2139095040U) | ((cast(typeof(_fraction_exponent_sign)) v << 23U) & 2139095040U));}\x0aenum ubyte exponent_min = cast(ubyte)0U; enum ubyte exponent_max = cast(ubyte)255U; @property bool sign() @safe pure nothrow @nogc const { return (_fraction_exponent_sign & 2147483648U) != 0;}\x0a@property void sign(bool v) @safe pure nothrow @nogc { if (v) _fraction_exponent_sign |= 2147483648U;else _fraction_exponent_sign &= ~cast(typeof(_fraction_exponent_sign))2147483648U;}\x0a"createStorageAndFields!(uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
createStoreName!(uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
enum string createStoreName = "_fraction_exponent_sign"; | |
createStoreName!(ubyte, "exponent", 8, bool, "sign", 1) | |
enum string createStoreName = "_exponent_sign"; | |
createStoreName!(bool, "sign", 1) | |
enum string createStoreName = "_sign"; | |
createStoreName!() | |
enum string createStoreName = ""; | |
sizeOfBitField!(uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
enum int sizeOfBitField = 32; | |
sizeOfBitField!(ubyte, "exponent", 8, bool, "sign", 1) | |
enum int sizeOfBitField = 9; | |
sizeOfBitField!(bool, "sign", 1) | |
enum int sizeOfBitField = 1; | |
sizeOfBitField!() | |
enum int sizeOfBitField = 0; | |
createFields!("_fraction_exponent_sign", 0LU, uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", uint, "fraction", 23LU, 0LU) | |
createFields!("_fraction_exponent_sign", 23LU, ubyte, "exponent", 8, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", ubyte, "exponent", 8LU, 23LU) | |
createFields!("_fraction_exponent_sign", 31LU, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", bool, "sign", 1LU, 31LU) | |
createFields!("_fraction_exponent_sign", 32LU) | |
bitfields!(ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
string bitfields = "private ulong _fraction_exponent_sign;@property ulong fraction() @safe pure nothrow @nogc const { auto result = (_fraction_exponent_sign & 4503599627370495UL) >>0U; return cast(ulong) result;}\x0a@property void fraction(ulong v) @safe pure nothrow @nogc { assert(v >= fraction_min, \"Value is smaller than the minimum value of bitfield 'fraction'\"); assert(v <= fraction_max, \"Value is greater than the maximum value of bitfield 'fraction'\"); _fraction_exponent_sign = cast(typeof(_fraction_exponent_sign)) ((_fraction_exponent_sign & ~cast(typeof(_fraction_exponent_sign))4503599627370495UL) | ((cast(typeof(_fraction_exponent_sign)) v << 0U) & 4503599627370495UL));}\x0aenum ulong fraction_min = cast(ulong)0U; enum ulong fraction_max = cast(ulong)4503599627370495UL; @property ushort exponent() @safe pure nothrow @nogc const { auto result = (_fraction_exponent_sign & 9218868437227405312UL) >>52U; return cast(ushort) result;}\x0a@property void exponent(ushort v) @safe pure nothrow @nogc { assert(v >= exponent_min, \"Value is smaller than the minimum value of bitfield 'exponent'\"); assert(v <= exponent_max, \"Value is greater than the maximum value of bitfield 'exponent'\"); _fraction_exponent_sign = cast(typeof(_fraction_exponent_sign)) ((_fraction_exponent_sign & ~cast(typeof(_fraction_exponent_sign))9218868437227405312UL) | ((cast(typeof(_fraction_exponent_sign)) v << 52U) & 9218868437227405312UL));}\x0aenum ushort exponent_min = cast(ushort)0U; enum ushort exponent_max = cast(ushort)2047U; @property bool sign() @safe pure nothrow @nogc const { return (_fraction_exponent_sign & 9223372036854775808UL) != 0;}\x0a@property void sign(bool v) @safe pure nothrow @nogc { if (v) _fraction_exponent_sign |= 9223372036854775808UL;else _fraction_exponent_sign &= ~cast(typeof(_fraction_exponent_sign))9223372036854775808UL;}\x0a"createStorageAndFields!(ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
createStoreName!(ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
enum string createStoreName = "_fraction_exponent_sign"; | |
createStoreName!(ushort, "exponent", 11, bool, "sign", 1) | |
enum string createStoreName = "_exponent_sign"; | |
sizeOfBitField!(ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
enum int sizeOfBitField = 64; | |
sizeOfBitField!(ushort, "exponent", 11, bool, "sign", 1) | |
enum int sizeOfBitField = 12; | |
createFields!("_fraction_exponent_sign", 0LU, ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", ulong, "fraction", 52LU, 0LU) | |
createFields!("_fraction_exponent_sign", 52LU, ushort, "exponent", 11, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", ushort, "exponent", 11LU, 52LU) | |
createFields!("_fraction_exponent_sign", 63LU, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", bool, "sign", 1LU, 63LU) | |
createFields!("_fraction_exponent_sign", 64LU) | |
bitfields!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
string bitfields = "private ubyte _flDash_flZero_flSpace_flPlus_flHash_;@property bool flDash() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 1U) != 0;}\x0a@property void flDash(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 1U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))1U;}\x0a@property bool flZero() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 2U) != 0;}\x0a@property void flZero(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 2U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))2U;}\x0a@property bool flSpace() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 4U) != 0;}\x0a@property void flSpace(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 4U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))4U;}\x0a@property bool flPlus() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 8U) != 0;}\x0a@property void flPlus(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 8U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))8U;}\x0a@property bool flHash() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 16U) != 0;}\x0a@property void flHash(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 16U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))16U;}\x0a"createStorageAndFields!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createStoreName!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flDash_flZero_flSpace_flPlus_flHash_"; | |
createStoreName!(bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flZero_flSpace_flPlus_flHash_"; | |
createStoreName!(bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flSpace_flPlus_flHash_"; | |
createStoreName!(bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flPlus_flHash_"; | |
createStoreName!(bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flHash_"; | |
createStoreName!(ubyte, "", 3) | |
enum string createStoreName = "_"; | |
sizeOfBitField!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 8; | |
sizeOfBitField!(bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 7; | |
sizeOfBitField!(bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 6; | |
sizeOfBitField!(bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 5; | |
sizeOfBitField!(bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 4; | |
sizeOfBitField!(ubyte, "", 3) | |
enum int sizeOfBitField = 3; | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 0LU, bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flDash", 1LU, 0LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 1LU, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flZero", 1LU, 1LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 2LU, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flSpace", 1LU, 2LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 3LU, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flPlus", 1LU, 3LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 4LU, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flHash", 1LU, 4LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 5LU, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", ubyte, "", 3LU, 5LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 8LU) | |
isNarrowString!(int[]) | |
enum bool isNarrowString = false; | |
isAggregateType!(int[]) | |
enum bool isAggregateType = false; | |
isStaticArray!(int[]) | |
enum bool isStaticArray = false; | |
popFront!int | |
pure nothrow @nogc @safe void popFront(ref int[] a) | |
{ | |
assert(a.length, "Attempting to popFront() past the end of an array of int"); | |
a = a[1..__dollar]; | |
} | |
isNarrowString!(immutable(int)[]) | |
enum bool isNarrowString = false; | |
isAggregateType!(immutable(int)[]) | |
enum bool isAggregateType = false; | |
isStaticArray!(immutable(int)[]) | |
enum bool isStaticArray = false; | |
popFront!(immutable(int)) | |
pure nothrow @nogc @safe void popFront(ref immutable(int)[] a) | |
{ | |
assert(a.length, "Attempting to popFront() past the end of an array of immutable(int)"); | |
a = a[1..__dollar]; | |
} | |
isNarrowString!(void[]) | |
enum bool isNarrowString = false; | |
isAggregateType!(void[]) | |
enum bool isAggregateType = false; | |
isStaticArray!(void[]) | |
enum bool isStaticArray = false; | |
popBack!(immutable(int)) | |
pure nothrow @nogc @safe void popBack(ref immutable(int)[] a) | |
{ | |
assert(a.length); | |
a = a[0..__dollar - 1LU]; | |
} | |
popBack!int | |
pure nothrow @nogc @safe void popBack(ref int[] a) | |
{ | |
assert(a.length); | |
a = a[0..__dollar - 1LU]; | |
} | |
blockAttribute!void | |
enum int blockAttribute = 0; | |
hasIndirections!void | |
enum bool hasIndirections = false; | |
isStaticArray!void | |
enum bool isStaticArray = false; | |
isFunctionPointer!void | |
enum bool isFunctionPointer = false; | |
isPointer!void | |
enum bool isPointer = false; | |
isAggregateType!void | |
enum bool isAggregateType = false; | |
isDelegate!void | |
enum bool isDelegate = false; | |
isDynamicArray!void | |
enum bool isDynamicArray = false; | |
OriginalType!void | |
alias OriginalType = void; | |
ModifyTypePreservingTQ!(Impl, void) | |
alias ModifyTypePreservingTQ = void; | |
Modifier!void | |
alias Impl = void; | |
Unqual!void | |
alias Unqual = void; | |
isAssociativeArray!void | |
enum bool isAssociativeArray = false; | |
nDimensions!(uint[]) | |
enum int nDimensions = 1; | |
isArray!(uint[]) | |
enum bool isArray = true; | |
isStaticArray!(uint[]) | |
enum bool isStaticArray = false; | |
isDynamicArray!(uint[]) | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!(uint[]) | |
alias DynamicArrayTypeOf = uint[]; | |
isAggregateType!(uint[]) | |
enum bool isAggregateType = false; | |
OriginalType!(uint[]) | |
alias OriginalType = uint[]; | |
ModifyTypePreservingTQ!(Impl, uint[]) | |
alias ModifyTypePreservingTQ = uint[]; | |
Modifier!(uint[]) | |
alias Impl = uint[]; | |
Unqual!(uint[]) | |
alias Unqual = uint[]; | |
nDimensions!uint | |
enum int nDimensions = 0; | |
isArray!uint | |
enum bool isArray = false; | |
isStaticArray!uint | |
enum bool isStaticArray = false; | |
isDynamicArray!uint | |
enum bool isDynamicArray = false; | |
isAggregateType!uint | |
enum bool isAggregateType = false; | |
OriginalType!uint | |
alias OriginalType = uint; | |
ModifyTypePreservingTQ!(Impl, uint) | |
alias ModifyTypePreservingTQ = uint; | |
Modifier!uint | |
alias Impl = uint; | |
nDimensions!(float[][]) | |
enum int nDimensions = 2; | |
isArray!(float[][]) | |
enum bool isArray = true; | |
isStaticArray!(float[][]) | |
enum bool isStaticArray = false; | |
isDynamicArray!(float[][]) | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!(float[][]) | |
alias DynamicArrayTypeOf = float[][]; | |
isAggregateType!(float[][]) | |
enum bool isAggregateType = false; | |
OriginalType!(float[][]) | |
alias OriginalType = float[][]; | |
ModifyTypePreservingTQ!(Impl, float[][]) | |
alias ModifyTypePreservingTQ = float[][]; | |
Modifier!(float[][]) | |
alias Impl = float[][]; | |
Unqual!(float[][]) | |
alias Unqual = float[][]; | |
nDimensions!(float[]) | |
enum int nDimensions = 1; | |
isArray!(float[]) | |
enum bool isArray = true; | |
isStaticArray!(float[]) | |
enum bool isStaticArray = false; | |
isDynamicArray!(float[]) | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!(float[]) | |
alias DynamicArrayTypeOf = float[]; | |
isAggregateType!(float[]) | |
enum bool isAggregateType = false; | |
OriginalType!(float[]) | |
alias OriginalType = float[]; | |
ModifyTypePreservingTQ!(Impl, float[]) | |
alias ModifyTypePreservingTQ = float[]; | |
Modifier!(float[]) | |
alias Impl = float[]; | |
Unqual!(float[]) | |
alias Unqual = float[]; | |
nDimensions!float | |
enum int nDimensions = 0; | |
isArray!float | |
enum bool isArray = false; | |
isStaticArray!float | |
enum bool isStaticArray = false; | |
isDynamicArray!float | |
enum bool isDynamicArray = false; | |
isAggregateType!float | |
enum bool isAggregateType = false; | |
OriginalType!float | |
alias OriginalType = float; | |
ModifyTypePreservingTQ!(Impl, float) | |
alias ModifyTypePreservingTQ = float; | |
Modifier!float | |
alias Impl = float; | |
Unqual!float | |
alias Unqual = float; | |
formatGeneric!(Appender!string, ubyte, char) | |
pure @system void formatGeneric(Appender!string w, const(void)* arg, ref const(FormatSpec!char) f) | |
{ | |
formatValue(w, *cast(ubyte*)arg, f); | |
} | |
OriginalType!ubyte | |
alias OriginalType = ubyte; | |
ModifyTypePreservingTQ!(Impl, ubyte) | |
alias ModifyTypePreservingTQ = ubyte; | |
Modifier!ubyte | |
alias Impl = ubyte; | |
IntegralTypeOf!ubyte | |
alias IntegralTypeOf = ubyte; | |
staticIndexOf!(ubyte, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = 1; | |
genericIndexOf!(ubyte, byte, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(ubyte, byte) | |
enum bool isSame = false; | |
genericIndexOf!(ubyte, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(ubyte, ubyte) | |
enum bool isSame = true; | |
hasToString!(ubyte, char) | |
enum int hasToString = 0; | |
isPointer!ubyte | |
enum bool isPointer = false; | |
TypeTuple!(float, double, real) | |
alias AliasSeq = (float, double, real); | |
staticIndexOf!(ubyte, float, double, real) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(ubyte, float, double, real) | |
OldAlias!float | |
alias OldAlias = float; | |
isSame!(ubyte, float) | |
enum bool isSame = false; | |
expectType!float | |
genericIndexOf!(ubyte, double, real) | |
isAggregateType!double | |
enum bool isAggregateType = false; | |
OldAlias!double | |
alias OldAlias = double; | |
isSame!(ubyte, double) | |
enum bool isSame = false; | |
expectType!double | |
genericIndexOf!(ubyte, real) | |
isAggregateType!real | |
enum bool isAggregateType = false; | |
OldAlias!real | |
alias OldAlias = real; | |
isSame!(ubyte, real) | |
enum bool isSame = false; | |
expectType!real | |
genericIndexOf!ubyte | |
staticIndexOf!(ubyte, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(ubyte, char, wchar, dchar) | |
isSame!(ubyte, char) | |
enum bool isSame = false; | |
genericIndexOf!(ubyte, wchar, dchar) | |
isSame!(ubyte, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(ubyte, dchar) | |
isSame!(ubyte, dchar) | |
enum bool isSame = false; | |
isDelegate!ubyte | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, ubyte, char) | |
pure @safe void formatValue(Appender!string w, ubyte obj, ref const(FormatSpec!char) f) | |
{ | |
alias U = ubyte; | |
ubyte val = obj; | |
if (cast(int)f.spec == 114) | |
{ | |
scope const(char)[] raw = (*function (return ref ubyte val) => (cast(const(char*))&val)[0..1])(val); | |
if (needToSwapEndianess(f)) | |
{ | |
{ | |
scope const(char)[] __r2277 = raw[]; | |
ulong __key2278 = __r2277.length; | |
for (; __key2278--;) | |
{ | |
const const(char) c = __r2277[__key2278]; | |
put(w, c); | |
} | |
} | |
} | |
else | |
{ | |
{ | |
scope const(char)[] __r2302 = raw[]; | |
ulong __key2303 = 0LU; | |
for (; __key2303 < __r2302.length; __key2303 += 1LU) | |
{ | |
const const(char) c = __r2302[__key2303]; | |
put(w, c); | |
} | |
} | |
} | |
return ; | |
} | |
immutable immutable(uint) base = cast(int)f.spec == 120 || cast(int)f.spec == 88 ? 16u : cast(int)f.spec == 111 ? 8u : cast(int)f.spec == 98 ? 2u : cast(int)f.spec == 115 || cast(int)f.spec == 100 || cast(int)f.spec == 117 ? 10u : 0u; | |
enforceEx(base > 0u, delegate string() => "integral", "/usr/include/dmd/phobos/std/format.d", 1744LU); | |
alias C = ulong; | |
formatIntegral(w, cast(ulong)val, f, base, 255LU); | |
} | |
__lambda4!ubyte | |
function (return ref ubyte val) => (cast(const(char*))&val)[0..1]needToSwapEndianess!char | |
pure nothrow @nogc @safe bool needToSwapEndianess(ref const(FormatSpec!char) f) | |
{ | |
import std.system : endian, Endian; | |
return f.flPlus() || false; | |
} | |
put!(Appender!string, const(char)) | |
pure nothrow @safe void put(ref Appender!string r, const(char) e) | |
{ | |
doPut(r, e); | |
} | |
doPut!(Appender!string, const(char)) | |
pure nothrow @safe void doPut(ref Appender!string r, ref const(char) e) | |
{ | |
enum bool usingPut = true; | |
r.put(e); | |
} | |
hasMember!(Appender!string, "put") | |
enum bool hasMember = true; | |
canPutItem!(const(char)) | |
enum bool canPutItem = true; | |
isImplicitlyConvertible!(const(char), immutable(char)) | |
enum bool isImplicitlyConvertible = true; | |
isSomeChar!(immutable(char)) | |
enum bool isSomeChar = true; | |
CharTypeOf!(immutable(char)) | |
alias CharTypeOf = immutable(char); | |
isAggregateType!(immutable(char)) | |
enum bool isAggregateType = false; | |
OriginalType!(immutable(char)) | |
alias OriginalType = immutable(char); | |
ModifyTypePreservingTQ!(Impl, immutable(char)) | |
alias ModifyTypePreservingTQ = immutable immutable(char); | |
Modifier!char | |
alias Impl = char; | |
isSomeChar!(const(char)) | |
enum bool isSomeChar = true; | |
CharTypeOf!(const(char)) | |
alias CharTypeOf = const(char); | |
isAggregateType!(const(char)) | |
enum bool isAggregateType = false; | |
OriginalType!(const(char)) | |
alias OriginalType = const(char); | |
ModifyTypePreservingTQ!(Impl, const(char)) | |
alias ModifyTypePreservingTQ = const const(char); | |
Modifier!char | |
alias Impl = char; | |
Unqual!(const(char)) | |
alias Unqual = char; | |
canPutConstRange!(const(char)) | |
enum bool canPutConstRange = false; | |
isInputRange!char | |
enum bool isInputRange = false; | |
isInputRange!(const(char)) | |
enum bool isInputRange = false; | |
canPutRange!(const(char)) | |
enum bool canPutRange = false; | |
put!(const(char)) | |
pure nothrow @safe void put(const(char) item) | |
{ | |
assert(&this, "null this"); | |
import std.conv : emplaceRef; | |
this.ensureAddable(1LU); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
char[] bigData = delegate () => (cast(char*)(*this._data).arr)[0..len + 1LU](); | |
emplaceRef(bigData[len], item); | |
(*this._data).arr = bigData; | |
} | |
appenderNewCapacity!1LU | |
pure nothrow @nogc @safe ulong appenderNewCapacity(ulong curLen, ulong reqLen) | |
{ | |
import core.bitop : bsr; | |
import std.algorithm.comparison : max; | |
if (curLen == 0LU) | |
return max(reqLen, 8); | |
ulong mult = 100LU + 1000LU / cast(ulong)(bsr(curLen * 1LU) + 1); | |
if (mult > 200LU) | |
mult = 200LU; | |
ulong sugLen = (curLen * mult + 99LU) / 100LU; | |
return max(reqLen, sugLen); | |
} | |
max!(ulong, int) | |
pure nothrow @nogc @safe ulong max(ulong _param_0, int _param_1) | |
{ | |
alias a = ulong _param_0; | |
; | |
alias T0 = ulong; | |
alias b = int _param_1; | |
; | |
alias T1 = int; | |
import std.algorithm.internal : algoFormat; | |
import std.functional : lessThan; | |
immutable immutable(bool) chooseB = safeOp(_param_0, _param_1); | |
return chooseB ? cast(ulong)_param_1 : _param_0; | |
} | |
MaxType!(ulong, int) | |
alias MaxType = ulong; | |
safeOp!"<" | |
bool safeOp(T0, T1)(auto ref T0 a, auto ref T1 b) | |
{ | |
import std.traits : mostNegative; | |
static if (isIntegral!T0 | |
&& isIntegral!T1 | |
&& (mostNegative!T0 | |
< 0) != (mostNegative!T1 | |
< 0)) | |
{ | |
static if (S == "<=" || S == "<") | |
{ | |
static if (mostNegative!T0 | |
< 0) | |
{ | |
immutable result = a < 0 || unsafeOp(a, b); | |
} | |
else | |
{ | |
immutable result = b >= 0 && unsafeOp(a, b); | |
} | |
} | |
else | |
{ | |
static if (mostNegative!T0 | |
< 0) | |
{ | |
immutable result = a >= 0 && unsafeOp(a, b); | |
} | |
else | |
{ | |
immutable result = b < 0 || unsafeOp(a, b); | |
} | |
} | |
} | |
else | |
{ | |
static assert(is(typeof(mixin("a " ~ S ~ " b"))), "Invalid arguments: Cannot compare types " ~ T0.stringof ~ " and " ~ T1.stringof ~ "."); | |
immutable result = mixin("a " ~ S ~ " b"); | |
} | |
return result; | |
} | |
safeOp!(ulong, int) | |
pure nothrow @nogc @safe bool safeOp(ref ulong a, ref int b) | |
{ | |
import std.traits : mostNegative; | |
immutable immutable(bool) result = b >= 0 && unsafeOp(a, b); | |
return result; | |
} | |
isIntegral!ulong | |
enum bool isIntegral = true; | |
IntegralTypeOf!ulong | |
alias IntegralTypeOf = ulong; | |
isAggregateType!ulong | |
enum bool isAggregateType = false; | |
OriginalType!ulong | |
alias OriginalType = ulong; | |
ModifyTypePreservingTQ!(Impl, ulong) | |
alias ModifyTypePreservingTQ = ulong; | |
Modifier!ulong | |
alias Impl = ulong; | |
Unqual!ulong | |
alias Unqual = ulong; | |
staticIndexOf!(ulong, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = 7; | |
genericIndexOf!(ulong, byte, ubyte, short, ushort, int, uint, long, ulong) | |
OldAlias!ulong | |
alias OldAlias = ulong; | |
isSame!(ulong, byte) | |
enum bool isSame = false; | |
expectType!ulong | |
genericIndexOf!(ulong, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(ulong, ubyte) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, short, ushort, int, uint, long, ulong) | |
isSame!(ulong, short) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, ushort, int, uint, long, ulong) | |
isSame!(ulong, ushort) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, int, uint, long, ulong) | |
isSame!(ulong, int) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, uint, long, ulong) | |
OldAlias!uint | |
alias OldAlias = uint; | |
isSame!(ulong, uint) | |
enum bool isSame = false; | |
expectType!uint | |
genericIndexOf!(ulong, long, ulong) | |
isAggregateType!long | |
enum bool isAggregateType = false; | |
OldAlias!long | |
alias OldAlias = long; | |
isSame!(ulong, long) | |
enum bool isSame = false; | |
expectType!long | |
genericIndexOf!(ulong, ulong) | |
isSame!(ulong, ulong) | |
enum bool isSame = true; | |
isNumeric!ulong | |
enum bool isNumeric = true; | |
mostNegative!ulong | |
enum byte mostNegative = cast(byte)0; | |
isNumeric!int | |
enum bool isNumeric = true; | |
mostNegative!int | |
enum int mostNegative = -2147483648; | |
unsafeOp!(ulong, int) | |
pure nothrow @nogc @safe bool unsafeOp(ulong a, int b) | |
{ | |
import std.traits : CommonType; | |
alias T = ulong; | |
return a < cast(ulong)b; | |
} | |
CommonType!(ulong, int) | |
alias CommonType = ulong; | |
CommonType!ulong | |
alias CommonType = ulong; | |
max!(ulong, ulong) | |
pure nothrow @nogc @safe ulong max(ulong _param_0, ulong _param_1) | |
{ | |
alias a = ulong _param_0; | |
; | |
alias T0 = ulong; | |
alias b = ulong _param_1; | |
; | |
alias T1 = ulong; | |
import std.algorithm.internal : algoFormat; | |
import std.functional : lessThan; | |
immutable immutable(bool) chooseB = safeOp(_param_0, _param_1); | |
return chooseB ? _param_1 : _param_0; | |
} | |
MaxType!(ulong, ulong) | |
alias MaxType = ulong; | |
safeOp!(ulong, ulong) | |
pure nothrow @nogc @safe bool safeOp(ref ulong a, ref ulong b) | |
{ | |
import std.traits : mostNegative; | |
immutable immutable(bool) result = a < b; | |
return result; | |
} | |
blockAttribute!(immutable(char)) | |
enum BlkAttr blockAttribute = BlkAttr.NO_SCAN; | |
hasIndirections!(immutable(char)) | |
enum bool hasIndirections = false; | |
isStaticArray!(immutable(char)) | |
enum bool isStaticArray = false; | |
isFunctionPointer!(immutable(char)) | |
enum bool isFunctionPointer = false; | |
isPointer!(immutable(char)) | |
enum bool isPointer = false; | |
isDelegate!(immutable(char)) | |
enum bool isDelegate = false; | |
isDynamicArray!(immutable(char)) | |
enum bool isDynamicArray = false; | |
isAssociativeArray!(immutable(char)) | |
enum bool isAssociativeArray = false; | |
emplaceRef!(char, char, char) | |
pure nothrow @nogc @safe void emplaceRef(ref char chunk, char _param_1) | |
{ | |
static struct S | |
{ | |
char payload; | |
pure nothrow @nogc @safe this(ref char _param_0) | |
{ | |
this.payload = _param_0; | |
return this; | |
} | |
} | |
if (__ctfe) | |
{ | |
chunk = _param_1; | |
} | |
else | |
{ | |
S* p = delegate () => cast(S*)&chunk(); | |
emplaceInitializer(*p); | |
(*p).this(_param_1); | |
} | |
} | |
RTInfo!(S) | |
enum typeof(null) RTInfo = null; | |
emplaceInitializer!(S) | |
pure nothrow @nogc @trusted void emplaceInitializer(ref S chunk) | |
{ | |
chunk = S('\xff'); | |
} | |
hasElaborateAssign!(S) | |
enum bool hasElaborateAssign = false; | |
isStaticArray!(S) | |
enum bool isStaticArray = false; | |
FieldTypeTuple!(S) | |
alias Fields = (char); | |
isNested!(S) | |
enum bool isNested = false; | |
anySatisfy!(hasElaborateAssign, char) | |
enum bool anySatisfy = false; | |
F!char | |
enum bool hasElaborateAssign = false; | |
isStaticArray!char | |
enum bool isStaticArray = false; | |
isAssignable!(S, S) | |
enum bool isAssignable = true; | |
isRvalueAssignable!(S, S) | |
enum bool isRvalueAssignable = true; | |
lvalueOf!(S) | |
@property ref S lvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
rvalueOf!(S) | |
@property S rvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
isLvalueAssignable!(S, S) | |
enum bool isLvalueAssignable = true; | |
enforceEx!(FormatException) | |
T enforceEx(T)(T value, lazy string msg = "", string file = __FILE__, size_t line = __LINE__) | |
{ | |
if (!value) | |
throw new E(msg, file, line); | |
return value; | |
} | |
enforceEx!bool | |
pure @safe bool enforceEx(bool value, lazy string msg = "", string file = __FILE__, ulong line = cast(ulong)__LINE__) | |
{ | |
if (!value) | |
throw new FormatException(msg(), file, line, null); | |
return value; | |
} | |
isSigned!ubyte | |
enum bool isSigned = false; | |
Unsigned!ubyte | |
alias Unsigned = ubyte; | |
ModifyTypePreservingTQ!(Impl, ubyte) | |
alias ModifyTypePreservingTQ = ubyte; | |
Modifier!ubyte | |
alias Impl = ubyte; | |
isUnsigned!ubyte | |
enum bool isUnsigned = true; | |
formatIntegral!(Appender!string, ulong, char) | |
pure nothrow @safe void formatIntegral(Appender!string w, const(ulong) val, ref const(FormatSpec!char) fs, uint base, ulong mask) | |
{ | |
ulong arg = val; | |
immutable immutable(bool) negative = base == 10u && arg < 0LU; | |
if (negative) | |
{ | |
arg = -arg; | |
} | |
formatUnsigned(w, arg & mask, fs, base, negative); | |
} | |
formatUnsigned!(Appender!string, ulong, char) | |
pure nothrow @safe void formatUnsigned(Appender!string w, ulong arg, ref const(FormatSpec!char) fs, uint base, bool negative) | |
{ | |
char[64] buffer = void; | |
scope char[] digits = null; | |
if (arg < cast(ulong)base && base <= 10u && arg) | |
{ | |
buffer[0] = cast(char)(arg + 48LU); | |
digits = buffer[0..1]; | |
} | |
else | |
{ | |
ulong i = 64LU; | |
for (; arg;) | |
{ | |
{ | |
i -= 1LU; | |
char c = cast(char)(arg % cast(ulong)base); | |
arg /= cast(ulong)base; | |
if (cast(int)c < 10) | |
buffer[i] = cast(char)(cast(int)c + 48); | |
else | |
buffer[i] = cast(char)(cast(int)c + (cast(int)fs.spec == 120 ? 87 : 55)); | |
} | |
} | |
digits = buffer[i..64]; | |
} | |
immutable immutable(int) precision = fs.precision == 2147483646 ? 1 : fs.precision; | |
char padChar = '\x00'; | |
if (!fs.flDash()) | |
{ | |
padChar = fs.flZero() && fs.precision == 2147483646 ? '0' : ' '; | |
} | |
char prefix1 = '\x00'; | |
char prefix2 = '\x00'; | |
if (base == 10u) | |
{ | |
if (negative) | |
prefix1 = '-'; | |
else if (fs.flPlus()) | |
prefix1 = '+'; | |
else if (fs.flSpace()) | |
prefix1 = ' '; | |
} | |
else if (base == 16u && fs.flHash() && digits.length) | |
{ | |
prefix1 = '0'; | |
prefix2 = cast(int)fs.spec == 120 ? 'x' : 'X'; | |
} | |
else if (base == 8u && fs.flHash() && (precision <= 1 || cast(ulong)precision <= digits.length) && digits.length > 0LU) | |
prefix1 = '0'; | |
ulong zerofill = cast(ulong)precision > digits.length ? cast(ulong)precision - digits.length : 0LU; | |
ulong leftpad = 0LU; | |
ulong rightpad = 0LU; | |
immutable immutable(long) spacesToPrint = cast(immutable(long))(cast(ulong)fs.width - (cast(ulong)(cast(int)(cast(int)prefix1 != 0) + cast(int)(cast(int)prefix2 != 0)) + zerofill + digits.length)); | |
if (spacesToPrint > 0L) | |
{ | |
if (cast(int)padChar == 48) | |
zerofill += cast(ulong)spacesToPrint; | |
else if (padChar) | |
leftpad = cast(ulong)spacesToPrint; | |
else | |
rightpad = cast(ulong)spacesToPrint; | |
} | |
{ | |
ulong __key2305 = 0LU; | |
ulong __limit2306 = leftpad; | |
for (; __key2305 < __limit2306; __key2305 += 1LU) | |
{ | |
ulong i = __key2305; | |
put(w, ' '); | |
} | |
} | |
if (prefix1) | |
put(w, prefix1); | |
if (prefix2) | |
put(w, prefix2); | |
{ | |
ulong __key2307 = 0LU; | |
ulong __limit2308 = zerofill; | |
for (; __key2307 < __limit2308; __key2307 += 1LU) | |
{ | |
ulong i = __key2307; | |
put(w, '0'); | |
} | |
} | |
put(w, digits); | |
{ | |
ulong __key2360 = 0LU; | |
ulong __limit2361 = rightpad; | |
for (; __key2360 < __limit2361; __key2360 += 1LU) | |
{ | |
ulong i = __key2360; | |
put(w, ' '); | |
} | |
} | |
} | |
put!(Appender!string, char) | |
pure nothrow @safe void put(ref Appender!string r, char e) | |
{ | |
doPut(r, e); | |
} | |
doPut!(Appender!string, char) | |
pure nothrow @safe void doPut(ref Appender!string r, ref char e) | |
{ | |
enum bool usingPut = true; | |
r.put(e); | |
} | |
canPutItem!char | |
enum bool canPutItem = true; | |
isImplicitlyConvertible!(char, immutable(char)) | |
enum bool isImplicitlyConvertible = true; | |
canPutConstRange!char | |
enum bool canPutConstRange = false; | |
canPutRange!char | |
enum bool canPutRange = false; | |
put!char | |
pure nothrow @safe void put(char item) | |
{ | |
assert(&this, "null this"); | |
import std.conv : emplaceRef; | |
this.ensureAddable(1LU); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
char[] bigData = delegate () => (cast(char*)(*this._data).arr)[0..len + 1LU](); | |
emplaceRef(bigData[len], item); | |
(*this._data).arr = bigData; | |
} | |
emplaceRef!(char, char, char) | |
pure nothrow @nogc @safe void emplaceRef(ref char chunk, ref char _param_1) | |
{ | |
static struct S | |
{ | |
char payload; | |
pure nothrow @nogc @safe this(ref char _param_0) | |
{ | |
this.payload = _param_0; | |
return this; | |
} | |
} | |
if (__ctfe) | |
{ | |
chunk = _param_1; | |
} | |
else | |
{ | |
S* p = delegate () => cast(S*)&chunk(); | |
emplaceInitializer(*p); | |
(*p).this(_param_1); | |
} | |
} | |
RTInfo!(S) | |
enum typeof(null) RTInfo = null; | |
emplaceInitializer!(S) | |
pure nothrow @nogc @trusted void emplaceInitializer(ref S chunk) | |
{ | |
chunk = S('\xff'); | |
} | |
hasElaborateAssign!(S) | |
enum bool hasElaborateAssign = false; | |
isStaticArray!(S) | |
enum bool isStaticArray = false; | |
FieldTypeTuple!(S) | |
alias Fields = (char); | |
isNested!(S) | |
enum bool isNested = false; | |
isAssignable!(S, S) | |
enum bool isAssignable = true; | |
isRvalueAssignable!(S, S) | |
enum bool isRvalueAssignable = true; | |
lvalueOf!(S) | |
@property ref S lvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
rvalueOf!(S) | |
@property S rvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
isLvalueAssignable!(S, S) | |
enum bool isLvalueAssignable = true; | |
put!(Appender!string, char[]) | |
pure nothrow @safe void put(ref Appender!string r, char[] e) | |
{ | |
doPut(r, e); | |
} | |
doPut!(Appender!string, char[]) | |
pure nothrow @safe void doPut(ref Appender!string r, ref char[] e) | |
{ | |
enum bool usingPut = true; | |
r.put(e); | |
} | |
canPutItem!(char[]) | |
enum bool canPutItem = false; | |
isImplicitlyConvertible!(char[], immutable(char)) | |
enum bool isImplicitlyConvertible = false; | |
isSomeChar!(char[]) | |
enum bool isSomeChar = false; | |
isAggregateType!(char[]) | |
enum bool isAggregateType = false; | |
OriginalType!(char[]) | |
alias OriginalType = char[]; | |
ModifyTypePreservingTQ!(Impl, char[]) | |
alias ModifyTypePreservingTQ = char[]; | |
Modifier!(char[]) | |
alias Impl = char[]; | |
Unqual!(char[]) | |
alias Unqual = char[]; | |
staticIndexOf!(char[], char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(char[], char, wchar, dchar) | |
OldAlias!(char[]) | |
alias OldAlias = char[]; | |
isSame!(char[], char) | |
enum bool isSame = false; | |
expectType!(char[]) | |
genericIndexOf!(char[], wchar, dchar) | |
isSame!(char[], wchar) | |
enum bool isSame = false; | |
genericIndexOf!(char[], dchar) | |
isSame!(char[], dchar) | |
enum bool isSame = false; | |
genericIndexOf!(char[]) | |
canPutConstRange!(char[]) | |
enum bool canPutConstRange = false; | |
isInputRange!(char[]) | |
enum bool isInputRange = true; | |
empty!char | |
pure nothrow @nogc @property @safe bool empty(const(char[]) a) | |
{ | |
return !a.length; | |
} | |
isNarrowString!(char[]) | |
enum bool isNarrowString = true; | |
isStaticArray!(char[]) | |
enum bool isStaticArray = false; | |
popFront!char | |
pure nothrow @nogc @trusted void popFront(ref char[] str) | |
{ | |
import std.algorithm.comparison : min; | |
assert(str.length, "Attempting to popFront() past the end of an array of char"); | |
static immutable __gshared immutable(ubyte[]) charWidthTab = [cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)5u, cast(ubyte)5u, cast(ubyte)5u, cast(ubyte)5u, cast(ubyte)6u, cast(ubyte)6u, cast(ubyte)1u, cast(ubyte)1u]; | |
immutable immutable(char) c = str[0]; | |
if (cast(int)c < 192) | |
{ | |
str = (cast(char*)str)[1..str.length]; | |
} | |
else | |
{ | |
str = (cast(char*)str)[cast(ulong)min(str.length, (cast(immutable(ubyte)*)charWidthTab)[cast(ulong)(cast(int)c - 192)])..str.length]; | |
} | |
} | |
min!(ulong, immutable(ubyte)) | |
pure nothrow @nogc @safe immutable(ubyte) min(ulong _param_0, immutable(ubyte) _param_1) | |
{ | |
alias a = ulong _param_0; | |
; | |
alias T0 = ulong; | |
alias b = immutable immutable(ubyte) _param_1; | |
; | |
alias T1 = immutable(ubyte); | |
import std.algorithm.internal : algoFormat; | |
import std.functional : lessThan; | |
immutable immutable(bool) chooseA = safeOp(_param_0, _param_1); | |
return chooseA ? cast(immutable(ubyte))_param_0 : cast(immutable(ubyte))cast(ulong)cast(int)_param_1; | |
} | |
MinType!(ulong, immutable(ubyte)) | |
alias MinType = immutable(ubyte); | |
isNumeric!(immutable(ubyte)) | |
enum bool isNumeric = true; | |
Unqual!(immutable(ubyte)) | |
alias Unqual = ubyte; | |
mostNegative!(immutable(ubyte)) | |
enum byte mostNegative = cast(byte)0; | |
safeOp!(ulong, immutable(ubyte)) | |
pure nothrow @nogc @safe bool safeOp(ref ulong a, ref immutable(ubyte) b) | |
{ | |
import std.traits : mostNegative; | |
immutable immutable(bool) result = a < cast(ulong)cast(int)b; | |
return result; | |
} | |
isIntegral!(immutable(ubyte)) | |
enum bool isIntegral = true; | |
IntegralTypeOf!(immutable(ubyte)) | |
alias IntegralTypeOf = immutable(ubyte); | |
isAggregateType!(immutable(ubyte)) | |
enum bool isAggregateType = false; | |
OriginalType!(immutable(ubyte)) | |
alias OriginalType = immutable(ubyte); | |
ModifyTypePreservingTQ!(Impl, immutable(ubyte)) | |
alias ModifyTypePreservingTQ = immutable immutable(ubyte); | |
Modifier!ubyte | |
alias Impl = ubyte; | |
front!char | |
pure @property @safe dchar front(char[] a) | |
{ | |
import std.utf : decode; | |
assert(a.length, "Attempting to fetch the front of an empty array of char"); | |
ulong i = 0LU; | |
return decode(a, i); | |
} | |
Flag!"useReplacementDchar" | |
enum Flag : bool | |
{ | |
Flag no = cast(Flag)false, | |
Flag yes = cast(Flag)true, | |
} | |
opDispatch!"useReplacementDchar" | |
enum Flag opDispatch = Flag.no; | |
isSomeString!(char[]) | |
enum bool isSomeString = true; | |
StringTypeOf!(char[]) | |
alias StringTypeOf = char[]; | |
decode!(Flag.no, char[]) | |
pure @trusted dchar decode(ref char[] str, ref ulong index) | |
in | |
{ | |
assert(index < str.length, "Attempted to decode past the end of a string"); | |
} | |
out(result) | |
{ | |
assert(isValidDchar(result)); | |
} | |
body | |
{ | |
{ | |
assert(index < str.length, "Attempted to decode past the end of a string"); | |
} | |
if (cast(int)str[index] < 128) | |
result = cast(dchar)str[index++]; | |
goto __returnLabel; | |
else | |
result = decodeImpl(str, index); | |
goto __returnLabel; | |
__returnLabel: | |
{ | |
assert(isValidDchar(result)); | |
} | |
return result; | |
} | |
ElementEncodingType!(char[]) | |
alias ElementEncodingType = char; | |
codeUnitLimit!(char[]) | |
enum char codeUnitLimit = '\x80'; | |
decodeImpl!(true, Flag.no, char[]) | |
pure @system dchar decodeImpl(ref char[] str, ref ulong index) | |
{ | |
alias bitMask = TList; | |
char* pstr = cast(char*)str + cast(long)index * 1L; | |
immutable immutable(ulong) length = str.length - index; | |
ubyte fst = cast(ubyte)pstr[0]; | |
static UTFException exception(S)(S str, string msg) | |
{ | |
uint[4] sequence = void; | |
size_t i; | |
do | |
{ | |
sequence[i] = str[i]; | |
} | |
while (++i < str.length && i < 4 && (str[i] & 192) == 128); | |
return (new UTFException(msg, i)).setSequence(sequence[0..i]); | |
} | |
pure nothrow @system UTFException invalidUTF() | |
{ | |
return exception(pstr[0..length], "Invalid UTF-8 sequence"); | |
} | |
pure nothrow @system UTFException outOfBounds() | |
{ | |
return exception(pstr[0..length], "Attempted to decode past the end of a string"); | |
} | |
if ((cast(int)fst & 192) != 192) | |
{ | |
throw invalidUTF(); | |
} | |
ubyte tmp = void; | |
dchar d = cast(dchar)fst; | |
cast(int)fst <<= 1; | |
unrolled { | |
{ | |
enum int i = 1; | |
if (1LU == length) | |
{ | |
throw outOfBounds(); | |
} | |
tmp = cast(ubyte)pstr[1]; | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
throw invalidUTF(); | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 2047u; | |
if ((cast(uint)d & 4294967168u) == 0u) | |
{ | |
throw invalidUTF(); | |
} | |
index += 2LU; | |
return d; | |
} | |
} | |
{ | |
enum int i = 2; | |
if (2LU == length) | |
{ | |
throw outOfBounds(); | |
} | |
tmp = cast(ubyte)pstr[2]; | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
throw invalidUTF(); | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 65535u; | |
if ((cast(uint)d & 4294965248u) == 0u) | |
{ | |
throw invalidUTF(); | |
} | |
if (!isValidDchar(d)) | |
{ | |
throw invalidUTF(); | |
} | |
index += 3LU; | |
return d; | |
} | |
} | |
{ | |
enum int i = 3; | |
if (3LU == length) | |
{ | |
throw outOfBounds(); | |
} | |
tmp = cast(ubyte)pstr[3]; | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
throw invalidUTF(); | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 2097151u; | |
if ((cast(uint)d & 4294901760u) == 0u) | |
{ | |
throw invalidUTF(); | |
} | |
index += 4LU; | |
if (cast(uint)d > 1114111u) | |
{ | |
throw invalidUTF(); | |
} | |
return d; | |
} | |
} | |
} | |
throw invalidUTF(); | |
} | |
AliasSeq!(127, 2047, 65535, 2097151) | |
TListexception!(char[]) | |
static pure nothrow @safe UTFException exception(char[] str, string msg) | |
{ | |
uint[4] sequence = void; | |
ulong i = 0LU; | |
do | |
{ | |
sequence[i] = cast(uint)str[i]; | |
} | |
while ((i += 1LU) < str.length && i < 4LU && (cast(int)str[i] & 192) == 128); | |
return (new UTFException(msg, i, "/usr/include/dmd/phobos/std/utf.d", 1385LU, null)).setSequence(sequence[0..i]); | |
} | |
AliasSeq!(1, 2, 3) | |
TListcanPutRange!(char[]) | |
enum bool canPutRange = true; | |
canPutItem!dchar | |
enum bool canPutItem = true; | |
isImplicitlyConvertible!(dchar, immutable(char)) | |
enum bool isImplicitlyConvertible = false; | |
isSomeChar!dchar | |
enum bool isSomeChar = true; | |
CharTypeOf!dchar | |
alias CharTypeOf = dchar; | |
OriginalType!dchar | |
alias OriginalType = dchar; | |
ModifyTypePreservingTQ!(Impl, dchar) | |
alias ModifyTypePreservingTQ = dchar; | |
Modifier!dchar | |
alias Impl = dchar; | |
Unqual!dchar | |
alias Unqual = dchar; | |
staticIndexOf!(dchar, char, wchar, dchar) | |
enum int staticIndexOf = 2; | |
genericIndexOf!(dchar, char, wchar, dchar) | |
isSame!(dchar, char) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, wchar, dchar) | |
isSame!(dchar, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, dchar) | |
isSame!(dchar, dchar) | |
enum bool isSame = true; | |
canPutConstRange!dchar | |
enum bool canPutConstRange = false; | |
isInputRange!dchar | |
enum bool isInputRange = false; | |
canPutRange!dchar | |
enum bool canPutRange = false; | |
put!dchar | |
pure @safe void put(dchar item) | |
{ | |
assert(&this, "null this"); | |
import std.utf : encode; | |
char[4] encoded = '\xff'; | |
ulong len = encode(encoded, item); | |
this.put(encoded[0..len]); | |
} | |
encode!cast(Flag)false | |
pure @safe ulong encode(ref char[4] buf, dchar c) | |
{ | |
if (cast(uint)c <= 127u) | |
{ | |
assert(isValidDchar(c)); | |
buf[0] = cast(char)c; | |
return 1LU; | |
} | |
if (cast(uint)c <= 2047u) | |
{ | |
assert(isValidDchar(c)); | |
buf[0] = cast(char)(192u | cast(uint)c >> 6); | |
buf[1] = cast(char)(128u | cast(uint)c & 63u); | |
return 2LU; | |
} | |
if (cast(uint)c <= 65535u) | |
{ | |
if (55296u <= cast(uint)c && cast(uint)c <= 57343u) | |
c = _utfException("Encoding a surrogate code point in UTF-8", c); | |
assert(isValidDchar(c)); | |
L3: | |
buf[0] = cast(char)(224u | cast(uint)c >> 12); | |
buf[1] = cast(char)(128u | cast(uint)c >> 6 & 63u); | |
buf[2] = cast(char)(128u | cast(uint)c & 63u); | |
return 3LU; | |
} | |
if (cast(uint)c <= 1114111u) | |
{ | |
assert(isValidDchar(c)); | |
buf[0] = cast(char)(240u | cast(uint)c >> 18); | |
buf[1] = cast(char)(128u | cast(uint)c >> 12 & 63u); | |
buf[2] = cast(char)(128u | cast(uint)c >> 6 & 63u); | |
buf[3] = cast(char)(128u | cast(uint)c & 63u); | |
return 4LU; | |
} | |
assert(!isValidDchar(c)); | |
c = _utfException("Encoding an invalid code point in UTF-8", c); | |
goto L3; | |
} | |
_utfException!cast(Flag)false | |
pure @safe dchar _utfException(string msg, dchar c) | |
{ | |
throw (new UTFException(msg, "/usr/include/dmd/phobos/std/utf.d", 2134LU, null)).setSequence([cast(uint)c][]); | |
} | |
put!(char[]) | |
pure nothrow @safe void put(char[] items) | |
{ | |
assert(&this, "null this"); | |
auto pure nothrow @trusted char[] bigDataFun(ulong extra) | |
{ | |
this.ensureAddable(extra); | |
return (cast(char*)(*this._data).arr)[0..(*this._data).arr.length + extra]; | |
} | |
char[] bigData = bigDataFun(items.length); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) newlen = bigData.length; | |
alias UT = char; | |
bigData[len..newlen] = items[]; | |
(*this._data).arr = bigData; | |
} | |
ElementType!(char[]) | |
alias ElementType = dchar; | |
isAssignable!(char, char) | |
enum bool isAssignable = true; | |
isRvalueAssignable!(char, char) | |
enum bool isRvalueAssignable = true; | |
lvalueOf!char | |
@property ref char lvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
rvalueOf!char | |
@property char rvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
isLvalueAssignable!(char, char) | |
enum bool isLvalueAssignable = true; | |
__lambda6!ubyte | |
function (return ref ubyte arg) => cast(const(void*))&argwriteUpToNextSpec!(Appender!string) | |
pure @safe bool writeUpToNextSpec(Appender!string writer) | |
{ | |
assert(&this, "null this"); | |
if (empty(this.trailing)) | |
return false; | |
{ | |
ulong i = 0LU; | |
for (; i < this.trailing.length; i += 1LU) | |
{ | |
{ | |
if (cast(int)this.trailing[i] != 37) | |
continue; | |
put(writer, this.trailing[0..i]); | |
this.trailing = this.trailing[i..__dollar]; | |
enforceEx(this.trailing.length >= 2LU, delegate string() => "Unterminated format specifier: \"%\"", "/usr/include/dmd/phobos/std/format.d", 1103LU); | |
this.trailing = this.trailing[1..__dollar]; | |
if (cast(int)this.trailing[0] != 37) | |
{ | |
this.fillUp(); | |
return true; | |
} | |
i = 0LU; | |
} | |
} | |
} | |
put(writer, this.trailing); | |
this.trailing = null; | |
return false; | |
} | |
put!(Appender!string, const(char)[]) | |
pure nothrow @safe void put(ref Appender!string r, const(char)[] e) | |
{ | |
doPut(r, e); | |
} | |
doPut!(Appender!string, const(char)[]) | |
pure nothrow @safe void doPut(ref Appender!string r, ref const(char)[] e) | |
{ | |
enum bool usingPut = true; | |
r.put(e); | |
} | |
canPutItem!(const(char)[]) | |
enum bool canPutItem = false; | |
isImplicitlyConvertible!(const(char)[], immutable(char)) | |
enum bool isImplicitlyConvertible = false; | |
isSomeChar!(const(char)[]) | |
enum bool isSomeChar = false; | |
isAggregateType!(const(char)[]) | |
enum bool isAggregateType = false; | |
OriginalType!(const(char)[]) | |
alias OriginalType = const(char)[]; | |
ModifyTypePreservingTQ!(Impl, const(char)[]) | |
alias ModifyTypePreservingTQ = const(char)[]; | |
Modifier!(const(char)[]) | |
alias Impl = const(char)[]; | |
Unqual!(const(char)[]) | |
alias Unqual = const(char)[]; | |
staticIndexOf!(const(char)[], char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(const(char)[], char, wchar, dchar) | |
OldAlias!(const(char)[]) | |
alias OldAlias = const(char)[]; | |
isSame!(const(char)[], char) | |
enum bool isSame = false; | |
expectType!(const(char)[]) | |
genericIndexOf!(const(char)[], wchar, dchar) | |
isSame!(const(char)[], wchar) | |
enum bool isSame = false; | |
genericIndexOf!(const(char)[], dchar) | |
isSame!(const(char)[], dchar) | |
enum bool isSame = false; | |
genericIndexOf!(const(char)[]) | |
canPutConstRange!(const(char)[]) | |
enum bool canPutConstRange = false; | |
isInputRange!(const(char)[]) | |
enum bool isInputRange = true; | |
isNarrowString!(const(char)[]) | |
enum bool isNarrowString = true; | |
isStaticArray!(const(char)[]) | |
enum bool isStaticArray = false; | |
popFront!(const(char)) | |
pure nothrow @nogc @trusted void popFront(ref const(char)[] str) | |
{ | |
import std.algorithm.comparison : min; | |
assert(str.length, "Attempting to popFront() past the end of an array of const(char)"); | |
static immutable __gshared immutable(ubyte[]) charWidthTab = [cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)5u, cast(ubyte)5u, cast(ubyte)5u, cast(ubyte)5u, cast(ubyte)6u, cast(ubyte)6u, cast(ubyte)1u, cast(ubyte)1u]; | |
immutable immutable(char) c = str[0]; | |
if (cast(int)c < 192) | |
{ | |
str = (cast(const(char)*)str)[1..str.length]; | |
} | |
else | |
{ | |
str = (cast(const(char)*)str)[cast(ulong)min(str.length, (cast(immutable(ubyte)*)charWidthTab)[cast(ulong)(cast(int)c - 192)])..str.length]; | |
} | |
} | |
front!(const(char)) | |
pure @property @safe dchar front(const(char)[] a) | |
{ | |
import std.utf : decode; | |
assert(a.length, "Attempting to fetch the front of an empty array of const(char)"); | |
ulong i = 0LU; | |
return decode(a, i); | |
} | |
isSomeString!(const(char)[]) | |
enum bool isSomeString = true; | |
StringTypeOf!(const(char)[]) | |
alias StringTypeOf = const(char)[]; | |
decode!(Flag.no, const(char)[]) | |
pure @trusted dchar decode(ref const(char)[] str, ref ulong index) | |
in | |
{ | |
assert(index < str.length, "Attempted to decode past the end of a string"); | |
} | |
out(result) | |
{ | |
assert(isValidDchar(result)); | |
} | |
body | |
{ | |
{ | |
assert(index < str.length, "Attempted to decode past the end of a string"); | |
} | |
if (cast(int)str[index] < 128) | |
result = cast(dchar)str[index++]; | |
goto __returnLabel; | |
else | |
result = decodeImpl(str, index); | |
goto __returnLabel; | |
__returnLabel: | |
{ | |
assert(isValidDchar(result)); | |
} | |
return result; | |
} | |
ElementEncodingType!(const(char)[]) | |
alias ElementEncodingType = const(char); | |
codeUnitLimit!(const(char)[]) | |
enum char codeUnitLimit = '\x80'; | |
decodeImpl!(true, Flag.no, const(char)[]) | |
pure @system dchar decodeImpl(ref const(char)[] str, ref ulong index) | |
{ | |
alias bitMask = TList; | |
const(char)* pstr = cast(const(char)*)str + cast(long)index * 1L; | |
immutable immutable(ulong) length = str.length - index; | |
ubyte fst = cast(ubyte)pstr[0]; | |
static UTFException exception(S)(S str, string msg) | |
{ | |
uint[4] sequence = void; | |
size_t i; | |
do | |
{ | |
sequence[i] = str[i]; | |
} | |
while (++i < str.length && i < 4 && (str[i] & 192) == 128); | |
return (new UTFException(msg, i)).setSequence(sequence[0..i]); | |
} | |
pure nothrow @system UTFException invalidUTF() | |
{ | |
return exception(pstr[0..length], "Invalid UTF-8 sequence"); | |
} | |
pure nothrow @system UTFException outOfBounds() | |
{ | |
return exception(pstr[0..length], "Attempted to decode past the end of a string"); | |
} | |
if ((cast(int)fst & 192) != 192) | |
{ | |
throw invalidUTF(); | |
} | |
ubyte tmp = void; | |
dchar d = cast(dchar)fst; | |
cast(int)fst <<= 1; | |
unrolled { | |
{ | |
enum int i = 1; | |
if (1LU == length) | |
{ | |
throw outOfBounds(); | |
} | |
tmp = cast(ubyte)pstr[1]; | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
throw invalidUTF(); | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 2047u; | |
if ((cast(uint)d & 4294967168u) == 0u) | |
{ | |
throw invalidUTF(); | |
} | |
index += 2LU; | |
return d; | |
} | |
} | |
{ | |
enum int i = 2; | |
if (2LU == length) | |
{ | |
throw outOfBounds(); | |
} | |
tmp = cast(ubyte)pstr[2]; | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
throw invalidUTF(); | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 65535u; | |
if ((cast(uint)d & 4294965248u) == 0u) | |
{ | |
throw invalidUTF(); | |
} | |
if (!isValidDchar(d)) | |
{ | |
throw invalidUTF(); | |
} | |
index += 3LU; | |
return d; | |
} | |
} | |
{ | |
enum int i = 3; | |
if (3LU == length) | |
{ | |
throw outOfBounds(); | |
} | |
tmp = cast(ubyte)pstr[3]; | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
throw invalidUTF(); | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 2097151u; | |
if ((cast(uint)d & 4294901760u) == 0u) | |
{ | |
throw invalidUTF(); | |
} | |
index += 4LU; | |
if (cast(uint)d > 1114111u) | |
{ | |
throw invalidUTF(); | |
} | |
return d; | |
} | |
} | |
} | |
throw invalidUTF(); | |
} | |
exception!(const(char)[]) | |
static pure nothrow @safe UTFException exception(const(char)[] str, string msg) | |
{ | |
uint[4] sequence = void; | |
ulong i = 0LU; | |
do | |
{ | |
sequence[i] = cast(uint)str[i]; | |
} | |
while ((i += 1LU) < str.length && i < 4LU && (cast(int)str[i] & 192) == 128); | |
return (new UTFException(msg, i, "/usr/include/dmd/phobos/std/utf.d", 1385LU, null)).setSequence(sequence[0..i]); | |
} | |
canPutRange!(const(char)[]) | |
enum bool canPutRange = true; | |
put!(const(char)[]) | |
pure nothrow @safe void put(const(char)[] items) | |
{ | |
assert(&this, "null this"); | |
auto pure nothrow @trusted char[] bigDataFun(ulong extra) | |
{ | |
this.ensureAddable(extra); | |
return (cast(char*)(*this._data).arr)[0..(*this._data).arr.length + extra]; | |
} | |
char[] bigData = bigDataFun(items.length); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) newlen = bigData.length; | |
alias UT = char; | |
bigData[len..newlen] = items[]; | |
(*this._data).arr = bigData; | |
} | |
ElementType!(const(char)[]) | |
alias ElementType = dchar; | |
isAssignable!(char, const(char)) | |
enum bool isAssignable = true; | |
isRvalueAssignable!(char, const(char)) | |
enum bool isRvalueAssignable = true; | |
rvalueOf!(const(char)) | |
@property const(char) rvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
isLvalueAssignable!(char, const(char)) | |
enum bool isLvalueAssignable = true; | |
lvalueOf!(const(char)) | |
@property ref const(char) lvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
text!(string, const(char)[]) | |
pure nothrow @safe string text(string _param_0, const(char)[] _param_1) | |
{ | |
return textImpl(_param_0, _param_1); | |
} | |
textImpl!(string, string, const(char)[]) | |
pure nothrow @safe string textImpl(string _param_0, const(char)[] _param_1) | |
{ | |
import std.array : appender; | |
Appender!string app = appender(); | |
app.reserve(40LU); | |
unrolled { | |
{ | |
string arg = _param_0; | |
app.put(to(arg)); | |
} | |
{ | |
const(char)[] arg = _param_1; | |
app.put(to(arg)); | |
} | |
} | |
return app.data(); | |
} | |
to!string | |
T to(A...)(A args) if (A.length > 0) | |
{ | |
return toImpl!T | |
(args); | |
} | |
isStaticArray!string | |
enum bool isStaticArray = false; | |
to!string | |
pure nothrow @nogc @safe string to(string _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(string, string) | |
enum bool isImplicitlyConvertible = true; | |
isEnumStrToStr!(string, string) | |
enum bool isEnumStrToStr = false; | |
isExactSomeString!string | |
enum bool isExactSomeString = true; | |
isSomeString!string | |
enum bool isSomeString = true; | |
isNullToStr!(string, string) | |
enum bool isNullToStr = false; | |
isAssociativeArray!string | |
enum bool isAssociativeArray = false; | |
isInputRange!string | |
enum bool isInputRange = true; | |
isNarrowString!string | |
enum bool isNarrowString = true; | |
popFront!(immutable(char)) | |
pure nothrow @nogc @trusted void popFront(ref string str) | |
{ | |
import std.algorithm.comparison : min; | |
assert(str.length, "Attempting to popFront() past the end of an array of immutable(char)"); | |
static immutable __gshared immutable(ubyte[]) charWidthTab = [cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)2u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)3u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)4u, cast(ubyte)5u, cast(ubyte)5u, cast(ubyte)5u, cast(ubyte)5u, cast(ubyte)6u, cast(ubyte)6u, cast(ubyte)1u, cast(ubyte)1u]; | |
immutable immutable(char) c = str[0]; | |
if (cast(int)c < 192) | |
{ | |
str = (cast(immutable(char)*)str)[1..str.length]; | |
} | |
else | |
{ | |
str = (cast(immutable(char)*)str)[cast(ulong)min(str.length, (cast(immutable(ubyte)*)charWidthTab)[cast(ulong)(cast(int)c - 192)])..str.length]; | |
} | |
} | |
front!(immutable(char)) | |
pure @property @safe dchar front(string a) | |
{ | |
import std.utf : decode; | |
assert(a.length, "Attempting to fetch the front of an empty array of immutable(char)"); | |
ulong i = 0LU; | |
return decode(a, i); | |
} | |
decode!(Flag.no, string) | |
pure @trusted dchar decode(ref string str, ref ulong index) | |
in | |
{ | |
assert(index < str.length, "Attempted to decode past the end of a string"); | |
} | |
out(result) | |
{ | |
assert(isValidDchar(result)); | |
} | |
body | |
{ | |
{ | |
assert(index < str.length, "Attempted to decode past the end of a string"); | |
} | |
if (cast(int)str[index] < 128) | |
result = cast(dchar)str[index++]; | |
goto __returnLabel; | |
else | |
result = decodeImpl(str, index); | |
goto __returnLabel; | |
__returnLabel: | |
{ | |
assert(isValidDchar(result)); | |
} | |
return result; | |
} | |
codeUnitLimit!string | |
enum char codeUnitLimit = '\x80'; | |
decodeImpl!(true, Flag.no, string) | |
pure @system dchar decodeImpl(ref string str, ref ulong index) | |
{ | |
alias bitMask = TList; | |
immutable(char)* pstr = cast(immutable(char)*)str + cast(long)index * 1L; | |
immutable immutable(ulong) length = str.length - index; | |
ubyte fst = cast(ubyte)pstr[0]; | |
static UTFException exception(S)(S str, string msg) | |
{ | |
uint[4] sequence = void; | |
size_t i; | |
do | |
{ | |
sequence[i] = str[i]; | |
} | |
while (++i < str.length && i < 4 && (str[i] & 192) == 128); | |
return (new UTFException(msg, i)).setSequence(sequence[0..i]); | |
} | |
pure nothrow @system UTFException invalidUTF() | |
{ | |
return exception(pstr[0..length], "Invalid UTF-8 sequence"); | |
} | |
pure nothrow @system UTFException outOfBounds() | |
{ | |
return exception(pstr[0..length], "Attempted to decode past the end of a string"); | |
} | |
if ((cast(int)fst & 192) != 192) | |
{ | |
throw invalidUTF(); | |
} | |
ubyte tmp = void; | |
dchar d = cast(dchar)fst; | |
cast(int)fst <<= 1; | |
unrolled { | |
{ | |
enum int i = 1; | |
if (1LU == length) | |
{ | |
throw outOfBounds(); | |
} | |
tmp = cast(ubyte)pstr[1]; | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
throw invalidUTF(); | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 2047u; | |
if ((cast(uint)d & 4294967168u) == 0u) | |
{ | |
throw invalidUTF(); | |
} | |
index += 2LU; | |
return d; | |
} | |
} | |
{ | |
enum int i = 2; | |
if (2LU == length) | |
{ | |
throw outOfBounds(); | |
} | |
tmp = cast(ubyte)pstr[2]; | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
throw invalidUTF(); | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 65535u; | |
if ((cast(uint)d & 4294965248u) == 0u) | |
{ | |
throw invalidUTF(); | |
} | |
if (!isValidDchar(d)) | |
{ | |
throw invalidUTF(); | |
} | |
index += 3LU; | |
return d; | |
} | |
} | |
{ | |
enum int i = 3; | |
if (3LU == length) | |
{ | |
throw outOfBounds(); | |
} | |
tmp = cast(ubyte)pstr[3]; | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
throw invalidUTF(); | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 2097151u; | |
if ((cast(uint)d & 4294901760u) == 0u) | |
{ | |
throw invalidUTF(); | |
} | |
index += 4LU; | |
if (cast(uint)d > 1114111u) | |
{ | |
throw invalidUTF(); | |
} | |
return d; | |
} | |
} | |
} | |
throw invalidUTF(); | |
} | |
exception!string | |
static pure nothrow @safe UTFException exception(string str, string msg) | |
{ | |
uint[4] sequence = void; | |
ulong i = 0LU; | |
do | |
{ | |
sequence[i] = cast(uint)str[i]; | |
} | |
while ((i += 1LU) < str.length && i < 4LU && (cast(int)str[i] & 192) == 128); | |
return (new UTFException(msg, i, "/usr/include/dmd/phobos/std/utf.d", 1385LU, null)).setSequence(sequence[0..i]); | |
} | |
toImpl!(string, string) | |
pure nothrow @nogc @safe string toImpl(string value) | |
{ | |
enum isSignedInt(T) = isIntegral!T | |
&& isSigned!T | |
; | |
alias isUnsignedInt = enum bool isUnsigned(T) = __traits(isUnsigned, T) && !(is(Unqual!T | |
== char) || is(Unqual!T | |
== wchar) || is(Unqual!T | |
== dchar) || is(Unqual!T | |
== bool)); | |
; | |
return value; | |
} | |
isUnsignedInt!string | |
enum bool isUnsigned = false; | |
isSignedInt!string | |
enum bool isSignedInt = false; | |
isIntegral!string | |
enum bool isIntegral = false; | |
staticIndexOf!(string, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(string, byte, ubyte, short, ushort, int, uint, long, ulong) | |
OldAlias!string | |
alias OldAlias = string; | |
isSame!(string, byte) | |
enum bool isSame = false; | |
expectType!string | |
genericIndexOf!(string, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(string, ubyte) | |
enum bool isSame = false; | |
genericIndexOf!(string, short, ushort, int, uint, long, ulong) | |
isSame!(string, short) | |
enum bool isSame = false; | |
genericIndexOf!(string, ushort, int, uint, long, ulong) | |
isSame!(string, ushort) | |
enum bool isSame = false; | |
genericIndexOf!(string, int, uint, long, ulong) | |
isSame!(string, int) | |
enum bool isSame = false; | |
genericIndexOf!(string, uint, long, ulong) | |
isSame!(string, uint) | |
enum bool isSame = false; | |
genericIndexOf!(string, long, ulong) | |
isSame!(string, long) | |
enum bool isSame = false; | |
genericIndexOf!(string, ulong) | |
isSame!(string, ulong) | |
enum bool isSame = false; | |
genericIndexOf!string | |
isSigned!string | |
enum bool isSigned = false; | |
canPutItem!string | |
enum bool canPutItem = false; | |
isImplicitlyConvertible!(string, immutable(char)) | |
enum bool isImplicitlyConvertible = false; | |
isSomeChar!string | |
enum bool isSomeChar = false; | |
staticIndexOf!(string, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(string, char, wchar, dchar) | |
isSame!(string, char) | |
enum bool isSame = false; | |
genericIndexOf!(string, wchar, dchar) | |
isSame!(string, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(string, dchar) | |
isSame!(string, dchar) | |
enum bool isSame = false; | |
canPutConstRange!string | |
enum bool canPutConstRange = false; | |
canPutRange!string | |
enum bool canPutRange = true; | |
put!string | |
pure nothrow @safe void put(string items) | |
{ | |
assert(&this, "null this"); | |
auto pure nothrow @trusted char[] bigDataFun(ulong extra) | |
{ | |
this.ensureAddable(extra); | |
return (cast(char*)(*this._data).arr)[0..(*this._data).arr.length + extra]; | |
} | |
char[] bigData = bigDataFun(items.length); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) newlen = bigData.length; | |
alias UT = char; | |
bigData[len..newlen] = items[]; | |
(*this._data).arr = bigData; | |
} | |
ElementType!string | |
alias ElementType = dchar; | |
isAssignable!(char, immutable(char)) | |
enum bool isAssignable = true; | |
isRvalueAssignable!(char, immutable(char)) | |
enum bool isRvalueAssignable = true; | |
rvalueOf!(immutable(char)) | |
@property immutable(char) rvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
isLvalueAssignable!(char, immutable(char)) | |
enum bool isLvalueAssignable = true; | |
lvalueOf!(immutable(char)) | |
@property ref immutable(char) lvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
to!(const(char)[]) | |
pure nothrow @safe string to(const(char)[] _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(const(char)[], string) | |
enum bool isImplicitlyConvertible = false; | |
isInfinite!(const(char)[]) | |
enum bool isInfinite = false; | |
isNumeric!(const(char)[]) | |
enum bool isNumeric = false; | |
isBoolean!(const(char)[]) | |
enum bool isBoolean = false; | |
isAssociativeArray!(const(char)[]) | |
enum bool isAssociativeArray = false; | |
toImpl!(string, const(char)[]) | |
pure nothrow @safe string toImpl(const(char)[] value) | |
{ | |
return idup(value); | |
} | |
isExactSomeString!(const(char)[]) | |
enum bool isExactSomeString = true; | |
idup!(const(char)) | |
pure nothrow @property @safe string idup(const(char)[] a) | |
{ | |
return _trustedDup(a); | |
} | |
_trustedDup!(const(char), immutable(char)) | |
pure nothrow @trusted string _trustedDup(const(char)[] a) | |
{ | |
return _dup(a); | |
} | |
_dup!(const(char), immutable(char)) | |
pure nothrow @system string _dup(const(char)[] a) | |
{ | |
if (__ctfe) | |
{ | |
string res = null; | |
{ | |
const(char)[] __r2367 = a[]; | |
ulong __key2368 = 0LU; | |
for (; __key2368 < __r2367.length; __key2368 += 1LU) | |
{ | |
const ref const(char) e = __r2367[__key2368]; | |
res ~= e; | |
} | |
} | |
return res; | |
} | |
import core.stdc.string : memcpy; | |
void[] arr = _d_newarrayU(typeid(const(char)[]), a.length); | |
memcpy(cast(void*)arr, cast(const(void)*)cast(const(char)*)a, 1LU * a.length); | |
string res = *& arr; | |
_doPostblit(res); | |
return res; | |
} | |
_doPostblit!(immutable(char)) | |
pure nothrow @nogc @safe void _doPostblit(string arr) | |
{ | |
if (auto postblit = (void delegate(ref immutable(char) t) pure nothrow @nogc @safe postblit = _getPostblit();) , postblit) | |
{ | |
{ | |
string __r2369 = arr[]; | |
ulong __key2370 = 0LU; | |
for (; __key2370 < __r2369.length; __key2370 += 1LU) | |
{ | |
immutable ref immutable(char) elem = __r2369[__key2370]; | |
postblit(elem); | |
} | |
} | |
} | |
} | |
_getPostblit!(immutable(char)) | |
auto pure nothrow @nogc @trusted void delegate(ref immutable(char) t) pure nothrow @nogc @safe _getPostblit() | |
{ | |
if ((&typeid(immutable(char)).postblit).funcptr !is & postblit) | |
{ | |
alias _PostBlitType = void delegate(ref immutable(char) t) pure nothrow @nogc @safe; | |
return cast(void delegate(ref immutable(char) t) pure nothrow @nogc @safe)&typeid(immutable(char)).postblit; | |
} | |
else | |
return cast(void delegate(ref immutable(char) t) pure nothrow @nogc @safe)null; | |
} | |
static __gshared TypeInfo_Invariant _D11TypeInfo_ya6__initZ; | |
staticIndexOf!(int, dchar, char) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(int, dchar, char) | |
genericIndexOf!(int, char) | |
isDynamicArray!int | |
enum bool isDynamicArray = false; | |
isAssociativeArray!int | |
enum bool isAssociativeArray = false; | |
parse!(int, const(char)[]) | |
pure @safe int parse(ref const(char)[] s) | |
{ | |
bool sign = false; | |
enum char maxLastDigit = '\x07'; | |
uint c = 0u; | |
import std.string : representation; | |
const(ubyte)[] source = representation(s); | |
if (empty(source)) | |
goto Lerr; | |
c = cast(uint)front(source); | |
switch (c) | |
{ | |
case 45u: | |
{ | |
sign = true; | |
goto case 43u; | |
} | |
case 43u: | |
{ | |
popFront(source); | |
if (empty(source)) | |
goto Lerr; | |
c = cast(uint)front(source); | |
break; | |
} | |
default: | |
{ | |
break; | |
} | |
} | |
c -= 48u; | |
if (c <= 9u) | |
{ | |
int v = cast(int)c; | |
popFront(source); | |
for (; !empty(source);) | |
{ | |
{ | |
c = cast(uint)(cast(int)front(source) - 48); | |
if (c > 9u) | |
break; | |
if (v >= 0 && (v < 214748364 || v == 214748364 && c <= cast(uint)(7 + cast(int)sign))) | |
{ | |
v = cast(int)(cast(uint)(v * 10) + c); | |
popFront(source); | |
} | |
else | |
throw new ConvOverflowException("Overflow in integral conversion", "/usr/include/dmd/phobos/std/conv.d", 2098LU); | |
} | |
} | |
if (sign) | |
v = -v; | |
s = cast(const(char)[])source; | |
return v; | |
} | |
Lerr: | |
throw convError(cast(const(char)[])source, "/usr/include/dmd/phobos/std/conv.d", 2111LU); | |
} | |
representation!(const(char)) | |
auto pure nothrow @nogc @safe const(ubyte)[] representation(const(char)[] s) | |
{ | |
import std.traits : ModifyTypePreservingTQ; | |
template ToRepType(T) | |
{ | |
alias ToRepType = AliasSeq!(ubyte, ushort, uint) | |
[T.sizeof / 2]; | |
} | |
return cast(const(ubyte)[])s; | |
} | |
ModifyTypePreservingTQ!(ToRepType, const(char)) | |
alias ModifyTypePreservingTQ = const const(ubyte); | |
Modifier!char | |
alias ToRepType = ubyte; | |
AliasSeq!(ubyte, ushort, uint) | |
alias AliasSeq = (ubyte, ushort, uint); | |
empty!ubyte | |
pure nothrow @nogc @property @safe bool empty(const(ubyte[]) a) | |
{ | |
return !a.length; | |
} | |
isNarrowString!(const(ubyte)[]) | |
enum bool isNarrowString = false; | |
isAggregateType!(const(ubyte)[]) | |
enum bool isAggregateType = false; | |
isStaticArray!(const(ubyte)[]) | |
enum bool isStaticArray = false; | |
front!(const(ubyte)) | |
pure nothrow @nogc @property ref @safe const(ubyte) front(const(ubyte)[] a) | |
{ | |
assert(a.length, "Attempting to fetch the front of an empty array of const(ubyte)"); | |
return a[0]; | |
} | |
popFront!(const(ubyte)) | |
pure nothrow @nogc @safe void popFront(ref const(ubyte)[] a) | |
{ | |
assert(a.length, "Attempting to popFront() past the end of an array of const(ubyte)"); | |
a = a[1..__dollar]; | |
} | |
convError!(const(char)[], int) | |
auto pure @safe ConvException convError(const(char)[] source, string fn = __FILE__, ulong ln = cast(ulong)__LINE__) | |
{ | |
return new ConvException(text("Unexpected ", convError_unexpected(source), " when converting from type const(char)[] to type int"), fn, ln, null); | |
} | |
convError_unexpected!(const(char)[]) | |
pure @safe string convError_unexpected(const(char)[] source) | |
{ | |
return empty(source) ? "end of input" : text("'", front(source), "'"); | |
} | |
text!(string, dchar, string) | |
pure @safe string text(string _param_0, dchar _param_1, string _param_2) | |
{ | |
return textImpl(_param_0, _param_1, _param_2); | |
} | |
textImpl!(string, string, dchar, string) | |
pure @safe string textImpl(string _param_0, dchar _param_1, string _param_2) | |
{ | |
import std.array : appender; | |
Appender!string app = appender(); | |
app.reserve(60LU); | |
unrolled { | |
{ | |
string arg = _param_0; | |
app.put(to(arg)); | |
} | |
{ | |
dchar arg = _param_1; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_2; | |
app.put(to(arg)); | |
} | |
} | |
return app.data(); | |
} | |
isStaticArray!dchar | |
enum bool isStaticArray = false; | |
to!dchar | |
pure @safe string to(dchar _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(dchar, string) | |
enum bool isImplicitlyConvertible = false; | |
isInfinite!dchar | |
enum bool isInfinite = false; | |
isNumeric!dchar | |
enum bool isNumeric = false; | |
isNumeric!string | |
enum bool isNumeric = false; | |
isBoolean!string | |
enum bool isBoolean = false; | |
isSomeString!dchar | |
enum bool isSomeString = false; | |
isDynamicArray!dchar | |
enum bool isDynamicArray = false; | |
isAssociativeArray!dchar | |
enum bool isAssociativeArray = false; | |
toImpl!(string, dchar) | |
pure @safe string toImpl(dchar value) | |
{ | |
return toStr(value); | |
} | |
isExactSomeString!dchar | |
enum bool isExactSomeString = false; | |
isIntegral!dchar | |
enum bool isIntegral = false; | |
staticIndexOf!(dchar, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(dchar, byte, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(dchar, byte) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(dchar, ubyte) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, short, ushort, int, uint, long, ulong) | |
isSame!(dchar, short) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, ushort, int, uint, long, ulong) | |
isSame!(dchar, ushort) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, int, uint, long, ulong) | |
isSame!(dchar, int) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, uint, long, ulong) | |
isSame!(dchar, uint) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, long, ulong) | |
isSame!(dchar, long) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, ulong) | |
isSame!(dchar, ulong) | |
enum bool isSame = false; | |
genericIndexOf!dchar | |
isPointer!dchar | |
enum bool isPointer = false; | |
toStr!(string, dchar) | |
pure @safe string toStr(dchar src) | |
{ | |
import std.format : FormatSpec, formatValue; | |
import std.array : appender; | |
Appender!string w = appender(); | |
FormatSpec!char f = FormatSpec; | |
formatValue(w, src, f); | |
return w.data(); | |
} | |
FormatSpec!(immutable(char)) | |
alias FormatSpec = FormatSpec!char; | |
staticIndexOf!(dchar, float, double, real) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(dchar, float, double, real) | |
isSame!(dchar, float) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, double, real) | |
isSame!(dchar, double) | |
enum bool isSame = false; | |
genericIndexOf!(dchar, real) | |
isSame!(dchar, real) | |
enum bool isSame = false; | |
hasToString!(dchar, char) | |
enum int hasToString = 0; | |
isDelegate!dchar | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, dchar, char) | |
pure @safe void formatValue(Appender!string w, dchar obj, ref const(FormatSpec!char) f) | |
{ | |
dchar val = obj; | |
if (cast(int)f.spec == 115 || cast(int)f.spec == 99) | |
{ | |
put(w, val); | |
} | |
else | |
{ | |
alias U = uint; | |
formatValue(w, cast(uint)val, f); | |
} | |
} | |
put!(Appender!string, dchar) | |
pure @safe void put(ref Appender!string r, dchar e) | |
{ | |
doPut(r, e); | |
} | |
doPut!(Appender!string, dchar) | |
pure @safe void doPut(ref Appender!string r, ref dchar e) | |
{ | |
enum bool usingPut = true; | |
r.put(e); | |
} | |
IntegralTypeOf!uint | |
alias IntegralTypeOf = uint; | |
staticIndexOf!(uint, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = 5; | |
genericIndexOf!(uint, byte, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(uint, byte) | |
enum bool isSame = false; | |
genericIndexOf!(uint, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(uint, ubyte) | |
enum bool isSame = false; | |
genericIndexOf!(uint, short, ushort, int, uint, long, ulong) | |
isSame!(uint, short) | |
enum bool isSame = false; | |
genericIndexOf!(uint, ushort, int, uint, long, ulong) | |
isSame!(uint, ushort) | |
enum bool isSame = false; | |
genericIndexOf!(uint, int, uint, long, ulong) | |
isSame!(uint, int) | |
enum bool isSame = false; | |
genericIndexOf!(uint, uint, long, ulong) | |
isSame!(uint, uint) | |
enum bool isSame = true; | |
hasToString!(uint, char) | |
enum int hasToString = 0; | |
isPointer!uint | |
enum bool isPointer = false; | |
staticIndexOf!(uint, float, double, real) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(uint, float, double, real) | |
isSame!(uint, float) | |
enum bool isSame = false; | |
genericIndexOf!(uint, double, real) | |
isSame!(uint, double) | |
enum bool isSame = false; | |
genericIndexOf!(uint, real) | |
isSame!(uint, real) | |
enum bool isSame = false; | |
genericIndexOf!uint | |
staticIndexOf!(uint, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(uint, char, wchar, dchar) | |
isSame!(uint, char) | |
enum bool isSame = false; | |
genericIndexOf!(uint, wchar, dchar) | |
isSame!(uint, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(uint, dchar) | |
isSame!(uint, dchar) | |
enum bool isSame = false; | |
isDelegate!uint | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, uint, char) | |
pure @safe void formatValue(Appender!string w, uint obj, ref const(FormatSpec!char) f) | |
{ | |
alias U = uint; | |
uint val = obj; | |
if (cast(int)f.spec == 114) | |
{ | |
scope const(char)[] raw = (*function (return ref uint val) => (cast(const(char*))&val)[0..4])(val); | |
if (needToSwapEndianess(f)) | |
{ | |
{ | |
scope const(char)[] __r2381 = raw[]; | |
ulong __key2382 = __r2381.length; | |
for (; __key2382--;) | |
{ | |
const const(char) c = __r2381[__key2382]; | |
put(w, c); | |
} | |
} | |
} | |
else | |
{ | |
{ | |
scope const(char)[] __r2383 = raw[]; | |
ulong __key2384 = 0LU; | |
for (; __key2384 < __r2383.length; __key2384 += 1LU) | |
{ | |
const const(char) c = __r2383[__key2384]; | |
put(w, c); | |
} | |
} | |
} | |
return ; | |
} | |
immutable immutable(uint) base = cast(int)f.spec == 120 || cast(int)f.spec == 88 ? 16u : cast(int)f.spec == 111 ? 8u : cast(int)f.spec == 98 ? 2u : cast(int)f.spec == 115 || cast(int)f.spec == 100 || cast(int)f.spec == 117 ? 10u : 0u; | |
enforceEx(base > 0u, delegate string() => "integral", "/usr/include/dmd/phobos/std/format.d", 1744LU); | |
alias C = ulong; | |
formatIntegral(w, cast(ulong)val, f, base, 4294967295LU); | |
} | |
__lambda4!uint | |
function (return ref uint val) => (cast(const(char*))&val)[0..4]isSigned!uint | |
enum bool isSigned = false; | |
Unsigned!uint | |
alias Unsigned = uint; | |
ModifyTypePreservingTQ!(Impl, uint) | |
alias ModifyTypePreservingTQ = uint; | |
Modifier!uint | |
alias Impl = uint; | |
isUnsigned!uint | |
enum bool isUnsigned = true; | |
text!(string, string, string) | |
pure nothrow @safe string text(string _param_0, string _param_1, string _param_2) | |
{ | |
return textImpl(_param_0, _param_1, _param_2); | |
} | |
textImpl!(string, string, string, string) | |
pure nothrow @safe string textImpl(string _param_0, string _param_1, string _param_2) | |
{ | |
import std.array : appender; | |
Appender!string app = appender(); | |
app.reserve(60LU); | |
unrolled { | |
{ | |
string arg = _param_0; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_1; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_2; | |
app.put(to(arg)); | |
} | |
} | |
return app.data(); | |
} | |
isIntegral!uint | |
enum bool isIntegral = true; | |
isFloatingPoint!uint | |
enum bool isFloatingPoint = false; | |
staticIndexOf!(uint, dchar, char) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(uint, dchar, char) | |
genericIndexOf!(uint, char) | |
isAssociativeArray!uint | |
enum bool isAssociativeArray = false; | |
parse!(uint, const(char)[]) | |
pure @safe uint parse(ref const(char)[] s) | |
{ | |
enum bool sign = false; | |
enum char maxLastDigit = '\x05'; | |
uint c = 0u; | |
import std.string : representation; | |
const(ubyte)[] source = representation(s); | |
if (empty(source)) | |
goto Lerr; | |
c = cast(uint)front(source); | |
c -= 48u; | |
if (c <= 9u) | |
{ | |
uint v = c; | |
popFront(source); | |
for (; !empty(source);) | |
{ | |
{ | |
c = cast(uint)(cast(int)front(source) - 48); | |
if (c > 9u) | |
break; | |
if (v >= 0u && (v < 429496729u || v == 429496729u && c <= 5u)) | |
{ | |
v = v * 10u + c; | |
popFront(source); | |
} | |
else | |
throw new ConvOverflowException("Overflow in integral conversion", "/usr/include/dmd/phobos/std/conv.d", 2098LU); | |
} | |
} | |
if (false) | |
v = -v; | |
s = cast(const(char)[])source; | |
return v; | |
} | |
Lerr: | |
throw convError(cast(const(char)[])source, "/usr/include/dmd/phobos/std/conv.d", 2111LU); | |
} | |
convError!(const(char)[], uint) | |
auto pure @safe ConvException convError(const(char)[] source, string fn = __FILE__, ulong ln = cast(ulong)__LINE__) | |
{ | |
return new ConvException(text("Unexpected ", convError_unexpected(source), " when converting from type const(char)[] to type uint"), fn, ln, null); | |
} | |
enforceEx!ulong | |
pure @safe ulong enforceEx(ulong value, lazy string msg = "", string file = __FILE__, ulong line = cast(ulong)__LINE__) | |
{ | |
if (!value) | |
throw new FormatException(msg(), file, line, null); | |
return value; | |
} | |
arrayPtrDiff!char | |
pure nothrow @nogc @trusted long arrayPtrDiff(const(char[]) array1, const(char[]) array2) | |
{ | |
return (cast(const(char)*)array1 - cast(const(char)*)array2) / 1L; | |
} | |
binaryFun!("a == b", "a", "b") | |
auto binaryFun(ElementType1, ElementType2)(auto ref ElementType1 __a, auto ref ElementType2 __b) | |
{ | |
mixin("alias " ~ parm1Name ~ " = __a ;"); | |
mixin("alias " ~ parm2Name ~ " = __b ;"); | |
return mixin(fun); | |
} | |
binaryFun!(dchar, char) | |
auto pure nothrow @nogc @safe bool binaryFun(dchar __a, ref char __b) | |
{ | |
alias a = dchar __a; | |
; | |
alias b = ref char __b; | |
; | |
return cast(uint)__a == cast(uint)cast(int)__b; | |
} | |
startsWith!("a == b", const(char)[], char) | |
pure @safe bool startsWith(const(char)[] doesThisStart, char withThis) | |
{ | |
return empty(doesThisStart) ? false : binaryFun(front(doesThisStart), withThis); | |
} | |
to!ubyte | |
T to(A...)(A args) if (A.length > 0) | |
{ | |
return toImpl!T | |
(args); | |
} | |
isStaticArray!(const(uint)) | |
enum bool isStaticArray = false; | |
to!(const(uint)) | |
pure @safe ubyte to(const(uint) _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(const(uint), ubyte) | |
enum bool isImplicitlyConvertible = false; | |
isInfinite!(const(uint)) | |
enum bool isInfinite = false; | |
isInputRange!(const(uint)) | |
enum bool isInputRange = false; | |
isExactSomeString!ubyte | |
enum bool isExactSomeString = false; | |
isSomeString!ubyte | |
enum bool isSomeString = false; | |
isNumeric!(const(uint)) | |
enum bool isNumeric = true; | |
Unqual!(const(uint)) | |
alias Unqual = uint; | |
isNumeric!ubyte | |
enum bool isNumeric = true; | |
isSomeString!(const(uint)) | |
enum bool isSomeString = false; | |
isAggregateType!(const(uint)) | |
enum bool isAggregateType = false; | |
isDynamicArray!(const(uint)) | |
enum bool isDynamicArray = false; | |
OriginalType!(const(uint)) | |
alias OriginalType = const(uint); | |
ModifyTypePreservingTQ!(Impl, const(uint)) | |
alias ModifyTypePreservingTQ = const const(uint); | |
Modifier!uint | |
alias Impl = uint; | |
isAssociativeArray!(const(uint)) | |
enum bool isAssociativeArray = false; | |
toImpl!(ubyte, const(uint)) | |
pure @safe ubyte toImpl(const(uint) value) | |
{ | |
enum byte sSmallest = cast(byte)0; | |
enum byte tSmallest = cast(byte)0; | |
if (value > 255u) | |
throw new ConvOverflowException("Conversion positive overflow", "/usr/include/dmd/phobos/std/conv.d", 1362LU); | |
return (*function (ref const(uint) value) => cast(ubyte)value)(value); | |
} | |
mostNegative!(const(uint)) | |
enum byte mostNegative = cast(byte)0; | |
mostNegative!ubyte | |
enum byte mostNegative = cast(byte)0; | |
__lambda2!(const(uint)) | |
function (ref const(uint) value) => cast(ubyte)valueisIntegral!ubyte | |
enum bool isIntegral = true; | |
isFloatingPoint!ubyte | |
enum bool isFloatingPoint = false; | |
staticIndexOf!(ubyte, dchar, char) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(ubyte, dchar, char) | |
genericIndexOf!(ubyte, char) | |
isDynamicArray!ubyte | |
enum bool isDynamicArray = false; | |
isAssociativeArray!ubyte | |
enum bool isAssociativeArray = false; | |
parse!(ubyte, const(char)[]) | |
pure @safe ubyte parse(ref const(char)[] s) | |
{ | |
uint v = parse(s); | |
ubyte result = delegate () => cast(ubyte)v(); | |
if (cast(uint)cast(int)result == v) | |
return result; | |
throw new ConvOverflowException("Overflow in integral conversion", "/usr/include/dmd/phobos/std/conv.d", 2024LU); | |
} | |
Select!(false, int, uint) | |
alias Select = uint; | |
Alias!uint | |
alias Alias = uint; | |
to!int | |
T to(A...)(A args) if (A.length > 0) | |
{ | |
return toImpl!T | |
(args); | |
} | |
to!(const(uint)) | |
pure @safe int to(const(uint) _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(const(uint), int) | |
enum bool isImplicitlyConvertible = true; | |
isEnumStrToStr!(const(uint), int) | |
enum bool isEnumStrToStr = false; | |
isExactSomeString!int | |
enum bool isExactSomeString = false; | |
isSomeString!int | |
enum bool isSomeString = false; | |
isNullToStr!(const(uint), int) | |
enum bool isNullToStr = false; | |
toImpl!(int, const(uint)) | |
pure @safe int toImpl(const(uint) value) | |
{ | |
enum isSignedInt(T) = isIntegral!T | |
&& isSigned!T | |
; | |
alias isUnsignedInt = enum bool isUnsigned(T) = __traits(isUnsigned, T) && !(is(Unqual!T | |
== char) || is(Unqual!T | |
== wchar) || is(Unqual!T | |
== dchar) || is(Unqual!T | |
== bool)); | |
; | |
import std.exception : enforce; | |
enforce(value <= 2147483647u, delegate Throwable() => new ConvOverflowException("Conversion positive overflow", "/usr/include/dmd/phobos/std/conv.d", 450LU)); | |
return cast(int)value; | |
} | |
isUnsignedInt!(const(uint)) | |
enum bool isUnsigned = true; | |
isSignedInt!int | |
enum bool isSignedInt = true; | |
isSomeFunction!(ConvOverflowException) | |
enum bool isSomeFunction = false; | |
enforce!bool | |
pure @safe bool enforce(bool value, lazy Throwable ex) | |
{ | |
if (!value) | |
throw ex(); | |
return value; | |
} | |
text!(string, char) | |
pure @safe string text(string _param_0, char _param_1) | |
{ | |
return textImpl(_param_0, _param_1); | |
} | |
textImpl!(string, string, char) | |
pure @safe string textImpl(string _param_0, char _param_1) | |
{ | |
import std.array : appender; | |
Appender!string app = appender(); | |
app.reserve(40LU); | |
unrolled { | |
{ | |
string arg = _param_0; | |
app.put(to(arg)); | |
} | |
{ | |
char arg = _param_1; | |
app.put(to(arg)); | |
} | |
} | |
return app.data(); | |
} | |
to!char | |
pure @safe string to(char _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(char, string) | |
enum bool isImplicitlyConvertible = false; | |
isInfinite!char | |
enum bool isInfinite = false; | |
isNumeric!char | |
enum bool isNumeric = false; | |
isSomeString!char | |
enum bool isSomeString = false; | |
isDynamicArray!char | |
enum bool isDynamicArray = false; | |
isAssociativeArray!char | |
enum bool isAssociativeArray = false; | |
toImpl!(string, char) | |
pure @safe string toImpl(char value) | |
{ | |
return toStr(value); | |
} | |
isExactSomeString!char | |
enum bool isExactSomeString = false; | |
isIntegral!char | |
enum bool isIntegral = false; | |
staticIndexOf!(char, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(char, byte, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(char, byte) | |
enum bool isSame = false; | |
genericIndexOf!(char, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(char, ubyte) | |
enum bool isSame = false; | |
genericIndexOf!(char, short, ushort, int, uint, long, ulong) | |
isSame!(char, short) | |
enum bool isSame = false; | |
genericIndexOf!(char, ushort, int, uint, long, ulong) | |
isSame!(char, ushort) | |
enum bool isSame = false; | |
genericIndexOf!(char, int, uint, long, ulong) | |
isSame!(char, int) | |
enum bool isSame = false; | |
genericIndexOf!(char, uint, long, ulong) | |
isSame!(char, uint) | |
enum bool isSame = false; | |
genericIndexOf!(char, long, ulong) | |
isSame!(char, long) | |
enum bool isSame = false; | |
genericIndexOf!(char, ulong) | |
isSame!(char, ulong) | |
enum bool isSame = false; | |
genericIndexOf!char | |
isPointer!char | |
enum bool isPointer = false; | |
toStr!(string, char) | |
pure @safe string toStr(char src) | |
{ | |
import std.format : FormatSpec, formatValue; | |
import std.array : appender; | |
Appender!string w = appender(); | |
FormatSpec!char f = FormatSpec; | |
formatValue(w, src, f); | |
return w.data(); | |
} | |
staticIndexOf!(char, float, double, real) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(char, float, double, real) | |
isSame!(char, float) | |
enum bool isSame = false; | |
genericIndexOf!(char, double, real) | |
isSame!(char, double) | |
enum bool isSame = false; | |
genericIndexOf!(char, real) | |
isSame!(char, real) | |
enum bool isSame = false; | |
hasToString!(char, char) | |
enum int hasToString = 0; | |
isDelegate!char | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, char, char) | |
pure @safe void formatValue(Appender!string w, char obj, ref const(FormatSpec!char) f) | |
{ | |
char val = obj; | |
if (cast(int)f.spec == 115 || cast(int)f.spec == 99) | |
{ | |
put(w, val); | |
} | |
else | |
{ | |
alias U = ubyte; | |
formatValue(w, cast(ubyte)val, f); | |
} | |
} | |
getNthInt!ubyte | |
pure @safe int getNthInt(uint index, ubyte _param_1) | |
{ | |
import std.conv : to; | |
if (index) | |
{ | |
return getNthInt(index - 1u); | |
} | |
return to(_param_1); | |
} | |
getNthInt!() | |
pure @safe int getNthInt(uint index) | |
{ | |
import std.conv : to; | |
throw new FormatException("int expected", "/usr/include/dmd/phobos/std/format.d", 3842LU, null); | |
} | |
to!ubyte | |
pure nothrow @nogc @safe int to(ubyte _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(ubyte, int) | |
enum bool isImplicitlyConvertible = true; | |
isEnumStrToStr!(ubyte, int) | |
enum bool isEnumStrToStr = false; | |
isNullToStr!(ubyte, int) | |
enum bool isNullToStr = false; | |
isInputRange!ubyte | |
enum bool isInputRange = false; | |
toImpl!(int, ubyte) | |
pure nothrow @nogc @safe int toImpl(ubyte value) | |
{ | |
enum isSignedInt(T) = isIntegral!T | |
&& isSigned!T | |
; | |
alias isUnsignedInt = enum bool isUnsigned(T) = __traits(isUnsigned, T) && !(is(Unqual!T | |
== char) || is(Unqual!T | |
== wchar) || is(Unqual!T | |
== dchar) || is(Unqual!T | |
== bool)); | |
; | |
return cast(int)value; | |
} | |
isSignedInt!int | |
enum bool isSignedInt = true; | |
isSignedInt!ubyte | |
enum bool isSignedInt = false; | |
to!int | |
pure nothrow @nogc @safe int to(int _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(int, int) | |
enum bool isImplicitlyConvertible = true; | |
isEnumStrToStr!(int, int) | |
enum bool isEnumStrToStr = false; | |
isNullToStr!(int, int) | |
enum bool isNullToStr = false; | |
isInputRange!int | |
enum bool isInputRange = false; | |
toImpl!(int, int) | |
pure nothrow @nogc @safe int toImpl(int value) | |
{ | |
enum isSignedInt(T) = isIntegral!T | |
&& isSigned!T | |
; | |
alias isUnsignedInt = enum bool isUnsigned(T) = __traits(isUnsigned, T) && !(is(Unqual!T | |
== char) || is(Unqual!T | |
== wchar) || is(Unqual!T | |
== dchar) || is(Unqual!T | |
== bool)); | |
; | |
return value; | |
} | |
isSignedInt!int | |
enum bool isSignedInt = true; | |
formatNth!(Appender!string, char, ubyte) | |
pure @safe void formatNth(Appender!string w, ref const(FormatSpec!char) f, ulong index, ubyte _param_3) | |
{ | |
import std.conv : to; | |
static string gencode(ulong count)() | |
{ | |
string result; | |
foreach (n; 0 .. count) | |
{ | |
auto num = to!string | |
(n); | |
result ~= "case " ~ num ~ ":" ~ " formatValue(w, args[" ~ num ~ "], f);" ~ " break;"; | |
} | |
return result; | |
} | |
switch (index) | |
{ | |
case 0LU: | |
{ | |
formatValue(w, _param_3, f); | |
break; | |
} | |
default: | |
{ | |
assert(0, "n = " ~ cast(char)(index + 48LU)); | |
} | |
} | |
} | |
gencode!1LU | |
static pure nothrow @safe string gencode() | |
{ | |
string result = null; | |
{ | |
ulong __key2398 = 0LU; | |
ulong __limit2399 = 1LU; | |
for (; __key2398 < __limit2399; __key2398 += 1LU) | |
{ | |
ulong n = __key2398; | |
string num = to(n); | |
result ~= "case " ~ num ~ ": formatValue(w, args[" ~ num ~ "], f); break;"; | |
} | |
} | |
return result; | |
} | |
isStaticArray!ulong | |
enum bool isStaticArray = false; | |
to!ulong | |
pure nothrow @safe string to(ulong _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(ulong, string) | |
enum bool isImplicitlyConvertible = false; | |
isInfinite!ulong | |
enum bool isInfinite = false; | |
isInputRange!ulong | |
enum bool isInputRange = false; | |
isSomeString!ulong | |
enum bool isSomeString = false; | |
isDynamicArray!ulong | |
enum bool isDynamicArray = false; | |
isAssociativeArray!ulong | |
enum bool isAssociativeArray = false; | |
toImpl!(string, ulong) | |
pure nothrow @safe string toImpl(ulong value) | |
{ | |
return toImpl(value, 10u, LetterCase.upper); | |
} | |
isExactSomeString!ulong | |
enum bool isExactSomeString = false; | |
toImpl!(string, ulong) | |
pure nothrow @trusted string toImpl(ulong value, uint radix, LetterCase letterCase = LetterCase.upper) | |
in | |
{ | |
assert(radix >= 2u && radix <= 36u); | |
} | |
body | |
{ | |
{ | |
assert(radix >= 2u && radix <= 36u); | |
} | |
alias EEType = char; | |
T toStringRadixConvert(ulong bufLen)(uint runtimeRadix = 0) | |
{ | |
Unsigned!(Unqual!S | |
) | |
div = void, mValue = unsigned(value); | |
size_t index = bufLen; | |
EEType[bufLen] buffer = void; | |
char baseChar = letterCase == LetterCase.lower ? 'a' : 'A'; | |
char mod = void; | |
do | |
{ | |
div = cast(S)(mValue / runtimeRadix); | |
mod = cast(ubyte)(mValue % runtimeRadix); | |
mod += mod < 10 ? '0' : baseChar - 10; | |
buffer[--index] = cast(char)mod; | |
mValue = div; | |
} | |
while (mValue); | |
return cast(T)buffer[index..__dollar].dup; | |
} | |
import std.array : array; | |
switch (radix) | |
{ | |
case 10u: | |
{ | |
return array(toChars(value + 0LU)); | |
} | |
case 16u: | |
{ | |
if (cast(int)letterCase == 0) | |
return array(toChars(unsigned(unsigned(value) + 0LU))); | |
else | |
return array(toChars(unsigned(unsigned(value) + 0LU))); | |
} | |
case 2u: | |
{ | |
return array(toChars(unsigned(unsigned(value) + 0LU))); | |
} | |
case 8u: | |
{ | |
return array(toChars(unsigned(unsigned(value) + 0LU))); | |
} | |
default: | |
{ | |
return toStringRadixConvert(radix); | |
} | |
} | |
} | |
toChars!(10, char, LetterCase.lower, ulong) | |
auto pure nothrow @nogc @safe Result toChars(ulong value) | |
{ | |
alias UT = ulong; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe void initialize(ulong value) | |
{ | |
assert(&this, "null this"); | |
bool neg = false; | |
if (value < 10LU) | |
{ | |
if (value >= 0LU) | |
{ | |
this.lwr = 0u; | |
this.upr = 1u; | |
this.buf[0] = cast(char)(cast(uint)value + 48u); | |
return ; | |
} | |
value = -value; | |
neg = true; | |
} | |
uint i = 19u; | |
for (; value >= 10LU;) | |
{ | |
{ | |
this.buf[cast(ulong)i] = cast(char)cast(ubyte)(48LU + value % 10LU); | |
value = unsigned(value) / 10LU; | |
i -= 1u; | |
} | |
} | |
this.buf[cast(ulong)i] = cast(char)(cast(uint)value + 48u); | |
if (neg) | |
{ | |
this.buf[cast(ulong)(i - 1u)] = '-'; | |
i -= 1u; | |
} | |
this.lwr = i; | |
this.upr = 20u; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.upr - this.lwr); | |
} | |
alias opDollar = pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.upr - this.lwr); | |
} | |
; | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this.upr == this.lwr; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.buf[cast(ulong)this.lwr]; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
this.lwr += 1u; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.buf[cast(ulong)(this.upr - 1u)]; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.upr -= 1u; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
return this.buf[cast(ulong)this.lwr + i]; | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.buf = this.buf; | |
result.lwr = cast(uint)(cast(ulong)this.lwr + lwr); | |
result.upr = cast(uint)(cast(ulong)this.lwr + upr); | |
return result; | |
} | |
private | |
{ | |
uint lwr = void; | |
uint upr = void; | |
char[20] buf = void; | |
} | |
} | |
Result result = void; | |
result.initialize(value); | |
return result; | |
} | |
isSigned!ulong | |
enum bool isSigned = false; | |
Unsigned!ulong | |
alias Unsigned = ulong; | |
ModifyTypePreservingTQ!(Impl, ulong) | |
alias ModifyTypePreservingTQ = ulong; | |
Modifier!ulong | |
alias Impl = ulong; | |
isUnsigned!ulong | |
enum bool isUnsigned = true; | |
isSomeChar!ulong | |
enum bool isSomeChar = false; | |
staticIndexOf!(ulong, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(ulong, char, wchar, dchar) | |
isSame!(ulong, char) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, wchar, dchar) | |
isSame!(ulong, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, dchar) | |
isSame!(ulong, dchar) | |
enum bool isSame = false; | |
genericIndexOf!ulong | |
unsigned!ulong | |
auto pure nothrow @nogc @safe ulong unsigned(ulong x) | |
{ | |
return x; | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2404 = r; | |
for (; !__r2404.empty(); __r2404.popFront()) | |
{ | |
char e = __r2404.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2406 = r; | |
for (; !__r2406.empty(); __r2406.popFront()) | |
{ | |
char e = __r2406.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
isCallable!(char function(inout(int)) pure nothrow @nogc @safe) | |
enum bool isCallable = true; | |
isSomeFunction!(char function(inout(int)) pure nothrow @nogc @safe) | |
enum bool isSomeFunction = true; | |
ReturnType!(char function(inout(int)) pure nothrow @nogc @safe) | |
alias ReturnType = char; | |
FunctionTypeOf!(char function(inout(int)) pure nothrow @nogc @safe) | |
alias pure nothrow @nogc @safe char FunctionTypeOf(inout(int)); | |
hasLength!(Result) | |
enum bool hasLength = true; | |
isDynamicArray!(char[]) | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!(char[]) | |
alias DynamicArrayTypeOf = char[]; | |
allSatisfy!(isIntegral, ulong) | |
enum bool allSatisfy = true; | |
hasIndirections!char | |
enum bool hasIndirections = false; | |
isFunctionPointer!char | |
enum bool isFunctionPointer = false; | |
uninitializedArray!(char[], ulong) | |
auto pure nothrow @trusted char[] uninitializedArray(ulong _param_0) | |
{ | |
enum isSize_t(E) = is(E : size_t); | |
template toSize_t(E) | |
{ | |
alias toSize_t = size_t; | |
} | |
alias ST = (ulong); | |
return arrayAllocImpl(_param_0); | |
} | |
allSatisfy!(isSize_t, ulong) | |
enum bool allSatisfy = true; | |
F!ulong | |
enum bool isSize_t = true; | |
staticMap!(toSize_t, ulong) | |
alias staticMap = (ulong); | |
F!ulong | |
alias toSize_t = ulong; | |
AliasSeq!ulong | |
alias AliasSeq = (ulong); | |
arrayAllocImpl!(false, char[], ulong) | |
auto pure nothrow @system char[] arrayAllocImpl(ulong _param_0) | |
{ | |
alias E = char; | |
char[] ret = null; | |
alias size = ulong _param_0; | |
; | |
if (__ctfe) | |
{ | |
ret = new char[](_param_0); | |
} | |
else | |
{ | |
import core.stdc.string : memset; | |
import core.memory : GC; | |
import core.checkedint : mulu; | |
bool overflow = false; | |
const const(ulong) nbytes = mulu(_param_0, 1LU, overflow); | |
if (overflow) | |
assert(0); | |
char* ptr = cast(char*)malloc(nbytes, 2u, null); | |
ret = ptr[0.._param_0]; | |
} | |
return ret; | |
} | |
nDimensions!(char[]) | |
enum int nDimensions = 1; | |
isArray!(char[]) | |
enum bool isArray = true; | |
nDimensions!char | |
enum int nDimensions = 0; | |
isArray!char | |
enum bool isArray = false; | |
blockAttribute!char | |
enum BlkAttr blockAttribute = BlkAttr.NO_SCAN; | |
toChars!(16, char, LetterCase.upper, ulong) | |
auto pure nothrow @nogc @safe Result toChars(ulong value) | |
{ | |
alias UT = ulong; | |
enum int SHIFT = 4; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe this(ulong value) | |
{ | |
this.value = value; | |
ubyte len = cast(ubyte)1u; | |
for (; value >>>= 4;) | |
{ | |
cast(int)len += 1; | |
} | |
this.len = len; | |
return this; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)this.len; | |
} | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.len == 0; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(0LU); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(cast(ulong)(cast(int)this.len - 1)); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.value >>>= 4; | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
char c = cast(char)(this.value >>> cast(int)((cast(ulong)cast(int)this.len - i - 1LU) * 4LU) & 15LU); | |
return cast(bool)(cast(int)c < 10) ? cast(char)(cast(int)c + 48) : cast(char)(cast(int)c + 65 - 10); | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.value = this.value >>> cast(int)((cast(ulong)cast(int)this.len - upr) * 4LU); | |
result.len = cast(ubyte)(upr - lwr); | |
return result; | |
} | |
private | |
{ | |
ulong value; | |
ubyte len; | |
} | |
} | |
return Result(0LU, cast(ubyte)0u).this(value); | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2409 = r; | |
for (; !__r2409.empty(); __r2409.popFront()) | |
{ | |
char e = __r2409.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2410 = r; | |
for (; !__r2410.empty(); __r2410.popFront()) | |
{ | |
char e = __r2410.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
toChars!(16, char, LetterCase.lower, ulong) | |
auto pure nothrow @nogc @safe Result toChars(ulong value) | |
{ | |
alias UT = ulong; | |
enum int SHIFT = 4; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe this(ulong value) | |
{ | |
this.value = value; | |
ubyte len = cast(ubyte)1u; | |
for (; value >>>= 4;) | |
{ | |
cast(int)len += 1; | |
} | |
this.len = len; | |
return this; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)this.len; | |
} | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.len == 0; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(0LU); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(cast(ulong)(cast(int)this.len - 1)); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.value >>>= 4; | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
char c = cast(char)(this.value >>> cast(int)((cast(ulong)cast(int)this.len - i - 1LU) * 4LU) & 15LU); | |
return cast(bool)(cast(int)c < 10) ? cast(char)(cast(int)c + 48) : cast(char)(cast(int)c + 97 - 10); | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.value = this.value >>> cast(int)((cast(ulong)cast(int)this.len - upr) * 4LU); | |
result.len = cast(ubyte)(upr - lwr); | |
return result; | |
} | |
private | |
{ | |
ulong value; | |
ubyte len; | |
} | |
} | |
return Result(0LU, cast(ubyte)0u).this(value); | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2413 = r; | |
for (; !__r2413.empty(); __r2413.popFront()) | |
{ | |
char e = __r2413.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2414 = r; | |
for (; !__r2414.empty(); __r2414.popFront()) | |
{ | |
char e = __r2414.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
toChars!(2, char, LetterCase.lower, ulong) | |
auto pure nothrow @nogc @safe Result toChars(ulong value) | |
{ | |
alias UT = ulong; | |
enum int SHIFT = 1; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe this(ulong value) | |
{ | |
this.value = value; | |
ubyte len = cast(ubyte)1u; | |
for (; value >>>= 1;) | |
{ | |
cast(int)len += 1; | |
} | |
this.len = len; | |
return this; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)this.len; | |
} | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.len == 0; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(0LU); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(cast(ulong)(cast(int)this.len - 1)); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.value >>>= 1; | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
char c = cast(char)(this.value >>> cast(int)((cast(ulong)cast(int)this.len - i - 1LU) * 1LU) & 1LU); | |
return cast(char)(cast(int)c + 48); | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.value = this.value >>> cast(int)((cast(ulong)cast(int)this.len - upr) * 1LU); | |
result.len = cast(ubyte)(upr - lwr); | |
return result; | |
} | |
private | |
{ | |
ulong value; | |
ubyte len; | |
} | |
} | |
return Result(0LU, cast(ubyte)0u).this(value); | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2417 = r; | |
for (; !__r2417.empty(); __r2417.popFront()) | |
{ | |
char e = __r2417.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2418 = r; | |
for (; !__r2418.empty(); __r2418.popFront()) | |
{ | |
char e = __r2418.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
toChars!(8, char, LetterCase.lower, ulong) | |
auto pure nothrow @nogc @safe Result toChars(ulong value) | |
{ | |
alias UT = ulong; | |
enum int SHIFT = 3; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe this(ulong value) | |
{ | |
this.value = value; | |
ubyte len = cast(ubyte)1u; | |
for (; value >>>= 3;) | |
{ | |
cast(int)len += 1; | |
} | |
this.len = len; | |
return this; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)this.len; | |
} | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.len == 0; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(0LU); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(cast(ulong)(cast(int)this.len - 1)); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.value >>>= 3; | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
char c = cast(char)(this.value >>> cast(int)((cast(ulong)cast(int)this.len - i - 1LU) * 3LU) & 7LU); | |
return cast(char)(cast(int)c + 48); | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.value = this.value >>> cast(int)((cast(ulong)cast(int)this.len - upr) * 3LU); | |
result.len = cast(ubyte)(upr - lwr); | |
return result; | |
} | |
private | |
{ | |
ulong value; | |
ubyte len; | |
} | |
} | |
return Result(0LU, cast(ubyte)0u).this(value); | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2421 = r; | |
for (; !__r2421.empty(); __r2421.popFront()) | |
{ | |
char e = __r2421.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2422 = r; | |
for (; !__r2422.empty(); __r2422.popFront()) | |
{ | |
char e = __r2422.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
toStringRadixConvert!48LU | |
pure nothrow @system string toStringRadixConvert(uint runtimeRadix = 0u) | |
{ | |
ulong div = void; | |
ulong mValue = unsigned(value); | |
ulong index = 48LU; | |
char[48] buffer = void; | |
char baseChar = cast(int)letterCase == 1 ? 'a' : 'A'; | |
char mod = void; | |
do | |
{ | |
div = mValue / cast(ulong)runtimeRadix; | |
mod = cast(char)cast(ubyte)(mValue % cast(ulong)runtimeRadix); | |
cast(int)mod += cast(int)mod < 10 ? 48 : cast(int)baseChar - 10; | |
buffer[index -= 1LU] = mod; | |
mValue = div; | |
} | |
while (mValue); | |
return cast(string)dup(buffer[index..48]); | |
} | |
dup!char | |
pure nothrow @property @safe char[] dup(const(char)[] a) | |
{ | |
return _trustedDup(a); | |
} | |
_trustedDup!(const(char), char) | |
pure nothrow @trusted char[] _trustedDup(const(char)[] a) | |
{ | |
return _dup(a); | |
} | |
_dup!(const(char), char) | |
pure nothrow @system char[] _dup(const(char)[] a) | |
{ | |
if (__ctfe) | |
{ | |
char[] res = null; | |
{ | |
const(char)[] __r2423 = a[]; | |
ulong __key2424 = 0LU; | |
for (; __key2424 < __r2423.length; __key2424 += 1LU) | |
{ | |
const ref const(char) e = __r2423[__key2424]; | |
res ~= e; | |
} | |
} | |
return res; | |
} | |
import core.stdc.string : memcpy; | |
void[] arr = _d_newarrayU(typeid(const(char)[]), a.length); | |
memcpy(cast(void*)arr, cast(const(void)*)cast(const(char)*)a, 1LU * a.length); | |
char[] res = *& arr; | |
_doPostblit(res); | |
return res; | |
} | |
_doPostblit!char | |
pure nothrow @nogc @safe void _doPostblit(char[] arr) | |
{ | |
if (auto postblit = (void delegate(ref char t) pure nothrow @nogc @safe postblit = _getPostblit();) , postblit) | |
{ | |
{ | |
char[] __r2425 = arr[]; | |
ulong __key2426 = 0LU; | |
for (; __key2426 < __r2425.length; __key2426 += 1LU) | |
{ | |
ref char elem = __r2425[__key2426]; | |
postblit(elem); | |
} | |
} | |
} | |
} | |
_getPostblit!char | |
auto pure nothrow @nogc @trusted void delegate(ref char t) pure nothrow @nogc @safe _getPostblit() | |
{ | |
if ((&typeid(char).postblit).funcptr !is & postblit) | |
{ | |
alias _PostBlitType = void delegate(ref char t) pure nothrow @nogc @safe; | |
return cast(void delegate(ref char t) pure nothrow @nogc @safe)&typeid(char).postblit; | |
} | |
else | |
return cast(void delegate(ref char t) pure nothrow @nogc @safe)null; | |
} | |
text!(string, uint, string, ulong, string) | |
pure nothrow @safe string text(string _param_0, uint _param_1, string _param_2, ulong _param_3, string _param_4) | |
{ | |
return textImpl(_param_0, _param_1, _param_2, _param_3, _param_4); | |
} | |
textImpl!(string, string, uint, string, ulong, string) | |
pure nothrow @safe string textImpl(string _param_0, uint _param_1, string _param_2, ulong _param_3, string _param_4) | |
{ | |
import std.array : appender; | |
Appender!string app = appender(); | |
app.reserve(100LU); | |
unrolled { | |
{ | |
string arg = _param_0; | |
app.put(to(arg)); | |
} | |
{ | |
uint arg = _param_1; | |
app.put(toChars(arg)); | |
} | |
{ | |
string arg = _param_2; | |
app.put(to(arg)); | |
} | |
{ | |
ulong arg = _param_3; | |
app.put(toChars(arg)); | |
} | |
{ | |
string arg = _param_4; | |
app.put(to(arg)); | |
} | |
} | |
return app.data(); | |
} | |
toChars!(cast(ubyte)10u, char, LetterCase.lower, uint) | |
auto pure nothrow @nogc @safe Result toChars(uint value) | |
{ | |
alias UT = uint; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe void initialize(uint value) | |
{ | |
assert(&this, "null this"); | |
bool neg = false; | |
if (value < 10u) | |
{ | |
if (value >= 0u) | |
{ | |
this.lwr = 0u; | |
this.upr = 1u; | |
this.buf[0] = cast(char)(value + 48u); | |
return ; | |
} | |
value = -value; | |
neg = true; | |
} | |
uint i = 9u; | |
for (; value >= 10u;) | |
{ | |
{ | |
this.buf[cast(ulong)i] = cast(char)cast(ubyte)(48u + value % 10u); | |
value = unsigned(value) / 10u; | |
i -= 1u; | |
} | |
} | |
this.buf[cast(ulong)i] = cast(char)(value + 48u); | |
if (neg) | |
{ | |
this.buf[cast(ulong)(i - 1u)] = '-'; | |
i -= 1u; | |
} | |
this.lwr = i; | |
this.upr = 10u; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.upr - this.lwr); | |
} | |
alias opDollar = pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.upr - this.lwr); | |
} | |
; | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this.upr == this.lwr; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.buf[cast(ulong)this.lwr]; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
this.lwr += 1u; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.buf[cast(ulong)(this.upr - 1u)]; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.upr -= 1u; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
return this.buf[cast(ulong)this.lwr + i]; | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.buf = this.buf; | |
result.lwr = cast(uint)(cast(ulong)this.lwr + lwr); | |
result.upr = cast(uint)(cast(ulong)this.lwr + upr); | |
return result; | |
} | |
private | |
{ | |
uint lwr = void; | |
uint upr = void; | |
char[10] buf = void; | |
} | |
} | |
Result result = void; | |
result.initialize(value); | |
return result; | |
} | |
isSomeChar!uint | |
enum bool isSomeChar = false; | |
unsigned!uint | |
auto pure nothrow @nogc @safe uint unsigned(uint x) | |
{ | |
return x; | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
canPutItem!(Result) | |
enum bool canPutItem = false; | |
isImplicitlyConvertible!(Result, immutable(char)) | |
enum bool isImplicitlyConvertible = false; | |
isSomeChar!(Result) | |
enum bool isSomeChar = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
OriginalType!(Result) | |
alias OriginalType = Result; | |
ModifyTypePreservingTQ!(Impl, Result) | |
alias ModifyTypePreservingTQ = Result; | |
Modifier!(Result) | |
alias Impl = Result; | |
Unqual!(Result) | |
alias Unqual = Result; | |
staticIndexOf!(Result, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(Result, char, wchar, dchar) | |
OldAlias!(Result) | |
alias OldAlias = Result; | |
isSame!(Result, char) | |
enum bool isSame = false; | |
expectType!(Result) | |
genericIndexOf!(Result, wchar, dchar) | |
isSame!(Result, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(Result, dchar) | |
isSame!(Result, dchar) | |
enum bool isSame = false; | |
genericIndexOf!(Result) | |
canPutConstRange!(Result) | |
enum bool canPutConstRange = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
canPutRange!(Result) | |
enum bool canPutRange = true; | |
put!(Result) | |
pure nothrow @safe void put(Result items) | |
{ | |
assert(&this, "null this"); | |
for (; !items.empty(); items.popFront()) | |
{ | |
{ | |
this.put(items.front()); | |
} | |
} | |
} | |
ElementType!(Result) | |
alias ElementType = char; | |
canPutItem!(Result) | |
enum bool canPutItem = false; | |
isImplicitlyConvertible!(Result, immutable(char)) | |
enum bool isImplicitlyConvertible = false; | |
isSomeChar!(Result) | |
enum bool isSomeChar = false; | |
OriginalType!(Result) | |
alias OriginalType = Result; | |
ModifyTypePreservingTQ!(Impl, Result) | |
alias ModifyTypePreservingTQ = Result; | |
Modifier!(Result) | |
alias Impl = Result; | |
Unqual!(Result) | |
alias Unqual = Result; | |
staticIndexOf!(Result, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(Result, char, wchar, dchar) | |
OldAlias!(Result) | |
alias OldAlias = Result; | |
isSame!(Result, char) | |
enum bool isSame = false; | |
expectType!(Result) | |
genericIndexOf!(Result, wchar, dchar) | |
isSame!(Result, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(Result, dchar) | |
isSame!(Result, dchar) | |
enum bool isSame = false; | |
genericIndexOf!(Result) | |
canPutConstRange!(Result) | |
enum bool canPutConstRange = false; | |
canPutRange!(Result) | |
enum bool canPutRange = true; | |
put!(Result) | |
pure nothrow @safe void put(Result items) | |
{ | |
assert(&this, "null this"); | |
for (; !items.empty(); items.popFront()) | |
{ | |
{ | |
this.put(items.front()); | |
} | |
} | |
} | |
ElementType!(Result) | |
alias ElementType = char; | |
isSomeFunction!(FormatException) | |
enum bool isSomeFunction = false; | |
RTInfo!(Data) | |
enum typeof(null) RTInfo = null; | |
static __gshared TypeInfo_Const _D11TypeInfo_xm6__initZ; | |
static __gshared TypeInfo_Const _D12TypeInfo_xAa6__initZ; | |
static __gshared TypeInfo_Const _D11TypeInfo_xb6__initZ; | |
RTInfo!(Appender!string) | |
enum typeof(null) RTInfo = null; | |
appender!(char[]) | |
pure nothrow @safe Appender!(char[]) appender() | |
{ | |
return Appender(null).this(null); | |
} | |
Appender!(char[]) | |
struct Appender | |
{ | |
import core.memory : GC; | |
private alias T = char; | |
private struct Data | |
{ | |
ulong capacity; | |
char[] arr; | |
bool canExtend = false; | |
} | |
private Data* _data; | |
pure nothrow @trusted this(char[] arr) | |
{ | |
this._data = new Data(0LU, null, false); | |
(*this._data).arr = arr; | |
if (__ctfe) | |
return this; | |
immutable immutable(ulong) cap = capacity(arr); | |
if (cap > arr.length) | |
arr.length = cap; | |
(*this._data).capacity = arr.length; | |
return this; | |
} | |
pure nothrow @safe void reserve(ulong newCapacity) | |
{ | |
assert(&this, "null this"); | |
if (this._data) | |
{ | |
if (newCapacity > (*this._data).capacity) | |
this.ensureAddable(newCapacity - (*this._data).arr.length); | |
} | |
else | |
{ | |
this.ensureAddable(newCapacity); | |
} | |
} | |
const pure nothrow @nogc @property @safe ulong capacity() | |
{ | |
assert(&this, "null this"); | |
return this._data ? (*this._data).capacity : 0LU; | |
} | |
inout pure nothrow @nogc @property @trusted inout(char)[] data() | |
{ | |
assert(&this, "null this"); | |
return this._data ? (*this._data).arr : null; | |
} | |
private pure nothrow @trusted void ensureAddable(ulong nelems) | |
{ | |
if (!this._data) | |
this._data = new Data(0LU, null, false); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) reqlen = len + nelems; | |
if ((*this._data).capacity >= reqlen) | |
return ; | |
if (__ctfe) | |
{ | |
(*this._data).arr.length = reqlen; | |
(*this._data).arr = (*this._data).arr[0..len]; | |
(*this._data).capacity = reqlen; | |
} | |
else | |
{ | |
ulong newlen = appenderNewCapacity((*this._data).capacity, reqlen); | |
if ((*this._data).canExtend) | |
{ | |
immutable immutable(ulong) u = extend(cast(void*)cast(char*)(*this._data).arr, nelems * 1LU, (newlen - len) * 1LU, null); | |
if (u) | |
{ | |
(*this._data).capacity = u / 1LU; | |
return ; | |
} | |
} | |
import core.checkedint : mulu; | |
bool overflow = false; | |
const const(ulong) nbytes = mulu(newlen, 1LU, overflow); | |
if (overflow) | |
assert(0); | |
BlkInfo_ bi = qalloc(nbytes, 2u, null); | |
(*this._data).capacity = bi.size / 1LU; | |
import core.stdc.string : memcpy; | |
if (len) | |
memcpy(bi.base, cast(const(void*))cast(char*)(*this._data).arr, len * 1LU); | |
(*this._data).arr = (cast(char*)bi.base)[0..len]; | |
(*this._data).canExtend = true; | |
} | |
} | |
private enum bool canPutItem(U) = isImplicitlyConvertible!(U, T) | |
|| isSomeChar!T | |
&& isSomeChar!U | |
; | |
private enum bool canPutConstRange(Range) = isInputRange!(Unqual!Range | |
) | |
&& !isInputRange!Range | |
; | |
private enum bool canPutRange(Range) = isInputRange!Range | |
&& is(typeof(Appender.init.put(Range.init.front))); | |
void put(U)(U item) if (canPutItem!U | |
) | |
{ | |
static if (isSomeChar!T | |
&& isSomeChar!U | |
&& T.sizeof < U.sizeof) | |
{ | |
import std.utf : encode; | |
Unqual!T | |
[T.sizeof == 1 ? 4 : 2] encoded; | |
auto len = encode(encoded, item); | |
put(encoded[0..len]); | |
} | |
else | |
{ | |
import std.conv : emplaceRef; | |
ensureAddable(1); | |
immutable len = _data.arr.length; | |
auto bigData = () => _data.arr.ptr[0..len + 1](); | |
emplaceRef!(Unqual!T | |
) | |
(bigData[len], cast(Unqual!T | |
)item); | |
_data.arr = bigData; | |
} | |
} | |
void put(Range)(Range items) if (canPutConstRange!Range | |
) | |
{ | |
alias p = put!(Unqual!Range | |
) | |
; | |
p(items); | |
} | |
void put(Range)(Range items) if (canPutRange!Range | |
) | |
{ | |
static if (!(isSomeChar!T | |
&& isSomeChar!(ElementType!Range | |
) | |
&& !is(immutable(Range) == immutable(T[]))) && is(typeof(items.length) == size_t)) | |
{ | |
static if (!isSomeChar!T | |
) | |
{ | |
if (items.length == 1) | |
{ | |
put(items.front); | |
return ; | |
} | |
} | |
auto @trusted bigDataFun(size_t extra) | |
{ | |
ensureAddable(extra); | |
return _data.arr.ptr[0.._data.arr.length + extra]; | |
} | |
auto bigData = bigDataFun(items.length); | |
immutable len = _data.arr.length; | |
immutable newlen = bigData.length; | |
alias UT = Unqual!T | |
; | |
static if (is(typeof(_data.arr[] = items[])) && !hasElaborateAssign!UT | |
&& isAssignable!(UT, ElementEncodingType!Range | |
) | |
) | |
{ | |
bigData[len..newlen] = items[]; | |
} | |
else | |
{ | |
import std.conv : emplaceRef; | |
foreach (ref it; bigData[len..newlen]) | |
{ | |
emplaceRef!T | |
(it, items.front); | |
items.popFront(); | |
} | |
} | |
_data.arr = bigData; | |
} | |
else | |
{ | |
for (; !items.empty; items.popFront()) | |
{ | |
{ | |
put(items.front); | |
} | |
} | |
} | |
} | |
void opOpAssign(string op : "~", U)(U rhs) if (__traits(compiles, put(rhs))) | |
{ | |
put(rhs); | |
} | |
static if (isMutable!char | |
enum bool isMutable = true; | |
) | |
{ | |
pure nothrow @nogc @trusted void clear() | |
{ | |
assert(&this, "null this"); | |
if (this._data) | |
{ | |
(*this._data).arr = (cast(char*)(*this._data).arr)[0..0]; | |
} | |
} | |
pure @trusted void shrinkTo(ulong newlength) | |
{ | |
assert(&this, "null this"); | |
import std.exception : enforce; | |
if (this._data) | |
{ | |
enforce(newlength <= (*this._data).arr.length, delegate const(char)[]() => "Attempting to shrink Appender with newlength > length", "/usr/include/dmd/phobos/std/array.d", 3015LU); | |
(*this._data).arr = (cast(char*)(*this._data).arr)[0..newlength]; | |
} | |
else | |
enforce(newlength == 0LU, delegate const(char)[]() => "Attempting to shrink empty Appender with non-zero newlength", "/usr/include/dmd/phobos/std/array.d", 3019LU); | |
} | |
} | |
void toString(Writer)(scope Writer w) | |
{ | |
import std.format : formattedWrite; | |
w.formattedWrite((typeof(this)).stringof ~ "(%s)", data); | |
} | |
} | |
isMutable!char | |
enum bool isMutable = true; | |
static __gshared TypeInfo_Struct _D52TypeInfo_S3std5array16__T8AppenderTAaZ8Appender4Data6__initZ; | |
capacity!char | |
pure nothrow @property @trusted ulong capacity(char[] arr) | |
{ | |
return _d_arraysetcapacity(typeid(char[]), 0LU, & arr); | |
} | |
writeUpToNextSpec!(Appender!(char[])) | |
pure @safe bool writeUpToNextSpec(Appender!(char[]) writer) | |
{ | |
assert(&this, "null this"); | |
if (empty(this.trailing)) | |
return false; | |
{ | |
ulong i = 0LU; | |
for (; i < this.trailing.length; i += 1LU) | |
{ | |
{ | |
if (cast(int)this.trailing[i] != 37) | |
continue; | |
put(writer, this.trailing[0..i]); | |
this.trailing = this.trailing[i..__dollar]; | |
enforceEx(this.trailing.length >= 2LU, delegate string() => "Unterminated format specifier: \"%\"", "/usr/include/dmd/phobos/std/format.d", 1103LU); | |
this.trailing = this.trailing[1..__dollar]; | |
if (cast(int)this.trailing[0] != 37) | |
{ | |
this.fillUp(); | |
return true; | |
} | |
i = 0LU; | |
} | |
} | |
} | |
put(writer, this.trailing); | |
this.trailing = null; | |
return false; | |
} | |
put!(Appender!(char[]), const(char)[]) | |
pure nothrow @safe void put(ref Appender!(char[]) r, const(char)[] e) | |
{ | |
doPut(r, e); | |
} | |
doPut!(Appender!(char[]), const(char)[]) | |
pure nothrow @safe void doPut(ref Appender!(char[]) r, ref const(char)[] e) | |
{ | |
enum bool usingPut = true; | |
r.put(e); | |
} | |
hasMember!(Appender!(char[]), "put") | |
enum bool hasMember = true; | |
canPutItem!(const(char)[]) | |
enum bool canPutItem = false; | |
isImplicitlyConvertible!(const(char)[], char) | |
enum bool isImplicitlyConvertible = false; | |
canPutConstRange!(const(char)[]) | |
enum bool canPutConstRange = false; | |
canPutRange!(const(char)[]) | |
enum bool canPutRange = true; | |
canPutItem!dchar | |
enum bool canPutItem = true; | |
isImplicitlyConvertible!(dchar, char) | |
enum bool isImplicitlyConvertible = false; | |
canPutConstRange!dchar | |
enum bool canPutConstRange = false; | |
canPutRange!dchar | |
enum bool canPutRange = false; | |
put!dchar | |
pure @safe void put(dchar item) | |
{ | |
assert(&this, "null this"); | |
import std.utf : encode; | |
char[4] encoded = '\xff'; | |
ulong len = encode(encoded, item); | |
this.put(encoded[0..len]); | |
} | |
canPutItem!(char[]) | |
enum bool canPutItem = false; | |
isImplicitlyConvertible!(char[], char) | |
enum bool isImplicitlyConvertible = false; | |
canPutConstRange!(char[]) | |
enum bool canPutConstRange = false; | |
canPutRange!(char[]) | |
enum bool canPutRange = true; | |
put!(char[]) | |
pure nothrow @safe void put(char[] items) | |
{ | |
assert(&this, "null this"); | |
auto pure nothrow @trusted char[] bigDataFun(ulong extra) | |
{ | |
this.ensureAddable(extra); | |
return (cast(char*)(*this._data).arr)[0..(*this._data).arr.length + extra]; | |
} | |
char[] bigData = bigDataFun(items.length); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) newlen = bigData.length; | |
alias UT = char; | |
bigData[len..newlen] = items[]; | |
(*this._data).arr = bigData; | |
} | |
put!(const(char)[]) | |
pure nothrow @safe void put(const(char)[] items) | |
{ | |
assert(&this, "null this"); | |
auto pure nothrow @trusted char[] bigDataFun(ulong extra) | |
{ | |
this.ensureAddable(extra); | |
return (cast(char*)(*this._data).arr)[0..(*this._data).arr.length + extra]; | |
} | |
char[] bigData = bigDataFun(items.length); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) newlen = bigData.length; | |
alias UT = char; | |
bigData[len..newlen] = items[]; | |
(*this._data).arr = bigData; | |
} | |
text!(const(char)[]) | |
pure nothrow @safe string text(const(char)[] _param_0) | |
{ | |
return textImpl(_param_0); | |
} | |
textImpl!(string, const(char)[]) | |
pure nothrow @safe string textImpl(const(char)[] _param_0) | |
{ | |
return to(_param_0); | |
} | |
assertThrown!(FormatException, bool) | |
pure @safe void assertThrown(lazy bool expression, string msg = null, string file = __FILE__, ulong line = cast(ulong)__LINE__) | |
{ | |
import core.exception : AssertError; | |
try | |
expression(); | |
catch(FormatException) | |
{ | |
return ; | |
} | |
throw new AssertError("assertThrown failed: No FormatException was thrown" ~ (msg.length == 0LU ? "." : ": ") ~ msg, file, line, null); | |
} | |
isAggregateType!(const(ubyte)) | |
enum bool isAggregateType = false; | |
OriginalType!(const(ubyte)) | |
alias OriginalType = const(ubyte); | |
ModifyTypePreservingTQ!(Impl, const(ubyte)) | |
alias ModifyTypePreservingTQ = const const(ubyte); | |
Modifier!ubyte | |
alias Impl = ubyte; | |
Unqual!(const(ubyte)) | |
alias Unqual = ubyte; | |
IntegralTypeOf!(const(ubyte)) | |
alias IntegralTypeOf = const(ubyte); | |
hasToString!(const(ubyte), char) | |
enum int hasToString = 0; | |
isPointer!(const(ubyte)) | |
enum bool isPointer = false; | |
isDelegate!(const(ubyte)) | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, const(ubyte), char) | |
pure @safe void formatValue(Appender!string w, const(ubyte) obj, ref const(FormatSpec!char) f) | |
{ | |
alias U = const(ubyte); | |
const const(ubyte) val = obj; | |
if (cast(int)f.spec == 114) | |
{ | |
scope const(char)[] raw = (*function (return ref const(ubyte) val) => (cast(const(char*))&val)[0..1])(val); | |
if (needToSwapEndianess(f)) | |
{ | |
{ | |
scope const(char)[] __r2442 = raw[]; | |
ulong __key2443 = __r2442.length; | |
for (; __key2443--;) | |
{ | |
const const(char) c = __r2442[__key2443]; | |
put(w, c); | |
} | |
} | |
} | |
else | |
{ | |
{ | |
scope const(char)[] __r2444 = raw[]; | |
ulong __key2445 = 0LU; | |
for (; __key2445 < __r2444.length; __key2445 += 1LU) | |
{ | |
const const(char) c = __r2444[__key2445]; | |
put(w, c); | |
} | |
} | |
} | |
return ; | |
} | |
immutable immutable(uint) base = cast(int)f.spec == 120 || cast(int)f.spec == 88 ? 16u : cast(int)f.spec == 111 ? 8u : cast(int)f.spec == 98 ? 2u : cast(int)f.spec == 115 || cast(int)f.spec == 100 || cast(int)f.spec == 117 ? 10u : 0u; | |
enforceEx(base > 0u, delegate string() => "integral", "/usr/include/dmd/phobos/std/format.d", 1744LU); | |
alias C = ulong; | |
formatIntegral(w, cast(ulong)val, f, base, 255LU); | |
} | |
__lambda4!(const(ubyte)) | |
function (return ref const(ubyte) val) => (cast(const(char*))&val)[0..1]isSigned!(const(ubyte)) | |
enum bool isSigned = false; | |
Unsigned!(const(ubyte)) | |
alias Unsigned = const(ubyte); | |
ModifyTypePreservingTQ!(Impl, const(ubyte)) | |
alias ModifyTypePreservingTQ = const const(ubyte); | |
Modifier!ubyte | |
alias Impl = ubyte; | |
isAggregateType!(const(int)) | |
enum bool isAggregateType = false; | |
OriginalType!(const(int)) | |
alias OriginalType = const(int); | |
ModifyTypePreservingTQ!(Impl, const(int)) | |
alias ModifyTypePreservingTQ = const const(int); | |
Modifier!int | |
alias Impl = int; | |
Unqual!(const(int)) | |
alias Unqual = int; | |
IntegralTypeOf!(const(int)) | |
alias IntegralTypeOf = const(int); | |
hasToString!(const(int), char) | |
enum int hasToString = 0; | |
isPointer!(const(int)) | |
enum bool isPointer = false; | |
staticIndexOf!(int, float, double, real) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(int, float, double, real) | |
isSame!(int, float) | |
enum bool isSame = false; | |
genericIndexOf!(int, double, real) | |
isSame!(int, double) | |
enum bool isSame = false; | |
genericIndexOf!(int, real) | |
isSame!(int, real) | |
enum bool isSame = false; | |
isDelegate!(const(int)) | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, const(int), char) | |
pure @safe void formatValue(Appender!string w, const(int) obj, ref const(FormatSpec!char) f) | |
{ | |
alias U = const(int); | |
const const(int) val = obj; | |
if (cast(int)f.spec == 114) | |
{ | |
scope const(char)[] raw = (*function (return ref const(int) val) => (cast(const(char*))&val)[0..4])(val); | |
if (needToSwapEndianess(f)) | |
{ | |
{ | |
scope const(char)[] __r2451 = raw[]; | |
ulong __key2452 = __r2451.length; | |
for (; __key2452--;) | |
{ | |
const const(char) c = __r2451[__key2452]; | |
put(w, c); | |
} | |
} | |
} | |
else | |
{ | |
{ | |
scope const(char)[] __r2453 = raw[]; | |
ulong __key2454 = 0LU; | |
for (; __key2454 < __r2453.length; __key2454 += 1LU) | |
{ | |
const const(char) c = __r2453[__key2454]; | |
put(w, c); | |
} | |
} | |
} | |
return ; | |
} | |
immutable immutable(uint) base = cast(int)f.spec == 120 || cast(int)f.spec == 88 ? 16u : cast(int)f.spec == 111 ? 8u : cast(int)f.spec == 98 ? 2u : cast(int)f.spec == 115 || cast(int)f.spec == 100 || cast(int)f.spec == 117 ? 10u : 0u; | |
enforceEx(base > 0u, delegate string() => "integral", "/usr/include/dmd/phobos/std/format.d", 1744LU); | |
alias C = long; | |
formatIntegral(w, cast(long)val, f, base, 4294967295LU); | |
} | |
__lambda4!(const(int)) | |
function (return ref const(int) val) => (cast(const(char*))&val)[0..4]isSigned!(const(int)) | |
enum bool isSigned = true; | |
Unsigned!(const(int)) | |
alias Unsigned = const(uint); | |
ModifyTypePreservingTQ!(Impl, const(int)) | |
alias ModifyTypePreservingTQ = const const(uint); | |
Modifier!int | |
alias Impl = uint; | |
formatIntegral!(Appender!string, long, char) | |
pure nothrow @safe void formatIntegral(Appender!string w, const(long) val, ref const(FormatSpec!char) fs, uint base, ulong mask) | |
{ | |
long arg = val; | |
immutable immutable(bool) negative = base == 10u && arg < 0L; | |
if (negative) | |
{ | |
arg = -arg; | |
} | |
formatUnsigned(w, cast(ulong)arg & mask, fs, base, negative); | |
} | |
isDynamicArray!(const(char)[]) | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!(const(char)[]) | |
alias DynamicArrayTypeOf = const(char)[]; | |
appender!(const(char)[]) | |
pure nothrow @safe Appender!(const(char)[]) appender() | |
{ | |
return Appender(null).this(null); | |
} | |
Appender!(const(char)[]) | |
struct Appender | |
{ | |
import core.memory : GC; | |
private alias T = const(char); | |
private struct Data | |
{ | |
ulong capacity; | |
char[] arr; | |
bool canExtend = false; | |
} | |
private Data* _data; | |
pure nothrow @trusted this(const(char)[] arr) | |
{ | |
this._data = new Data(0LU, null, false); | |
(*this._data).arr = arr; | |
if (__ctfe) | |
return this; | |
(*this._data).capacity = arr.length; | |
return this; | |
} | |
pure nothrow @safe void reserve(ulong newCapacity) | |
{ | |
assert(&this, "null this"); | |
if (this._data) | |
{ | |
if (newCapacity > (*this._data).capacity) | |
this.ensureAddable(newCapacity - (*this._data).arr.length); | |
} | |
else | |
{ | |
this.ensureAddable(newCapacity); | |
} | |
} | |
const pure nothrow @nogc @property @safe ulong capacity() | |
{ | |
assert(&this, "null this"); | |
return this._data ? (*this._data).capacity : 0LU; | |
} | |
inout pure nothrow @nogc @property @trusted inout(const(char))[] data() | |
{ | |
assert(&this, "null this"); | |
return this._data ? (*this._data).arr : null; | |
} | |
private pure nothrow @trusted void ensureAddable(ulong nelems) | |
{ | |
if (!this._data) | |
this._data = new Data(0LU, null, false); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) reqlen = len + nelems; | |
if ((*this._data).capacity >= reqlen) | |
return ; | |
if (__ctfe) | |
{ | |
(*this._data).arr.length = reqlen; | |
(*this._data).arr = (*this._data).arr[0..len]; | |
(*this._data).capacity = reqlen; | |
} | |
else | |
{ | |
ulong newlen = appenderNewCapacity((*this._data).capacity, reqlen); | |
if ((*this._data).canExtend) | |
{ | |
immutable immutable(ulong) u = extend(cast(void*)cast(char*)(*this._data).arr, nelems * 1LU, (newlen - len) * 1LU, null); | |
if (u) | |
{ | |
(*this._data).capacity = u / 1LU; | |
return ; | |
} | |
} | |
import core.checkedint : mulu; | |
bool overflow = false; | |
const const(ulong) nbytes = mulu(newlen, 1LU, overflow); | |
if (overflow) | |
assert(0); | |
BlkInfo_ bi = qalloc(nbytes, 2u, null); | |
(*this._data).capacity = bi.size / 1LU; | |
import core.stdc.string : memcpy; | |
if (len) | |
memcpy(bi.base, cast(const(void*))cast(char*)(*this._data).arr, len * 1LU); | |
(*this._data).arr = (cast(char*)bi.base)[0..len]; | |
(*this._data).canExtend = true; | |
} | |
} | |
private enum bool canPutItem(U) = isImplicitlyConvertible!(U, T) | |
|| isSomeChar!T | |
&& isSomeChar!U | |
; | |
private enum bool canPutConstRange(Range) = isInputRange!(Unqual!Range | |
) | |
&& !isInputRange!Range | |
; | |
private enum bool canPutRange(Range) = isInputRange!Range | |
&& is(typeof(Appender.init.put(Range.init.front))); | |
void put(U)(U item) if (canPutItem!U | |
) | |
{ | |
static if (isSomeChar!T | |
&& isSomeChar!U | |
&& T.sizeof < U.sizeof) | |
{ | |
import std.utf : encode; | |
Unqual!T | |
[T.sizeof == 1 ? 4 : 2] encoded; | |
auto len = encode(encoded, item); | |
put(encoded[0..len]); | |
} | |
else | |
{ | |
import std.conv : emplaceRef; | |
ensureAddable(1); | |
immutable len = _data.arr.length; | |
auto bigData = () => _data.arr.ptr[0..len + 1](); | |
emplaceRef!(Unqual!T | |
) | |
(bigData[len], cast(Unqual!T | |
)item); | |
_data.arr = bigData; | |
} | |
} | |
void put(Range)(Range items) if (canPutConstRange!Range | |
) | |
{ | |
alias p = put!(Unqual!Range | |
) | |
; | |
p(items); | |
} | |
void put(Range)(Range items) if (canPutRange!Range | |
) | |
{ | |
static if (!(isSomeChar!T | |
&& isSomeChar!(ElementType!Range | |
) | |
&& !is(immutable(Range) == immutable(T[]))) && is(typeof(items.length) == size_t)) | |
{ | |
static if (!isSomeChar!T | |
) | |
{ | |
if (items.length == 1) | |
{ | |
put(items.front); | |
return ; | |
} | |
} | |
auto @trusted bigDataFun(size_t extra) | |
{ | |
ensureAddable(extra); | |
return _data.arr.ptr[0.._data.arr.length + extra]; | |
} | |
auto bigData = bigDataFun(items.length); | |
immutable len = _data.arr.length; | |
immutable newlen = bigData.length; | |
alias UT = Unqual!T | |
; | |
static if (is(typeof(_data.arr[] = items[])) && !hasElaborateAssign!UT | |
&& isAssignable!(UT, ElementEncodingType!Range | |
) | |
) | |
{ | |
bigData[len..newlen] = items[]; | |
} | |
else | |
{ | |
import std.conv : emplaceRef; | |
foreach (ref it; bigData[len..newlen]) | |
{ | |
emplaceRef!T | |
(it, items.front); | |
items.popFront(); | |
} | |
} | |
_data.arr = bigData; | |
} | |
else | |
{ | |
for (; !items.empty; items.popFront()) | |
{ | |
{ | |
put(items.front); | |
} | |
} | |
} | |
} | |
void opOpAssign(string op : "~", U)(U rhs) if (__traits(compiles, put(rhs))) | |
{ | |
put(rhs); | |
} | |
static if (isMutable!(const(char)) | |
enum bool isMutable = false; | |
) | |
{ | |
pure nothrow @trusted void clear() | |
{ | |
if (_data) | |
{ | |
_data.arr = _data.arr.ptr[0..0]; | |
} | |
} | |
pure @trusted void shrinkTo(size_t newlength) | |
{ | |
import std.exception : enforce; | |
if (_data) | |
{ | |
enforce(newlength <= _data.arr.length, "Attempting to shrink Appender with newlength > length"); | |
_data.arr = _data.arr.ptr[0..newlength]; | |
} | |
else | |
enforce(newlength == 0, "Attempting to shrink empty Appender with non-zero newlength"); | |
} | |
} | |
void toString(Writer)(scope Writer w) | |
{ | |
import std.format : formattedWrite; | |
w.formattedWrite((typeof(this)).stringof ~ "(%s)", data); | |
} | |
} | |
isMutable!(const(char)) | |
enum bool isMutable = false; | |
static __gshared TypeInfo_Struct _D53TypeInfo_S3std5array17__T8AppenderTAxaZ8Appender4Data6__initZ; | |
canPutItem!char | |
enum bool canPutItem = true; | |
isImplicitlyConvertible!(char, const(char)) | |
enum bool isImplicitlyConvertible = true; | |
canPutConstRange!char | |
enum bool canPutConstRange = false; | |
canPutRange!char | |
enum bool canPutRange = false; | |
put!char | |
pure nothrow @safe void put(char item) | |
{ | |
assert(&this, "null this"); | |
import std.conv : emplaceRef; | |
this.ensureAddable(1LU); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
char[] bigData = delegate () => (cast(char*)(*this._data).arr)[0..len + 1LU](); | |
emplaceRef(bigData[len], item); | |
(*this._data).arr = bigData; | |
} | |
blockAttribute!(const(char)) | |
enum BlkAttr blockAttribute = BlkAttr.NO_SCAN; | |
hasIndirections!(const(char)) | |
enum bool hasIndirections = false; | |
isStaticArray!(const(char)) | |
enum bool isStaticArray = false; | |
isFunctionPointer!(const(char)) | |
enum bool isFunctionPointer = false; | |
isPointer!(const(char)) | |
enum bool isPointer = false; | |
isDelegate!(const(char)) | |
enum bool isDelegate = false; | |
isDynamicArray!(const(char)) | |
enum bool isDynamicArray = false; | |
isAssociativeArray!(const(char)) | |
enum bool isAssociativeArray = false; | |
canPutItem!dchar | |
enum bool canPutItem = true; | |
isImplicitlyConvertible!(dchar, const(char)) | |
enum bool isImplicitlyConvertible = false; | |
canPutConstRange!dchar | |
enum bool canPutConstRange = false; | |
canPutRange!dchar | |
enum bool canPutRange = false; | |
put!dchar | |
pure @safe void put(dchar item) | |
{ | |
assert(&this, "null this"); | |
import std.utf : encode; | |
char[4] encoded = '\xff'; | |
ulong len = encode(encoded, item); | |
this.put(encoded[0..len]); | |
} | |
canPutItem!(char[]) | |
enum bool canPutItem = false; | |
isImplicitlyConvertible!(char[], const(char)) | |
enum bool isImplicitlyConvertible = false; | |
canPutConstRange!(char[]) | |
enum bool canPutConstRange = false; | |
canPutRange!(char[]) | |
enum bool canPutRange = true; | |
put!(char[]) | |
pure nothrow @safe void put(char[] items) | |
{ | |
assert(&this, "null this"); | |
auto pure nothrow @trusted char[] bigDataFun(ulong extra) | |
{ | |
this.ensureAddable(extra); | |
return (cast(char*)(*this._data).arr)[0..(*this._data).arr.length + extra]; | |
} | |
char[] bigData = bigDataFun(items.length); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) newlen = bigData.length; | |
alias UT = char; | |
bigData[len..newlen] = items[]; | |
(*this._data).arr = bigData; | |
} | |
text!(string, void*, string, int, string, int, string, char, string, ubyte, string, ubyte, string, bool, string, bool, string, bool, string, bool, string, bool, string, const(char)[], string, const(char)[], string) | |
pure @safe string text(string _param_0, void* _param_1, string _param_2, int _param_3, string _param_4, int _param_5, string _param_6, char _param_7, string _param_8, ubyte _param_9, string _param_10, ubyte _param_11, string _param_12, bool _param_13, string _param_14, bool _param_15, string _param_16, bool _param_17, string _param_18, bool _param_19, string _param_20, bool _param_21, string _param_22, const(char)[] _param_23, string _param_24, const(char)[] _param_25, string _param_26) | |
{ | |
return textImpl(_param_0, _param_1, _param_2, _param_3, _param_4, _param_5, _param_6, _param_7, _param_8, _param_9, _param_10, _param_11, _param_12, _param_13, _param_14, _param_15, _param_16, _param_17, _param_18, _param_19, _param_20, _param_21, _param_22, _param_23, _param_24, _param_25, _param_26); | |
} | |
textImpl!(string, string, void*, string, int, string, int, string, char, string, ubyte, string, ubyte, string, bool, string, bool, string, bool, string, bool, string, bool, string, const(char)[], string, const(char)[], string) | |
pure @safe string textImpl(string _param_0, void* _param_1, string _param_2, int _param_3, string _param_4, int _param_5, string _param_6, char _param_7, string _param_8, ubyte _param_9, string _param_10, ubyte _param_11, string _param_12, bool _param_13, string _param_14, bool _param_15, string _param_16, bool _param_17, string _param_18, bool _param_19, string _param_20, bool _param_21, string _param_22, const(char)[] _param_23, string _param_24, const(char)[] _param_25, string _param_26) | |
{ | |
import std.array : appender; | |
Appender!string app = appender(); | |
app.reserve(540LU); | |
unrolled { | |
{ | |
string arg = _param_0; | |
app.put(to(arg)); | |
} | |
{ | |
void* arg = _param_1; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_2; | |
app.put(to(arg)); | |
} | |
{ | |
int arg = _param_3; | |
app.put(toChars(arg)); | |
} | |
{ | |
string arg = _param_4; | |
app.put(to(arg)); | |
} | |
{ | |
int arg = _param_5; | |
app.put(toChars(arg)); | |
} | |
{ | |
string arg = _param_6; | |
app.put(to(arg)); | |
} | |
{ | |
char arg = _param_7; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_8; | |
app.put(to(arg)); | |
} | |
{ | |
ubyte arg = _param_9; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_10; | |
app.put(to(arg)); | |
} | |
{ | |
ubyte arg = _param_11; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_12; | |
app.put(to(arg)); | |
} | |
{ | |
bool arg = _param_13; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_14; | |
app.put(to(arg)); | |
} | |
{ | |
bool arg = _param_15; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_16; | |
app.put(to(arg)); | |
} | |
{ | |
bool arg = _param_17; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_18; | |
app.put(to(arg)); | |
} | |
{ | |
bool arg = _param_19; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_20; | |
app.put(to(arg)); | |
} | |
{ | |
bool arg = _param_21; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_22; | |
app.put(to(arg)); | |
} | |
{ | |
const(char)[] arg = _param_23; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_24; | |
app.put(to(arg)); | |
} | |
{ | |
const(char)[] arg = _param_25; | |
app.put(to(arg)); | |
} | |
{ | |
string arg = _param_26; | |
app.put(to(arg)); | |
} | |
} | |
return app.data(); | |
} | |
Unqual!(void*) | |
alias Unqual = void*; | |
isStaticArray!(void*) | |
enum bool isStaticArray = false; | |
to!(void*) | |
pure @safe string to(void* _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(void*, string) | |
enum bool isImplicitlyConvertible = false; | |
isInfinite!(void*) | |
enum bool isInfinite = false; | |
isInputRange!(void*) | |
enum bool isInputRange = false; | |
isNumeric!(void*) | |
enum bool isNumeric = false; | |
isSomeChar!(void*) | |
enum bool isSomeChar = false; | |
isAggregateType!(void*) | |
enum bool isAggregateType = false; | |
OriginalType!(void*) | |
alias OriginalType = void*; | |
ModifyTypePreservingTQ!(Impl, void*) | |
alias ModifyTypePreservingTQ = void*; | |
Modifier!(void*) | |
alias Impl = void*; | |
staticIndexOf!(void*, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(void*, char, wchar, dchar) | |
OldAlias!(void*) | |
alias OldAlias = void*; | |
isSame!(void*, char) | |
enum bool isSame = false; | |
expectType!(void*) | |
genericIndexOf!(void*, wchar, dchar) | |
isSame!(void*, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(void*, dchar) | |
isSame!(void*, dchar) | |
enum bool isSame = false; | |
genericIndexOf!(void*) | |
isBoolean!(void*) | |
enum bool isBoolean = false; | |
isSomeString!(void*) | |
enum bool isSomeString = false; | |
isDynamicArray!(void*) | |
enum bool isDynamicArray = false; | |
isAssociativeArray!(void*) | |
enum bool isAssociativeArray = false; | |
toImpl!(string, void*) | |
pure @safe string toImpl(void* value) | |
{ | |
return toStr(value); | |
} | |
isExactSomeString!(void*) | |
enum bool isExactSomeString = false; | |
isIntegral!(void*) | |
enum bool isIntegral = false; | |
staticIndexOf!(void*, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(void*, byte, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(void*, byte) | |
enum bool isSame = false; | |
genericIndexOf!(void*, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(void*, ubyte) | |
enum bool isSame = false; | |
genericIndexOf!(void*, short, ushort, int, uint, long, ulong) | |
isSame!(void*, short) | |
enum bool isSame = false; | |
genericIndexOf!(void*, ushort, int, uint, long, ulong) | |
isSame!(void*, ushort) | |
enum bool isSame = false; | |
genericIndexOf!(void*, int, uint, long, ulong) | |
isSame!(void*, int) | |
enum bool isSame = false; | |
genericIndexOf!(void*, uint, long, ulong) | |
isSame!(void*, uint) | |
enum bool isSame = false; | |
genericIndexOf!(void*, long, ulong) | |
isSame!(void*, long) | |
enum bool isSame = false; | |
genericIndexOf!(void*, ulong) | |
isSame!(void*, ulong) | |
enum bool isSame = false; | |
isPointer!(void*) | |
enum bool isPointer = true; | |
PointerTarget!(void*) | |
alias PointerTarget = void; | |
isSomeChar!void | |
enum bool isSomeChar = false; | |
staticIndexOf!(void, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(void, char, wchar, dchar) | |
OldAlias!void | |
alias OldAlias = void; | |
isSame!(void, char) | |
enum bool isSame = false; | |
expectType!void | |
genericIndexOf!(void, wchar, dchar) | |
isSame!(void, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(void, dchar) | |
isSame!(void, dchar) | |
enum bool isSame = false; | |
genericIndexOf!void | |
toStr!(string, void*) | |
pure @safe string toStr(void* src) | |
{ | |
import std.format : FormatSpec, formatValue; | |
import std.array : appender; | |
Appender!string w = appender(); | |
FormatSpec!char f = FormatSpec; | |
formatValue(w, src, f); | |
return w.data(); | |
} | |
staticIndexOf!(void*, float, double, real) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(void*, float, double, real) | |
isSame!(void*, float) | |
enum bool isSame = false; | |
genericIndexOf!(void*, double, real) | |
isSame!(void*, double) | |
enum bool isSame = false; | |
genericIndexOf!(void*, real) | |
isSame!(void*, real) | |
enum bool isSame = false; | |
hasToString!(void*, char) | |
enum int hasToString = 0; | |
isDelegate!(void*) | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, void*, char) | |
pure @safe void formatValue(Appender!string w, void* val, ref const(FormatSpec!char) f) | |
{ | |
template SharedOf(T) | |
{ | |
alias SharedOf = T; | |
} | |
const const(void*) p = val; | |
const const(ulong) pnum = delegate () => cast(ulong)p(); | |
if (cast(int)f.spec == 115) | |
{ | |
if (p is null) | |
{ | |
put(w, "null"); | |
return ; | |
} | |
FormatSpec!char fs = f; | |
fs.spec = 'X'; | |
formatValue(w, pnum, fs); | |
} | |
else | |
{ | |
enforceEx(cast(int)f.spec == 88 || cast(int)f.spec == 120, delegate string() => "Expected one of %s, %x or %X for pointer type.", "/usr/include/dmd/phobos/std/format.d", 3665LU); | |
formatValue(w, pnum, f); | |
} | |
} | |
SharedOf!(void*) | |
alias SharedOf = void*; | |
put!(Appender!string, string) | |
pure nothrow @safe void put(ref Appender!string r, string e) | |
{ | |
doPut(r, e); | |
} | |
doPut!(Appender!string, string) | |
pure nothrow @safe void doPut(ref Appender!string r, ref string e) | |
{ | |
enum bool usingPut = true; | |
r.put(e); | |
} | |
isAggregateType!(const(ulong)) | |
enum bool isAggregateType = false; | |
OriginalType!(const(ulong)) | |
alias OriginalType = const(ulong); | |
ModifyTypePreservingTQ!(Impl, const(ulong)) | |
alias ModifyTypePreservingTQ = const const(ulong); | |
Modifier!ulong | |
alias Impl = ulong; | |
Unqual!(const(ulong)) | |
alias Unqual = ulong; | |
IntegralTypeOf!(const(ulong)) | |
alias IntegralTypeOf = const(ulong); | |
hasToString!(const(ulong), char) | |
enum int hasToString = 0; | |
isPointer!(const(ulong)) | |
enum bool isPointer = false; | |
staticIndexOf!(ulong, float, double, real) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(ulong, float, double, real) | |
isSame!(ulong, float) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, double, real) | |
isSame!(ulong, double) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, real) | |
isSame!(ulong, real) | |
enum bool isSame = false; | |
isDelegate!(const(ulong)) | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, const(ulong), char) | |
pure @safe void formatValue(Appender!string w, const(ulong) obj, ref const(FormatSpec!char) f) | |
{ | |
alias U = const(ulong); | |
const const(ulong) val = obj; | |
if (cast(int)f.spec == 114) | |
{ | |
scope const(char)[] raw = (*function (return ref const(ulong) val) => (cast(const(char*))&val)[0..8])(val); | |
if (needToSwapEndianess(f)) | |
{ | |
{ | |
scope const(char)[] __r2471 = raw[]; | |
ulong __key2472 = __r2471.length; | |
for (; __key2472--;) | |
{ | |
const const(char) c = __r2471[__key2472]; | |
put(w, c); | |
} | |
} | |
} | |
else | |
{ | |
{ | |
scope const(char)[] __r2473 = raw[]; | |
ulong __key2474 = 0LU; | |
for (; __key2474 < __r2473.length; __key2474 += 1LU) | |
{ | |
const const(char) c = __r2473[__key2474]; | |
put(w, c); | |
} | |
} | |
} | |
return ; | |
} | |
immutable immutable(uint) base = cast(int)f.spec == 120 || cast(int)f.spec == 88 ? 16u : cast(int)f.spec == 111 ? 8u : cast(int)f.spec == 98 ? 2u : cast(int)f.spec == 115 || cast(int)f.spec == 100 || cast(int)f.spec == 117 ? 10u : 0u; | |
enforceEx(base > 0u, delegate string() => "integral", "/usr/include/dmd/phobos/std/format.d", 1744LU); | |
alias C = ulong; | |
formatIntegral(w, val, f, base, 18446744073709551615LU); | |
} | |
__lambda4!(const(ulong)) | |
function (return ref const(ulong) val) => (cast(const(char*))&val)[0..8]isSigned!(const(ulong)) | |
enum bool isSigned = false; | |
Unsigned!(const(ulong)) | |
alias Unsigned = const(ulong); | |
ModifyTypePreservingTQ!(Impl, const(ulong)) | |
alias ModifyTypePreservingTQ = const const(ulong); | |
Modifier!ulong | |
alias Impl = ulong; | |
toChars!(cast(ubyte)10u, char, LetterCase.lower, int) | |
auto pure nothrow @nogc @safe Result toChars(int value) | |
{ | |
alias UT = int; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe void initialize(int value) | |
{ | |
assert(&this, "null this"); | |
bool neg = false; | |
if (value < 10) | |
{ | |
if (value >= 0) | |
{ | |
this.lwr = 0u; | |
this.upr = 1u; | |
this.buf[0] = cast(char)(cast(uint)value + 48u); | |
return ; | |
} | |
value = -value; | |
neg = true; | |
} | |
uint i = 10u; | |
for (; cast(uint)value >= 10u;) | |
{ | |
{ | |
this.buf[cast(ulong)i] = cast(char)cast(ubyte)(48u + cast(uint)value % 10u); | |
value = cast(int)(unsigned(value) / 10u); | |
i -= 1u; | |
} | |
} | |
this.buf[cast(ulong)i] = cast(char)(cast(uint)value + 48u); | |
if (neg) | |
{ | |
this.buf[cast(ulong)(i - 1u)] = '-'; | |
i -= 1u; | |
} | |
this.lwr = i; | |
this.upr = 11u; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.upr - this.lwr); | |
} | |
alias opDollar = pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.upr - this.lwr); | |
} | |
; | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this.upr == this.lwr; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.buf[cast(ulong)this.lwr]; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
this.lwr += 1u; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.buf[cast(ulong)(this.upr - 1u)]; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.upr -= 1u; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
return this.buf[cast(ulong)this.lwr + i]; | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.buf = this.buf; | |
result.lwr = cast(uint)(cast(ulong)this.lwr + lwr); | |
result.upr = cast(uint)(cast(ulong)this.lwr + upr); | |
return result; | |
} | |
private | |
{ | |
uint lwr = void; | |
uint upr = void; | |
char[11] buf = void; | |
} | |
} | |
Result result = void; | |
result.initialize(value); | |
return result; | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
canPutItem!(Result) | |
enum bool canPutItem = false; | |
isImplicitlyConvertible!(Result, immutable(char)) | |
enum bool isImplicitlyConvertible = false; | |
isSomeChar!(Result) | |
enum bool isSomeChar = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
OriginalType!(Result) | |
alias OriginalType = Result; | |
ModifyTypePreservingTQ!(Impl, Result) | |
alias ModifyTypePreservingTQ = Result; | |
Modifier!(Result) | |
alias Impl = Result; | |
Unqual!(Result) | |
alias Unqual = Result; | |
staticIndexOf!(Result, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(Result, char, wchar, dchar) | |
OldAlias!(Result) | |
alias OldAlias = Result; | |
isSame!(Result, char) | |
enum bool isSame = false; | |
expectType!(Result) | |
genericIndexOf!(Result, wchar, dchar) | |
isSame!(Result, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(Result, dchar) | |
isSame!(Result, dchar) | |
enum bool isSame = false; | |
genericIndexOf!(Result) | |
canPutConstRange!(Result) | |
enum bool canPutConstRange = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
canPutRange!(Result) | |
enum bool canPutRange = true; | |
put!(Result) | |
pure nothrow @safe void put(Result items) | |
{ | |
assert(&this, "null this"); | |
for (; !items.empty(); items.popFront()) | |
{ | |
{ | |
this.put(items.front()); | |
} | |
} | |
} | |
ElementType!(Result) | |
alias ElementType = char; | |
to!ubyte | |
pure nothrow @safe string to(ubyte _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(ubyte, string) | |
enum bool isImplicitlyConvertible = false; | |
isInfinite!ubyte | |
enum bool isInfinite = false; | |
toImpl!(string, ubyte) | |
pure nothrow @safe string toImpl(ubyte value) | |
{ | |
return toImpl(value, 10u, LetterCase.upper); | |
} | |
toImpl!(string, ubyte) | |
pure nothrow @trusted string toImpl(ubyte value, uint radix, LetterCase letterCase = LetterCase.upper) | |
in | |
{ | |
assert(radix >= 2u && radix <= 36u); | |
} | |
body | |
{ | |
{ | |
assert(radix >= 2u && radix <= 36u); | |
} | |
alias EEType = char; | |
T toStringRadixConvert(ulong bufLen)(uint runtimeRadix = 0) | |
{ | |
Unsigned!(Unqual!S | |
) | |
div = void, mValue = unsigned(value); | |
size_t index = bufLen; | |
EEType[bufLen] buffer = void; | |
char baseChar = letterCase == LetterCase.lower ? 'a' : 'A'; | |
char mod = void; | |
do | |
{ | |
div = cast(S)(mValue / runtimeRadix); | |
mod = cast(ubyte)(mValue % runtimeRadix); | |
mod += mod < 10 ? '0' : baseChar - 10; | |
buffer[--index] = cast(char)mod; | |
mValue = div; | |
} | |
while (mValue); | |
return cast(T)buffer[index..__dollar].dup; | |
} | |
import std.array : array; | |
switch (radix) | |
{ | |
case 10u: | |
{ | |
return array(toChars(cast(int)value + 0)); | |
} | |
case 16u: | |
{ | |
if (cast(int)letterCase == 0) | |
return array(toChars(unsigned(cast(int)unsigned(value) + 0))); | |
else | |
return array(toChars(unsigned(cast(int)unsigned(value) + 0))); | |
} | |
case 2u: | |
{ | |
return array(toChars(unsigned(cast(int)unsigned(value) + 0))); | |
} | |
case 8u: | |
{ | |
return array(toChars(unsigned(cast(int)unsigned(value) + 0))); | |
} | |
default: | |
{ | |
return toStringRadixConvert(radix); | |
} | |
} | |
} | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2481 = r; | |
for (; !__r2481.empty(); __r2481.popFront()) | |
{ | |
char e = __r2481.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2482 = r; | |
for (; !__r2482.empty(); __r2482.popFront()) | |
{ | |
char e = __r2482.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
isSomeChar!ubyte | |
enum bool isSomeChar = false; | |
unsigned!ubyte | |
auto pure nothrow @nogc @safe ubyte unsigned(ubyte x) | |
{ | |
return x; | |
} | |
toChars!(16, char, LetterCase.upper, uint) | |
auto pure nothrow @nogc @safe Result toChars(uint value) | |
{ | |
alias UT = uint; | |
enum int SHIFT = 4; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe this(uint value) | |
{ | |
this.value = value; | |
ubyte len = cast(ubyte)1u; | |
for (; value >>>= 4;) | |
{ | |
cast(int)len += 1; | |
} | |
this.len = len; | |
return this; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)this.len; | |
} | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.len == 0; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(0LU); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(cast(ulong)(cast(int)this.len - 1)); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.value >>>= 4; | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
char c = cast(char)(this.value >>> cast(int)((cast(ulong)cast(int)this.len - i - 1LU) * 4LU) & 15u); | |
return cast(bool)(cast(int)c < 10) ? cast(char)(cast(int)c + 48) : cast(char)(cast(int)c + 65 - 10); | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.value = this.value >>> cast(int)((cast(ulong)cast(int)this.len - upr) * 4LU); | |
result.len = cast(ubyte)(upr - lwr); | |
return result; | |
} | |
private | |
{ | |
uint value; | |
ubyte len; | |
} | |
} | |
return Result(0u, cast(ubyte)0u).this(value); | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2485 = r; | |
for (; !__r2485.empty(); __r2485.popFront()) | |
{ | |
char e = __r2485.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2486 = r; | |
for (; !__r2486.empty(); __r2486.popFront()) | |
{ | |
char e = __r2486.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
toChars!(16, char, LetterCase.lower, uint) | |
auto pure nothrow @nogc @safe Result toChars(uint value) | |
{ | |
alias UT = uint; | |
enum int SHIFT = 4; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe this(uint value) | |
{ | |
this.value = value; | |
ubyte len = cast(ubyte)1u; | |
for (; value >>>= 4;) | |
{ | |
cast(int)len += 1; | |
} | |
this.len = len; | |
return this; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)this.len; | |
} | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.len == 0; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(0LU); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(cast(ulong)(cast(int)this.len - 1)); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.value >>>= 4; | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
char c = cast(char)(this.value >>> cast(int)((cast(ulong)cast(int)this.len - i - 1LU) * 4LU) & 15u); | |
return cast(bool)(cast(int)c < 10) ? cast(char)(cast(int)c + 48) : cast(char)(cast(int)c + 97 - 10); | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.value = this.value >>> cast(int)((cast(ulong)cast(int)this.len - upr) * 4LU); | |
result.len = cast(ubyte)(upr - lwr); | |
return result; | |
} | |
private | |
{ | |
uint value; | |
ubyte len; | |
} | |
} | |
return Result(0u, cast(ubyte)0u).this(value); | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2489 = r; | |
for (; !__r2489.empty(); __r2489.popFront()) | |
{ | |
char e = __r2489.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2490 = r; | |
for (; !__r2490.empty(); __r2490.popFront()) | |
{ | |
char e = __r2490.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
toChars!(2, char, LetterCase.lower, uint) | |
auto pure nothrow @nogc @safe Result toChars(uint value) | |
{ | |
alias UT = uint; | |
enum int SHIFT = 1; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe this(uint value) | |
{ | |
this.value = value; | |
ubyte len = cast(ubyte)1u; | |
for (; value >>>= 1;) | |
{ | |
cast(int)len += 1; | |
} | |
this.len = len; | |
return this; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)this.len; | |
} | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.len == 0; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(0LU); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(cast(ulong)(cast(int)this.len - 1)); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.value >>>= 1; | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
char c = cast(char)(this.value >>> cast(int)((cast(ulong)cast(int)this.len - i - 1LU) * 1LU) & 1u); | |
return cast(char)(cast(int)c + 48); | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.value = this.value >>> cast(int)((cast(ulong)cast(int)this.len - upr) * 1LU); | |
result.len = cast(ubyte)(upr - lwr); | |
return result; | |
} | |
private | |
{ | |
uint value; | |
ubyte len; | |
} | |
} | |
return Result(0u, cast(ubyte)0u).this(value); | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2493 = r; | |
for (; !__r2493.empty(); __r2493.popFront()) | |
{ | |
char e = __r2493.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2494 = r; | |
for (; !__r2494.empty(); __r2494.popFront()) | |
{ | |
char e = __r2494.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
toChars!(8, char, LetterCase.lower, uint) | |
auto pure nothrow @nogc @safe Result toChars(uint value) | |
{ | |
alias UT = uint; | |
enum int SHIFT = 3; | |
static struct Result | |
{ | |
pure nothrow @nogc @safe this(uint value) | |
{ | |
this.value = value; | |
ubyte len = cast(ubyte)1u; | |
for (; value >>>= 3;) | |
{ | |
cast(int)len += 1; | |
} | |
this.len = len; | |
return this; | |
} | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)this.len; | |
} | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.len == 0; | |
} | |
pure nothrow @nogc @property @safe char front() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(0LU); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe char back() | |
{ | |
assert(&this, "null this"); | |
return this.opIndex(cast(ulong)(cast(int)this.len - 1)); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.value >>>= 3; | |
cast(int)this.len -= 1; | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe char opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
char c = cast(char)(this.value >>> cast(int)((cast(ulong)cast(int)this.len - i - 1LU) * 3LU) & 7u); | |
return cast(char)(cast(int)c + 48); | |
} | |
pure nothrow @nogc @safe Result opSlice(ulong lwr, ulong upr) | |
{ | |
assert(&this, "null this"); | |
Result result = void; | |
result.value = this.value >>> cast(int)((cast(ulong)cast(int)this.len - upr) * 3LU); | |
result.len = cast(ubyte)(upr - lwr); | |
return result; | |
} | |
private | |
{ | |
uint value; | |
ubyte len; | |
} | |
} | |
return Result(0u, cast(ubyte)0u).this(value); | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2497 = r; | |
for (; !__r2497.empty(); __r2497.popFront()) | |
{ | |
char e = __r2497.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
ulong length = r.length(); | |
if (length == 0LU) | |
return null; | |
import std.conv : emplaceRef; | |
char[] result = delegate () => uninitializedArray(length)(); | |
ulong i = 0LU; | |
{ | |
Result __r2498 = r; | |
for (; !__r2498.empty(); __r2498.popFront()) | |
{ | |
char e = __r2498.front(); | |
emplaceRef(result[i], e); | |
i += 1LU; | |
} | |
} | |
return delegate () => result(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
toStringRadixConvert!6LU | |
pure nothrow @system string toStringRadixConvert(uint runtimeRadix = 0u) | |
{ | |
ubyte div = void; | |
ubyte mValue = unsigned(value); | |
ulong index = 6LU; | |
char[6] buffer = void; | |
char baseChar = cast(int)letterCase == 1 ? 'a' : 'A'; | |
char mod = void; | |
do | |
{ | |
div = cast(ubyte)(cast(uint)cast(int)mValue / runtimeRadix); | |
mod = cast(char)cast(ubyte)(cast(uint)cast(int)mValue % runtimeRadix); | |
cast(int)mod += cast(int)mod < 10 ? 48 : cast(int)baseChar - 10; | |
buffer[index -= 1LU] = mod; | |
mValue = div; | |
} | |
while (mValue); | |
return cast(string)dup(buffer[index..6]); | |
} | |
Unqual!bool | |
alias Unqual = bool; | |
isStaticArray!bool | |
enum bool isStaticArray = false; | |
to!bool | |
pure nothrow @nogc @safe string to(bool _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(bool, string) | |
enum bool isImplicitlyConvertible = false; | |
isInfinite!bool | |
enum bool isInfinite = false; | |
isInputRange!bool | |
enum bool isInputRange = false; | |
isNumeric!bool | |
enum bool isNumeric = true; | |
isSomeString!bool | |
enum bool isSomeString = false; | |
isAggregateType!bool | |
enum bool isAggregateType = false; | |
isDynamicArray!bool | |
enum bool isDynamicArray = false; | |
OriginalType!bool | |
alias OriginalType = bool; | |
ModifyTypePreservingTQ!(Impl, bool) | |
alias ModifyTypePreservingTQ = bool; | |
Modifier!bool | |
alias Impl = bool; | |
isAssociativeArray!bool | |
enum bool isAssociativeArray = false; | |
toImpl!(string, bool) | |
pure nothrow @nogc @safe string toImpl(bool value) | |
{ | |
return toStr(value); | |
} | |
isExactSomeString!bool | |
enum bool isExactSomeString = false; | |
isIntegral!bool | |
enum bool isIntegral = false; | |
staticIndexOf!(bool, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(bool, byte, ubyte, short, ushort, int, uint, long, ulong) | |
OldAlias!bool | |
alias OldAlias = bool; | |
isSame!(bool, byte) | |
enum bool isSame = false; | |
expectType!bool | |
genericIndexOf!(bool, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(bool, ubyte) | |
enum bool isSame = false; | |
genericIndexOf!(bool, short, ushort, int, uint, long, ulong) | |
isSame!(bool, short) | |
enum bool isSame = false; | |
genericIndexOf!(bool, ushort, int, uint, long, ulong) | |
isSame!(bool, ushort) | |
enum bool isSame = false; | |
genericIndexOf!(bool, int, uint, long, ulong) | |
isSame!(bool, int) | |
enum bool isSame = false; | |
genericIndexOf!(bool, uint, long, ulong) | |
isSame!(bool, uint) | |
enum bool isSame = false; | |
genericIndexOf!(bool, long, ulong) | |
isSame!(bool, long) | |
enum bool isSame = false; | |
genericIndexOf!(bool, ulong) | |
isSame!(bool, ulong) | |
enum bool isSame = false; | |
genericIndexOf!bool | |
isPointer!bool | |
enum bool isPointer = false; | |
toStr!(string, bool) | |
pure nothrow @nogc @safe string toStr(bool src) | |
{ | |
return src ? "true" : "false"; | |
} | |
RTInfo!(FormatSpec!char) | |
enum typeof(null) RTInfo = null; | |
static __gshared TypeInfo_Const _D11TypeInfo_xi6__initZ; | |
static __gshared TypeInfo_Const _D11TypeInfo_xa6__initZ; | |
static __gshared TypeInfo_Const _D11TypeInfo_xh6__initZ; | |
RTInfo!(Data) | |
enum typeof(null) RTInfo = null; | |
isSomeFunction!string | |
enum bool isSomeFunction = false; | |
enforce!(Exception, bool) | |
pure @safe bool enforce(bool value, lazy const(char)[] msg = null, string file = __FILE__, ulong line = cast(ulong)__LINE__) | |
{ | |
if (!value) | |
bailOut(file, line, msg()); | |
return value; | |
} | |
bailOut!(Exception) | |
pure @safe void bailOut(string file, ulong line, const(char[]) msg) | |
{ | |
throw new Exception(msg ? idup(msg) : "Enforcement failed", file, line, null); | |
} | |
RTInfo!(Appender!(char[])) | |
enum typeof(null) RTInfo = null; | |
RTInfo!(Data) | |
enum typeof(null) RTInfo = null; | |
RTInfo!(Appender!(const(char)[])) | |
enum typeof(null) RTInfo = null; | |
format!(char, int) | |
pure @safe string format(const(char[]) fmt, int _param_1) | |
{ | |
import std.format : formattedWrite, FormatException; | |
import std.array : appender; | |
Appender!string w = appender(); | |
uint n = formattedWrite(w, fmt, _param_1); | |
import std.conv : text; | |
import std.exception : enforce; | |
enforce(cast(ulong)n == 1LU, delegate Throwable() => new FormatException(text("Orphan format arguments: args[", n, "..", 1LU, "]"), "/usr/include/dmd/phobos/std/format.d", 5531LU, null)); | |
return w.data(); | |
} | |
formattedWrite!(Appender!string, char, int) | |
pure @safe uint formattedWrite(Appender!string w, const(char[]) fmt, int _param_2) | |
{ | |
import std.conv : text, to; | |
alias FPfmt = void function(Appender!string, scope const(void)*, ref const(FormatSpec!char)) pure nothrow @safe; | |
FormatSpec!char spec = spec = FormatSpec , spec.this(fmt); | |
void function(Appender!string, scope const(void)*, ref const(FormatSpec!char)) pure nothrow @safe[1] funs = null; | |
scope const(void)*[1] argsAddresses = null; | |
if (!__ctfe) | |
{ | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Arg = int; | |
funs[0] = (*function () => & formatGeneric)(); | |
argsAddresses[0] = (*function (return ref int arg) => cast(const(void*))&arg)(_param_2); | |
if (0) | |
formatValue(w, _param_2, spec); | |
} | |
} | |
} | |
uint currentArg = 0u; | |
for (; spec.writeUpToNextSpec(w);) | |
{ | |
{ | |
if (cast(ulong)currentArg == 1LU && !spec.indexStart) | |
{ | |
enforceEx(fmt.length == 0LU, delegate string() => text("Orphan format specifier: %", spec.spec), "/usr/include/dmd/phobos/std/format.d", 477LU); | |
break; | |
} | |
if (spec.width == 2147483647) | |
{ | |
int width = to(getNthInt(currentArg, _param_2)); | |
if (width < 0) | |
{ | |
spec.flDash(true); | |
width = -width; | |
} | |
spec.width = width; | |
currentArg += 1u; | |
} | |
else if (spec.width < 0) | |
{ | |
uint index = cast(uint)-spec.width; | |
assert(index > 0u); | |
int width = to(getNthInt(index - 1u, _param_2)); | |
if (currentArg < index) | |
currentArg = index; | |
if (width < 0) | |
{ | |
spec.flDash(true); | |
width = -width; | |
} | |
spec.width = width; | |
} | |
if (spec.precision == 2147483647) | |
{ | |
int precision = to(getNthInt(currentArg, _param_2)); | |
if (precision >= 0) | |
spec.precision = precision; | |
else | |
spec.precision = 2147483646; | |
currentArg += 1u; | |
} | |
else if (spec.precision < 0) | |
{ | |
uint index = cast(uint)-spec.precision; | |
assert(index > 0u); | |
int precision = to(getNthInt(index - 1u, _param_2)); | |
if (currentArg < index) | |
currentArg = index; | |
if (precision >= 0) | |
spec.precision = precision; | |
else | |
spec.precision = 2147483646; | |
} | |
if (cast(int)spec.indexStart > 0) | |
{ | |
{ | |
int __key2512 = cast(int)spec.indexStart - 1; | |
int __limit2513 = cast(int)spec.indexEnd; | |
for (; __key2512 < __limit2513; __key2512 += 1) | |
{ | |
int i = __key2512; | |
if (1LU <= cast(ulong)i) | |
break; | |
if (__ctfe) | |
formatNth(w, spec, cast(ulong)i, _param_2); | |
else | |
(*funs[cast(ulong)i])(w, argsAddresses[cast(ulong)i], spec); | |
} | |
} | |
if (currentArg < cast(uint)cast(int)spec.indexEnd) | |
currentArg = cast(uint)spec.indexEnd; | |
} | |
else | |
{ | |
if (__ctfe) | |
formatNth(w, spec, cast(ulong)currentArg, _param_2); | |
else | |
(*funs[cast(ulong)currentArg])(w, argsAddresses[cast(ulong)currentArg], spec); | |
currentArg += 1u; | |
} | |
} | |
} | |
return currentArg; | |
} | |
formatGeneric!(Appender!string, int, char) | |
pure @system void formatGeneric(Appender!string w, const(void)* arg, ref const(FormatSpec!char) f) | |
{ | |
formatValue(w, *cast(int*)arg, f); | |
} | |
hasToString!(int, char) | |
enum int hasToString = 0; | |
isPointer!int | |
enum bool isPointer = false; | |
isDelegate!int | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, int, char) | |
pure @safe void formatValue(Appender!string w, int obj, ref const(FormatSpec!char) f) | |
{ | |
alias U = int; | |
int val = obj; | |
if (cast(int)f.spec == 114) | |
{ | |
scope const(char)[] raw = (*function (return ref int val) => (cast(const(char*))&val)[0..4])(val); | |
if (needToSwapEndianess(f)) | |
{ | |
{ | |
scope const(char)[] __r2505 = raw[]; | |
ulong __key2506 = __r2505.length; | |
for (; __key2506--;) | |
{ | |
const const(char) c = __r2505[__key2506]; | |
put(w, c); | |
} | |
} | |
} | |
else | |
{ | |
{ | |
scope const(char)[] __r2507 = raw[]; | |
ulong __key2508 = 0LU; | |
for (; __key2508 < __r2507.length; __key2508 += 1LU) | |
{ | |
const const(char) c = __r2507[__key2508]; | |
put(w, c); | |
} | |
} | |
} | |
return ; | |
} | |
immutable immutable(uint) base = cast(int)f.spec == 120 || cast(int)f.spec == 88 ? 16u : cast(int)f.spec == 111 ? 8u : cast(int)f.spec == 98 ? 2u : cast(int)f.spec == 115 || cast(int)f.spec == 100 || cast(int)f.spec == 117 ? 10u : 0u; | |
enforceEx(base > 0u, delegate string() => "integral", "/usr/include/dmd/phobos/std/format.d", 1744LU); | |
alias C = long; | |
formatIntegral(w, cast(long)val, f, base, 4294967295LU); | |
} | |
__lambda4!int | |
function (return ref int val) => (cast(const(char*))&val)[0..4]__lambda6!int | |
function (return ref int arg) => cast(const(void*))&arggetNthInt!int | |
pure @safe int getNthInt(uint index, int _param_1) | |
{ | |
import std.conv : to; | |
if (index) | |
{ | |
return getNthInt(index - 1u); | |
} | |
return to(_param_1); | |
} | |
formatNth!(Appender!string, char, int) | |
pure @safe void formatNth(Appender!string w, ref const(FormatSpec!char) f, ulong index, int _param_3) | |
{ | |
import std.conv : to; | |
static string gencode(ulong count)() | |
{ | |
string result; | |
foreach (n; 0 .. count) | |
{ | |
auto num = to!string | |
(n); | |
result ~= "case " ~ num ~ ":" ~ " formatValue(w, args[" ~ num ~ "], f);" ~ " break;"; | |
} | |
return result; | |
} | |
switch (index) | |
{ | |
case 0LU: | |
{ | |
formatValue(w, _param_3, f); | |
break; | |
} | |
default: | |
{ | |
assert(0, "n = " ~ cast(char)(index + 48LU)); | |
} | |
} | |
} | |
gencode!1LU | |
static pure nothrow @safe string gencode() | |
{ | |
string result = null; | |
{ | |
ulong __key2514 = 0LU; | |
ulong __limit2515 = 1LU; | |
for (; __key2514 < __limit2515; __key2514 += 1LU) | |
{ | |
ulong n = __key2514; | |
string num = to(n); | |
result ~= "case " ~ num ~ ": formatValue(w, args[" ~ num ~ "], f); break;"; | |
} | |
} | |
return result; | |
} | |
rightJustify!string | |
pure nothrow @safe string rightJustify(string s, ulong width, dchar fillChar = ' ') | |
{ | |
import std.array : array; | |
return array(rightJustifier(s, width, fillChar)); | |
} | |
isForwardRange!string | |
enum bool isForwardRange = true; | |
save!(immutable(char)) | |
pure nothrow @nogc @property @safe string save(string a) | |
{ | |
return a; | |
} | |
isConvertibleToString!string | |
enum bool isConvertibleToString = false; | |
rightJustifier!string | |
auto pure nothrow @nogc @safe Result rightJustifier(string r, ulong width, dchar fillChar = ' ') | |
{ | |
alias C = char; | |
import std.utf : byDchar, byChar; | |
return byUTF(rightJustifier(byUTF(r), width, fillChar)); | |
} | |
byUTF!dchar | |
auto ref byUTF(R)(R r) if (isAutodecodableString!R | |
&& isInputRange!R | |
&& isSomeChar!(ElementEncodingType!R | |
) | |
) | |
{ | |
return byUTF(r.byCodeUnit()); | |
} | |
byUTF!char | |
auto ref byUTF(R)(R r) if (isAutodecodableString!R | |
&& isInputRange!R | |
&& isSomeChar!(ElementEncodingType!R | |
) | |
) | |
{ | |
return byUTF(r.byCodeUnit()); | |
} | |
isAutodecodableString!string | |
enum bool isAutodecodableString = true; | |
byUTF!string | |
auto pure nothrow @nogc @safe Result byUTF(string r) | |
{ | |
return byUTF(byCodeUnit(r)); | |
} | |
byCodeUnit!string | |
auto pure nothrow @nogc @safe ByCodeUnitImpl byCodeUnit(string r) | |
{ | |
static struct ByCodeUnitImpl | |
{ | |
nothrow pure @nogc @safe | |
{ | |
const pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this.str.length == 0LU; | |
} | |
inout pure nothrow @nogc @property ref @safe immutable(char) front() | |
{ | |
assert(&this, "null this"); | |
return this.str[0]; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
this.str = this.str[1..__dollar]; | |
} | |
auto pure nothrow @nogc @property @safe ByCodeUnitImpl save() | |
{ | |
assert(&this, "null this"); | |
return ByCodeUnitImpl(save(this.str)); | |
} | |
inout pure nothrow @nogc @property ref @safe immutable(char) back() | |
{ | |
assert(&this, "null this"); | |
return this.str[__dollar - 1LU]; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.str = this.str[0..__dollar - 1LU]; | |
} | |
inout pure nothrow @nogc ref @safe immutable(char) opIndex(ulong index) | |
{ | |
assert(&this, "null this"); | |
return this.str[index]; | |
} | |
auto pure nothrow @nogc @safe ByCodeUnitImpl opSlice(ulong lower, ulong upper) | |
{ | |
assert(&this, "null this"); | |
return ByCodeUnitImpl(this.str[lower..upper]); | |
} | |
const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return this.str.length; | |
} | |
alias opDollar = const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return this.str.length; | |
} | |
; | |
private nothrow pure @nogc @safe string str; | |
} | |
} | |
return ByCodeUnitImpl(r); | |
} | |
RTInfo!(ByCodeUnitImpl) | |
enum typeof(null) RTInfo = null; | |
static __gshared TypeInfo_Const _D13TypeInfo_xAya6__initZ; | |
isRandomAccessRange!(ByCodeUnitImpl) | |
enum bool isRandomAccessRange = true; | |
isBidirectionalRange!(ByCodeUnitImpl) | |
enum bool isBidirectionalRange = true; | |
isForwardRange!(ByCodeUnitImpl) | |
enum bool isForwardRange = true; | |
isInputRange!(ByCodeUnitImpl) | |
enum bool isInputRange = true; | |
isNarrowString!(ByCodeUnitImpl) | |
enum bool isNarrowString = false; | |
isAggregateType!(ByCodeUnitImpl) | |
enum bool isAggregateType = true; | |
isStaticArray!(ByCodeUnitImpl) | |
enum bool isStaticArray = false; | |
hasLength!(ByCodeUnitImpl) | |
enum bool hasLength = true; | |
isInfinite!(ByCodeUnitImpl) | |
enum bool isInfinite = false; | |
isAutodecodableString!(ByCodeUnitImpl) | |
enum bool isAutodecodableString = false; | |
ElementEncodingType!(ByCodeUnitImpl) | |
alias ElementEncodingType = immutable(char); | |
ElementType!(ByCodeUnitImpl) | |
alias ElementType = immutable(char); | |
byUTF!(ByCodeUnitImpl) | |
auto pure nothrow @nogc @safe Result byUTF(ByCodeUnitImpl r) | |
{ | |
alias RC = char; | |
static struct Result | |
{ | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.pos == cast(int)this.fill && this.r.empty(); | |
} | |
auto pure nothrow @nogc @property scope @safe dchar front() | |
{ | |
assert(&this, "null this"); | |
if (cast(int)this.pos == cast(int)this.fill) | |
{ | |
this.pos = cast(ushort)0u; | |
immutable immutable(char) c = this.r.front(); | |
if (cast(int)c <= 127) | |
{ | |
this.fill = cast(ushort)1u; | |
this.r.popFront(); | |
this.buf[cast(ulong)this.pos] = cast(dchar)c; | |
} | |
else | |
{ | |
dchar dc = delegate () => decodeFront(this.r)(); | |
this.fill = cast(ushort)encode(this.buf, dc); | |
} | |
} | |
return this.buf[cast(ulong)this.pos]; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
if (cast(int)this.pos == cast(int)this.fill) | |
this.front(); | |
cast(int)this.pos += 1; | |
} | |
static if (isForwardRange!(ByCodeUnitImpl) | |
) | |
{ | |
auto pure nothrow @nogc @property return scope @safe Result save() | |
{ | |
assert(&this, "null this"); | |
Result ret = this; | |
ret.r = this.r.save(); | |
return ret; | |
} | |
} | |
private | |
{ | |
ByCodeUnitImpl r; | |
dchar[1] buf = void; | |
ushort pos; | |
ushort fill; | |
} | |
} | |
return Result(r, , cast(ushort)0u, cast(ushort)0u); | |
} | |
opDispatch!"useReplacementDchar" | |
enum Flag opDispatch = Flag.yes; | |
decodeFront!(Flag.yes, ByCodeUnitImpl) | |
pure nothrow @nogc @safe dchar decodeFront(ref ByCodeUnitImpl str) | |
{ | |
ulong numCodeUnits = 0LU; | |
return decodeFront(str, numCodeUnits); | |
} | |
isSomeString!(ByCodeUnitImpl) | |
enum bool isSomeString = false; | |
decodeFront!(Flag.yes, ByCodeUnitImpl) | |
pure nothrow @nogc @safe dchar decodeFront(ref ByCodeUnitImpl str, out ulong numCodeUnits) | |
in | |
{ | |
assert(!str.empty()); | |
} | |
out(result) | |
{ | |
assert(isValidDchar(result)); | |
} | |
body | |
{ | |
numCodeUnits = 0LU; | |
{ | |
assert(!str.empty()); | |
} | |
immutable immutable(char) fst = str.front(); | |
if (cast(int)fst < 128) | |
{ | |
str.popFront(); | |
numCodeUnits = 1LU; | |
result = cast(dchar)fst; | |
goto __returnLabel; | |
} | |
else | |
{ | |
enum bool canIndex = true; | |
immutable immutable(dchar) retval = decodeImpl(str, numCodeUnits); | |
str = str.opSlice(numCodeUnits, str.length()); | |
result = retval; | |
goto __returnLabel; | |
} | |
__returnLabel: | |
{ | |
assert(isValidDchar(result)); | |
} | |
return result; | |
} | |
codeUnitLimit!(ByCodeUnitImpl) | |
enum char codeUnitLimit = '\x80'; | |
hasSlicing!(ByCodeUnitImpl) | |
enum bool hasSlicing = true; | |
decodeImpl!(true, Flag.yes, ByCodeUnitImpl) | |
pure nothrow @nogc @safe dchar decodeImpl(ref ByCodeUnitImpl str, ref ulong index) | |
{ | |
alias bitMask = TList; | |
ByCodeUnitImpl pstr = str.opSlice(index, str.length()); | |
immutable immutable(ulong) length = str.length() - index; | |
ubyte fst = cast(ubyte)pstr.opIndex(0LU); | |
if ((cast(int)fst & 192) != 192) | |
{ | |
index += 1LU; | |
return '\U0000fffd'; | |
} | |
ubyte tmp = void; | |
dchar d = cast(dchar)fst; | |
cast(int)fst <<= 1; | |
unrolled { | |
{ | |
enum int i = 1; | |
if (1LU == length) | |
{ | |
index += 1LU; | |
return '\U0000fffd'; | |
} | |
tmp = cast(ubyte)pstr.opIndex(1LU); | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
index += 2LU; | |
return '\U0000fffd'; | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 2047u; | |
if ((cast(uint)d & 4294967168u) == 0u) | |
{ | |
index += 2LU; | |
return '\U0000fffd'; | |
} | |
index += 2LU; | |
return d; | |
} | |
} | |
{ | |
enum int i = 2; | |
if (2LU == length) | |
{ | |
index += 2LU; | |
return '\U0000fffd'; | |
} | |
tmp = cast(ubyte)pstr.opIndex(2LU); | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
index += 3LU; | |
return '\U0000fffd'; | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 65535u; | |
if ((cast(uint)d & 4294965248u) == 0u) | |
{ | |
index += 3LU; | |
return '\U0000fffd'; | |
} | |
if (!isValidDchar(d)) | |
{ | |
index += 3LU; | |
return '\U0000fffd'; | |
} | |
index += 3LU; | |
return d; | |
} | |
} | |
{ | |
enum int i = 3; | |
if (3LU == length) | |
{ | |
index += 3LU; | |
return '\U0000fffd'; | |
} | |
tmp = cast(ubyte)pstr.opIndex(3LU); | |
if ((cast(int)tmp & 192) != 128) | |
{ | |
index += 4LU; | |
return '\U0000fffd'; | |
} | |
d = cast(dchar)(cast(uint)d << 6 | cast(uint)(cast(int)tmp & 63)); | |
cast(int)fst <<= 1; | |
if (!(cast(int)fst & 128)) | |
{ | |
cast(uint)d &= 2097151u; | |
if ((cast(uint)d & 4294901760u) == 0u) | |
{ | |
index += 4LU; | |
return '\U0000fffd'; | |
} | |
index += 4LU; | |
if (cast(uint)d > 1114111u) | |
{ | |
d = '\U0000fffd'; | |
} | |
return d; | |
} | |
} | |
} | |
index += 4LU; | |
return '\U0000fffd'; | |
} | |
encode!cast(Flag)true | |
pure nothrow @nogc @safe ulong encode(ref dchar[1] buf, dchar c) | |
{ | |
if (55296u <= cast(uint)c && cast(uint)c <= 57343u || 1114111u < cast(uint)c) | |
c = _utfException("Encoding an invalid code point in UTF-32", c); | |
else | |
assert(isValidDchar(c)); | |
buf[0] = c; | |
return 1LU; | |
} | |
_utfException!cast(Flag)true | |
pure nothrow @nogc @safe dchar _utfException(string msg, dchar c) | |
{ | |
return '\U0000fffd'; | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
static __gshared TypeInfo_Const _D74TypeInfo_xS3std3utf20__T10byCodeUnitTAyaZ10byCodeUnitFAyaZ14ByCodeUnitImpl6__initZ; | |
static __gshared TypeInfo_Const _D13TypeInfo_xG1w6__initZ; | |
static __gshared TypeInfo_Const _D11TypeInfo_xt6__initZ; | |
isForwardRange!(Result) | |
enum bool isForwardRange = true; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
ElementEncodingType!(Result) | |
alias ElementEncodingType = dchar; | |
ElementType!(Result) | |
alias ElementType = dchar; | |
isConvertibleToString!(Result) | |
enum bool isConvertibleToString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
rightJustifier!(Result) | |
auto pure nothrow @nogc @safe Result rightJustifier(Result r, ulong width, dchar fillChar = ' ') | |
{ | |
alias C = dchar; | |
static struct Result | |
{ | |
private | |
{ | |
Result _input; | |
ulong _width; | |
alias nfill = ulong _width; | |
; | |
dchar _fillChar; | |
bool inited; | |
pure nothrow @nogc @safe void initialize() | |
{ | |
assert(this._width); | |
import std.range : take; | |
import std.range.primitives : walkLength; | |
this._width = this._width - walkLength(take(this._input.save(), this._width), this._width); | |
this.inited = true; | |
} | |
public | |
{ | |
pure nothrow @nogc @safe this(Result input, ulong width, dchar fillChar) | |
{ | |
this._input = input; | |
this._fillChar = fillChar; | |
this._width = width; | |
return this; | |
} | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return !this._width && this._input.empty(); | |
} | |
pure nothrow @nogc @property @safe dchar front() | |
{ | |
assert(&this, "null this"); | |
if (!this._width) | |
return this._input.front(); | |
if (!this.inited) | |
this.initialize(); | |
return this._width ? this._fillChar : this._input.front(); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
if (!this._width) | |
this._input.popFront(); | |
else | |
{ | |
if (!this.inited) | |
this.initialize(); | |
if (this._width) | |
this._width -= 1LU; | |
else | |
this._input.popFront(); | |
} | |
} | |
pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
Result ret = this; | |
ret._input = this._input.save(); | |
return ret; | |
} | |
} | |
} | |
} | |
return Result(Result(ByCodeUnitImpl(null), , cast(ushort)0u, cast(ushort)0u), 0LU, '\U0000ffff', false).this(r, width, fillChar); | |
} | |
hasLength!(Result) | |
enum bool hasLength = false; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
Unqual!(Result) | |
alias Unqual = Result; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
hasSlicing!(Result) | |
enum bool hasSlicing = false; | |
take!(Result) | |
pure nothrow @nogc @safe Take!(Result) take(Result input, ulong n) | |
{ | |
return Take(input, n); | |
} | |
Take!(Result) | |
struct Take | |
{ | |
private alias R = Result; | |
public Result source; | |
private ulong _maxAvailable; | |
alias Source = Result; | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this._maxAvailable == 0LU || this.source.empty(); | |
} | |
auto pure nothrow @nogc @property @safe dchar front() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty(), "Attempting to fetch the front of an empty Take!(Result)"); | |
return this.source.front(); | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty(), "Attempting to popFront() past the end of a Take!(Result)"); | |
this.source.popFront(); | |
this._maxAvailable -= 1LU; | |
} | |
static if (isForwardRange!(Result) | |
) | |
{ | |
pure nothrow @nogc @property @safe Take!(Result) save() | |
{ | |
assert(&this, "null this"); | |
return Take(this.source.save(), this._maxAvailable); | |
} | |
} | |
static if (hasAssignableElements!(Result) | |
enum bool hasAssignableElements = false; | |
) | |
{ | |
@property void front(ElementType!R | |
v) | |
{ | |
assert(!empty, "Attempting to assign to the front of an empty " ~ Take.stringof); | |
source.front = v; | |
} | |
} | |
static if (hasMobileElements!(Result) | |
enum bool hasMobileElements = true; | |
) | |
{ | |
auto pure nothrow @nogc @safe dchar moveFront() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty(), "Attempting to move the front of an empty Take!(Result)"); | |
return moveFront(this.source); | |
} | |
} | |
static if (isInfinite!(Result) | |
) | |
{ | |
const @property size_t length() | |
{ | |
return _maxAvailable; | |
} | |
alias opDollar = length; | |
auto opSlice()(size_t i, size_t j) if (hasSlicing!R | |
) | |
{ | |
assert(i <= j, "Invalid slice bounds"); | |
assert(j <= length, "Attempting to slice past the end of a " ~ Take.stringof); | |
return source[i..j]; | |
} | |
} | |
else | |
{ | |
static if (hasLength!(Result) | |
) | |
{ | |
@property size_t length() | |
{ | |
import std.algorithm.comparison : min; | |
return min(_maxAvailable, source.length); | |
} | |
alias opDollar = length; | |
} | |
} | |
static if (isRandomAccessRange!(Result) | |
) | |
{ | |
void popBack() | |
{ | |
assert(!empty, "Attempting to popBack() past the beginning of a " ~ Take.stringof); | |
--_maxAvailable; | |
} | |
auto @property ref back() | |
{ | |
assert(!empty, "Attempting to fetch the back of an empty " ~ Take.stringof); | |
return source[this.length - 1]; | |
} | |
auto ref opIndex(size_t index) | |
{ | |
assert(index < length, "Attempting to index out of the bounds of a " ~ Take.stringof); | |
return source[index]; | |
} | |
static if (hasAssignableElements!R | |
) | |
{ | |
@property void back(ElementType!R | |
v) | |
{ | |
assert(!empty, "Attempting to assign to the back of an empty " ~ Take.stringof); | |
source[this.length - 1] = v; | |
} | |
void opIndexAssign(ElementType!R | |
v, size_t index) | |
{ | |
assert(index < length, "Attempting to index out of the bounds of a " ~ Take.stringof); | |
source[index] = v; | |
} | |
} | |
static if (hasMobileElements!R | |
) | |
{ | |
auto moveBack() | |
{ | |
assert(!empty, "Attempting to move the back of an empty " ~ Take.stringof); | |
return source.moveAt(this.length - 1); | |
} | |
auto moveAt(size_t index) | |
{ | |
assert(index < length, "Attempting to index out of the bounds of a " ~ Take.stringof); | |
return source.moveAt(index); | |
} | |
} | |
} | |
const pure nothrow @nogc @property @safe ulong maxLength() | |
{ | |
assert(&this, "null this"); | |
return this._maxAvailable; | |
} | |
} | |
hasAssignableElements!(Result) | |
enum bool hasAssignableElements = false; | |
isBidirectionalRange!(Result) | |
enum bool isBidirectionalRange = false; | |
isRandomAccessRange!(Result) | |
enum bool isRandomAccessRange = false; | |
hasMobileElements!(Result) | |
enum bool hasMobileElements = true; | |
moveFront!(Result) | |
pure nothrow @nogc @safe dchar moveFront(Result r) | |
{ | |
return r.front(); | |
} | |
hasElaborateCopyConstructor!dchar | |
enum bool hasElaborateCopyConstructor = false; | |
isInputRange!(Take!(Result)) | |
enum bool isInputRange = true; | |
walkLength!(Take!(Result)) | |
auto pure nothrow @nogc @safe ulong walkLength(Take!(Result) range, const(ulong) upTo) | |
{ | |
ulong result = 0LU; | |
for (; result < upTo && !range.empty(); range.popFront()) | |
{ | |
result += 1LU; | |
} | |
return result; | |
} | |
hasLength!(Take!(Result)) | |
enum bool hasLength = false; | |
isNarrowString!(Take!(Result)) | |
enum bool isNarrowString = false; | |
isAggregateType!(Take!(Result)) | |
enum bool isAggregateType = true; | |
isStaticArray!(Take!(Result)) | |
enum bool isStaticArray = false; | |
isInfinite!(Take!(Result)) | |
enum bool isInfinite = false; | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
static __gshared TypeInfo_Const _D191TypeInfo_xS3std3utf12__T5byUTFTwZ75__T5byUTFTS3std3utf20__T10byCodeUnitTAyaZ10byCodeUnitFAyaZ14ByCodeUnitImplZ5byUTFFNcS3std3utf20__T10byCodeUnitTAyaZ10byCodeUnitFAyaZ14ByCodeUnitImplZ6Result6__initZ; | |
static __gshared TypeInfo_Const _D11TypeInfo_xw6__initZ; | |
isAutodecodableString!(Result) | |
enum bool isAutodecodableString = false; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
ElementEncodingType!(Result) | |
alias ElementEncodingType = dchar; | |
ElementType!(Result) | |
alias ElementType = dchar; | |
byUTF!(Result) | |
auto pure nothrow @nogc @safe Result byUTF(Result r) | |
{ | |
alias RC = dchar; | |
static struct Result | |
{ | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return cast(int)this.pos == cast(int)this.fill && this.r.empty(); | |
} | |
auto pure nothrow @nogc @property scope @safe char front() | |
{ | |
assert(&this, "null this"); | |
if (cast(int)this.pos == cast(int)this.fill) | |
{ | |
this.pos = cast(ushort)0u; | |
dchar c = this.r.front(); | |
if (cast(uint)c <= 127u) | |
{ | |
this.fill = cast(ushort)1u; | |
this.r.popFront(); | |
this.buf[cast(ulong)this.pos] = cast(char)c; | |
} | |
else | |
{ | |
this.r.popFront(); | |
dchar dc = c; | |
this.fill = cast(ushort)encode(this.buf, dc); | |
} | |
} | |
return this.buf[cast(ulong)this.pos]; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
if (cast(int)this.pos == cast(int)this.fill) | |
this.front(); | |
cast(int)this.pos += 1; | |
} | |
static if (isForwardRange!(Result) | |
enum bool isForwardRange = true; | |
) | |
{ | |
auto pure nothrow @nogc @property return scope @safe Result save() | |
{ | |
assert(&this, "null this"); | |
Result ret = this; | |
ret.r = this.r.save(); | |
return ret; | |
} | |
} | |
private | |
{ | |
Result r; | |
char[4] buf = void; | |
ushort pos; | |
ushort fill; | |
} | |
} | |
return Result(r, , cast(ushort)0u, cast(ushort)0u); | |
} | |
isForwardRange!(Result) | |
enum bool isForwardRange = true; | |
encode!cast(Flag)true | |
pure nothrow @nogc @safe ulong encode(ref char[4] buf, dchar c) | |
{ | |
if (cast(uint)c <= 127u) | |
{ | |
assert(isValidDchar(c)); | |
buf[0] = cast(char)c; | |
return 1LU; | |
} | |
if (cast(uint)c <= 2047u) | |
{ | |
assert(isValidDchar(c)); | |
buf[0] = cast(char)(192u | cast(uint)c >> 6); | |
buf[1] = cast(char)(128u | cast(uint)c & 63u); | |
return 2LU; | |
} | |
if (cast(uint)c <= 65535u) | |
{ | |
if (55296u <= cast(uint)c && cast(uint)c <= 57343u) | |
c = _utfException("Encoding a surrogate code point in UTF-8", c); | |
assert(isValidDchar(c)); | |
L3: | |
buf[0] = cast(char)(224u | cast(uint)c >> 12); | |
buf[1] = cast(char)(128u | cast(uint)c >> 6 & 63u); | |
buf[2] = cast(char)(128u | cast(uint)c & 63u); | |
return 3LU; | |
} | |
if (cast(uint)c <= 1114111u) | |
{ | |
assert(isValidDchar(c)); | |
buf[0] = cast(char)(240u | cast(uint)c >> 18); | |
buf[1] = cast(char)(128u | cast(uint)c >> 12 & 63u); | |
buf[2] = cast(char)(128u | cast(uint)c >> 6 & 63u); | |
buf[3] = cast(char)(128u | cast(uint)c & 63u); | |
return 4LU; | |
} | |
assert(!isValidDchar(c)); | |
c = _utfException("Encoding an invalid code point in UTF-8", c); | |
goto L3; | |
} | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
static __gshared TypeInfo_Const _D435TypeInfo_xS3std6string202__T14rightJustifierTS3std3utf12__T5byUTFTwZ75__T5byUTFTS3std3utf20__T10byCodeUnitTAyaZ10byCodeUnitFAyaZ14ByCodeUnitImplZ5byUTFFNcS3std3utf20__T10byCodeUnitTAyaZ10byCodeUnitFAyaZ14ByCodeUnitImplZ6ResultZ14rightJustifierFS3std3utf12__T5byUTFTwZ75__T5byUTFTS3std3utf20__T10byCodeUnitTAyaZ10byCodeUnitFAyaZ14ByCodeUnitImplZ5byUTFFNcS3std3utf20__T10byCodeUnitTAyaZ10byCodeUnitFAyaZ14ByCodeUnitImplZ6ResultmwZ6Result6__initZ; | |
static __gshared TypeInfo_Const _D13TypeInfo_xG4a6__initZ; | |
isIterable!(Result) | |
enum bool isIterable = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
isInfinite!(Result) | |
enum bool isInfinite = false; | |
isInputRange!(Result) | |
enum bool isInputRange = true; | |
array!(Result) | |
pure nothrow @safe char[] array(Result r) | |
{ | |
if (__ctfe) | |
{ | |
char[] result = null; | |
{ | |
Result __r2523 = r; | |
for (; !__r2523.empty(); __r2523.popFront()) | |
{ | |
char e = __r2523.front(); | |
result ~= e; | |
} | |
} | |
return result; | |
} | |
alias E = char; | |
Appender!(char[]) a = appender(); | |
{ | |
Result __r2524 = r; | |
for (; !__r2524.empty(); __r2524.popFront()) | |
{ | |
char e = __r2524.front(); | |
a.put(e); | |
} | |
} | |
return a.data(); | |
} | |
ForeachType!(Result) | |
alias ForeachType = char; | |
hasLength!(Result) | |
enum bool hasLength = false; | |
canPutItem!char | |
enum bool canPutItem = true; | |
isImplicitlyConvertible!(char, char) | |
enum bool isImplicitlyConvertible = true; | |
canPutConstRange!char | |
enum bool canPutConstRange = false; | |
canPutRange!char | |
enum bool canPutRange = false; | |
put!char | |
pure nothrow @safe void put(char item) | |
{ | |
assert(&this, "null this"); | |
import std.conv : emplaceRef; | |
this.ensureAddable(1LU); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
char[] bigData = delegate () => (cast(char*)(*this._data).arr)[0..len + 1LU](); | |
emplaceRef(bigData[len], item); | |
(*this._data).arr = bigData; | |
} | |
RTInfo!(Take!(Result)) | |
enum typeof(null) RTInfo = null; | |
to!int | |
pure nothrow @safe string to(int _param_0) | |
{ | |
return toImpl(_param_0); | |
} | |
isImplicitlyConvertible!(int, string) | |
enum bool isImplicitlyConvertible = false; | |
isInfinite!int | |
enum bool isInfinite = false; | |
toImpl!(string, int) | |
pure nothrow @safe string toImpl(int value) | |
{ | |
return toImpl(value, 10u, LetterCase.upper); | |
} | |
toImpl!(string, int) | |
pure nothrow @trusted string toImpl(int value, uint radix, LetterCase letterCase = LetterCase.upper) | |
in | |
{ | |
assert(radix >= 2u && radix <= 36u); | |
} | |
body | |
{ | |
{ | |
assert(radix >= 2u && radix <= 36u); | |
} | |
alias EEType = char; | |
T toStringRadixConvert(ulong bufLen)(uint runtimeRadix = 0) | |
{ | |
Unsigned!(Unqual!S | |
) | |
div = void, mValue = unsigned(value); | |
size_t index = bufLen; | |
EEType[bufLen] buffer = void; | |
char baseChar = letterCase == LetterCase.lower ? 'a' : 'A'; | |
char mod = void; | |
do | |
{ | |
div = cast(S)(mValue / runtimeRadix); | |
mod = cast(ubyte)(mValue % runtimeRadix); | |
mod += mod < 10 ? '0' : baseChar - 10; | |
buffer[--index] = cast(char)mod; | |
mValue = div; | |
} | |
while (mValue); | |
return cast(T)buffer[index..__dollar].dup; | |
} | |
import std.array : array; | |
switch (radix) | |
{ | |
case 10u: | |
{ | |
return array(toChars(value + 0)); | |
} | |
case 16u: | |
{ | |
if (cast(int)letterCase == 0) | |
return array(toChars(unsigned(unsigned(value) + 0u))); | |
else | |
return array(toChars(unsigned(unsigned(value) + 0u))); | |
} | |
case 2u: | |
{ | |
return array(toChars(unsigned(unsigned(value) + 0u))); | |
} | |
case 8u: | |
{ | |
return array(toChars(unsigned(unsigned(value) + 0u))); | |
} | |
default: | |
{ | |
return toStringRadixConvert(radix); | |
} | |
} | |
} | |
toStringRadixConvert!24LU | |
pure nothrow @system string toStringRadixConvert(uint runtimeRadix = 0u) | |
{ | |
uint div = void; | |
uint mValue = unsigned(value); | |
ulong index = 24LU; | |
char[24] buffer = void; | |
char baseChar = cast(int)letterCase == 1 ? 'a' : 'A'; | |
char mod = void; | |
do | |
{ | |
div = cast(uint)cast(int)(mValue / runtimeRadix); | |
mod = cast(char)cast(ubyte)(mValue % runtimeRadix); | |
cast(int)mod += cast(int)mod < 10 ? 48 : cast(int)baseChar - 10; | |
buffer[index -= 1LU] = mod; | |
mValue = div; | |
} | |
while (mValue); | |
return cast(string)dup(buffer[index..24]); | |
} | |
SliceOverIndexed!(int[]) | |
struct SliceOverIndexed | |
{ | |
enum bool assignableIndex = true; | |
enum bool assignableSlice = true; | |
auto const pure nothrow @nogc @safe const(int) opIndex(ulong idx) | |
in | |
{ | |
assert(idx < this.to - this.from); | |
} | |
body | |
{ | |
{ | |
assert(idx < this.to - this.from); | |
} | |
assert(&this, "null this"); | |
return (*this.arr)[this.from + idx]; | |
} | |
static if (assignableIndex) | |
{ | |
pure nothrow @nogc @safe void opIndexAssign(int val, ulong idx) | |
in | |
{ | |
assert(idx < this.to - this.from); | |
} | |
body | |
{ | |
{ | |
assert(idx < this.to - this.from); | |
} | |
assert(&this, "null this"); | |
(*this.arr)[this.from + idx] = val; | |
} | |
} | |
auto pure nothrow @nogc @safe SliceOverIndexed!(int[]) opSlice(ulong a, ulong b) | |
{ | |
assert(&this, "null this"); | |
return SliceOverIndexed(this.from + a, this.from + b, this.arr); | |
} | |
void opSliceAssign(T)(T val, size_t start, size_t end) | |
{ | |
(*arr)[start + from..end + from] = val; | |
} | |
auto pure nothrow @nogc @safe SliceOverIndexed!(int[]) opSlice() | |
{ | |
assert(&this, "null this"); | |
return SliceOverIndexed(this.from, this.to, this.arr); | |
} | |
const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return this.to - this.from; | |
} | |
auto const pure nothrow @nogc @safe ulong opDollar() | |
{ | |
assert(&this, "null this"); | |
return this.length(); | |
} | |
const pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this.from == this.to; | |
} | |
auto const pure nothrow @nogc @property @safe const(int) front() | |
{ | |
assert(&this, "null this"); | |
return (*this.arr)[this.from]; | |
} | |
static if (assignableIndex) | |
{ | |
pure nothrow @nogc @property @safe void front(int val) | |
{ | |
assert(&this, "null this"); | |
(*this.arr)[this.from] = val; | |
} | |
} | |
auto const pure nothrow @nogc @property @safe const(int) back() | |
{ | |
assert(&this, "null this"); | |
return (*this.arr)[this.to - 1LU]; | |
} | |
static if (assignableIndex) | |
{ | |
pure nothrow @nogc @property @safe void back(int val) | |
{ | |
assert(&this, "null this"); | |
(*this.arr)[this.to - 1LU] = val; | |
} | |
} | |
auto inout pure nothrow @nogc @property @safe inout(SliceOverIndexed!(int[])) save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
this.from++; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.to--; | |
} | |
const bool opEquals(T)(auto ref T arr) | |
{ | |
if (arr.length != length) | |
return false; | |
for (size_t i = 0; | |
i < length; i++) | |
{ | |
if (this[i] != arr[i]) | |
return false; | |
} | |
return true; | |
} | |
private | |
{ | |
alias Item = int; | |
ulong from; | |
ulong to; | |
int[]* arr; | |
} | |
} | |
opEquals!(SliceOverIndexed!(int[])) | |
const pure nothrow @nogc @safe bool opEquals(SliceOverIndexed!(int[]) arr) | |
{ | |
assert(&this, "null this"); | |
if (arr.length() != this.length()) | |
return false; | |
{ | |
ulong i = 0LU; | |
for (; i < this.length(); i++) | |
{ | |
if (this.opIndex(i) != arr.opIndex(i)) | |
return false; | |
} | |
} | |
return true; | |
} | |
isRandomAccessRange!(SliceOverIndexed!(int[])) | |
enum bool isRandomAccessRange = true; | |
isBidirectionalRange!(SliceOverIndexed!(int[])) | |
enum bool isBidirectionalRange = true; | |
isForwardRange!(SliceOverIndexed!(int[])) | |
enum bool isForwardRange = true; | |
isInputRange!(SliceOverIndexed!(int[])) | |
enum bool isInputRange = true; | |
isNarrowString!(SliceOverIndexed!(int[])) | |
enum bool isNarrowString = false; | |
isAggregateType!(SliceOverIndexed!(int[])) | |
enum bool isAggregateType = true; | |
isStaticArray!(SliceOverIndexed!(int[])) | |
enum bool isStaticArray = false; | |
hasLength!(SliceOverIndexed!(int[])) | |
enum bool hasLength = true; | |
isInfinite!(SliceOverIndexed!(int[])) | |
enum bool isInfinite = false; | |
assumeSize!(low_8, 8LU) | |
struct assumeSize | |
{ | |
enum ulong bitSize = 8LU; | |
static auto ref opCall(T)(auto ref T arg) | |
{ | |
return Fn(arg); | |
} | |
} | |
bitSizeOf!(assumeSize!(low_8, 8LU)) | |
enum ulong bitSizeOf = 8LU; | |
sliceBits!(4LU, 7LU) | |
struct sliceBits | |
{ | |
enum ulong bitSize = 3LU; | |
static auto opCall(T)(T x) | |
out(result) | |
{ | |
assert(result < 1 << to - from); | |
} | |
body | |
{ | |
static assert(from < to); | |
static if (from == 0) | |
{ | |
return x & (1 << to) - 1; | |
} | |
else | |
{ | |
return x >> from & (1 << to - from) - 1; | |
} | |
} | |
} | |
bitSizeOf!(sliceBits!(4LU, 7LU)) | |
enum ulong bitSizeOf = 3LU; | |
BitPacked!(uint, 2LU) | |
struct BitPacked | |
{ | |
enum ulong bitSize = 2LU; | |
uint _value; | |
alias _value this; | |
} | |
bitSizeOf!(BitPacked!(uint, 2LU)) | |
enum ulong bitSizeOf = 2LU; | |
isInputRange!(DecompressedIntervals) | |
enum bool isInputRange = true; | |
isForwardRange!(DecompressedIntervals) | |
enum bool isForwardRange = true; | |
RTInfo!(Demangle!uint) | |
enum typeof(null) RTInfo = null; | |
static __gshared TypeInfo_Const _D11TypeInfo_xk6__initZ; | |
RTInfo!(TrieEntry!(bool, 8, 4, 9)) | |
enum typeof(null) RTInfo = null; | |
static __gshared TypeInfo_Const _D12TypeInfo_xAm6__initZ; | |
RTInfo!(TrieEntry!(ushort, 8, 7, 6)) | |
enum typeof(null) RTInfo = null; | |
RTInfo!(TrieEntry!(bool, 8, 5, 8)) | |
enum typeof(null) RTInfo = null; | |
RTInfo!(TrieEntry!(bool, 8, 6, 7)) | |
enum typeof(null) RTInfo = null; | |
RTInfo!(TrieEntry!(bool, 7, 4, 4, 6)) | |
enum typeof(null) RTInfo = null; | |
RTInfo!(SliceOverIndexed!(Grapheme)) | |
enum typeof(null) RTInfo = null; | |
opEquals!(const(SliceOverIndexed!(Grapheme))) | |
const pure nothrow @nogc @safe bool opEquals(ref const(SliceOverIndexed!(Grapheme)) arr) | |
{ | |
assert(&this, "null this"); | |
if (arr.length() != this.length()) | |
return false; | |
{ | |
ulong i = 0LU; | |
for (; i < this.length(); i++) | |
{ | |
if (cast(uint)this.opIndex(i) != cast(uint)arr.opIndex(i)) | |
return false; | |
} | |
} | |
return true; | |
} | |
RTInfo!(SliceOverIndexed!(int[])) | |
enum typeof(null) RTInfo = null; | |
opEquals!(const(SliceOverIndexed!(int[]))) | |
const pure nothrow @nogc @safe bool opEquals(ref const(SliceOverIndexed!(int[])) arr) | |
{ | |
assert(&this, "null this"); | |
if (arr.length() != this.length()) | |
return false; | |
{ | |
ulong i = 0LU; | |
for (; i < this.length(); i++) | |
{ | |
if (this.opIndex(i) != arr.opIndex(i)) | |
return false; | |
} | |
} | |
return true; | |
} | |
RTInfo!(assumeSize!(low_8, 8LU)) | |
enum typeof(null) RTInfo = null; | |
RTInfo!(sliceBits!(4LU, 7LU)) | |
enum typeof(null) RTInfo = null; | |
RTInfo!(BitPacked!(uint, 2LU)) | |
enum typeof(null) RTInfo = null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment