Skip to content

Commit 7134932

Browse files
committed
Remove new templates
1 parent 2c928a2 commit 7134932

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

std/encoding.d

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -378,65 +378,65 @@ template EncoderFunctions()
378378
template ReadFromString()
379379
{
380380
@property bool canRead() { return s.length != 0; }
381-
E peek()() { return s[0]; }
382-
E read()() { E t = s[0]; s = s[1..$]; return t; }
381+
E peek() @safe pure @nogc nothrow { return s[0]; }
382+
E read() @safe pure @nogc nothrow { E t = s[0]; s = s[1..$]; return t; }
383383
}
384384

385385
template ReverseReadFromString()
386386
{
387387
@property bool canRead() { return s.length != 0; }
388-
E peek()() { return s[$-1]; }
389-
E read()() { E t = s[$-1]; s = s[0..$-1]; return t; }
388+
E peek() @safe pure @nogc nothrow { return s[$-1]; }
389+
E read() @safe pure @nogc nothrow { E t = s[$-1]; s = s[0..$-1]; return t; }
390390
}
391391

392392
// Various forms of Write
393393

394394
template WriteToString()
395395
{
396396
E[] s;
397-
void write()(E c) { s ~= c; }
397+
void write(E c) @safe pure nothrow { s ~= c; }
398398
}
399399

400400
template WriteToArray()
401401
{
402-
void write()(E c) { array[0] = c; array = array[1..$]; }
402+
void write(E c) @safe pure @nogc nothrow { array[0] = c; array = array[1..$]; }
403403
}
404404

405405
template WriteToDelegate()
406406
{
407-
void write()(E c) { dg(c); }
407+
void write(E c) { dg(c); }
408408
}
409409

410410
// Functions we will export
411411

412412
template EncodeViaWrite()
413413
{
414414
mixin encodeViaWrite;
415-
void encode()(dchar c) { encodeViaWrite(c); }
415+
void encode(dchar c) { encodeViaWrite(c); }
416416
}
417417

418418
template SkipViaRead()
419419
{
420420
mixin skipViaRead;
421-
void skip()() { skipViaRead(); }
421+
void skip() @safe pure @nogc nothrow { skipViaRead(); }
422422
}
423423

424424
template DecodeViaRead()
425425
{
426426
mixin decodeViaRead;
427-
dchar decode()() { return decodeViaRead(); }
427+
dchar decode() @safe pure @nogc nothrow { return decodeViaRead(); }
428428
}
429429

430430
template SafeDecodeViaRead()
431431
{
432432
mixin safeDecodeViaRead;
433-
dchar safeDecode()() { return safeDecodeViaRead(); }
433+
dchar safeDecode() @safe pure @nogc nothrow { return safeDecodeViaRead(); }
434434
}
435435

436436
template DecodeReverseViaRead()
437437
{
438438
mixin decodeReverseViaRead;
439-
dchar decodeReverse()() { return decodeReverseViaRead(); }
439+
dchar decodeReverse() @safe pure @nogc nothrow { return decodeReverseViaRead(); }
440440
}
441441

442442
// Encoding to different destinations
@@ -489,26 +489,26 @@ template EncoderFunctions()
489489

490490
// Below are the functions we will ultimately expose to the user
491491

492-
E[] encode()(dchar c)
492+
E[] encode(dchar c) @safe pure nothrow
493493
{
494494
mixin EncodeToString e;
495495
e.encode(c);
496496
return e.s;
497497
}
498498

499-
void encode()(dchar c, ref E[] array)
499+
void encode(dchar c, ref E[] array) @safe pure nothrow
500500
{
501501
mixin EncodeToArray e;
502502
e.encode(c);
503503
}
504504

505-
void encode()(dchar c, void delegate(E) dg)
505+
void encode(dchar c, void delegate(E) dg)
506506
{
507507
mixin EncodeToDelegate e;
508508
e.encode(c);
509509
}
510510

511-
void skip()(ref const(E)[] s)
511+
void skip(ref const(E)[] s) @safe pure nothrow
512512
{
513513
mixin SkipFromString e;
514514
e.skip();
@@ -526,7 +526,7 @@ template EncoderFunctions()
526526
return e.safeDecode();
527527
}
528528

529-
dchar decodeReverse()(ref const(E)[] s)
529+
dchar decodeReverse(ref const(E)[] s) @safe pure nothrow
530530
{
531531
mixin DecodeReverseFromString e;
532532
return e.decodeReverse();
@@ -650,7 +650,7 @@ template EncoderInstance(E)
650650

651651
private template GenericEncoder()
652652
{
653-
bool canEncode()(dchar c)
653+
bool canEncode(dchar c) @safe pure @nogc nothrow
654654
{
655655
if (c < m_charMapStart || (c > m_charMapEnd && c < 0x100)) return true;
656656
if (c >= 0xFFFD) return false;
@@ -665,13 +665,13 @@ private template GenericEncoder()
665665
return false;
666666
}
667667

668-
bool isValidCodeUnit()(E c)
668+
bool isValidCodeUnit(E c) @safe pure @nogc nothrow
669669
{
670670
if (c < m_charMapStart || c > m_charMapEnd) return true;
671671
return charMap[c-m_charMapStart] != 0xFFFD;
672672
}
673673

674-
size_t encodedLength()(dchar c)
674+
size_t encodedLength(dchar c) @safe pure @nogc nothrow
675675
in
676676
{
677677
assert(canEncode(c));
@@ -726,7 +726,7 @@ private template GenericEncoder()
726726
return (c >= m_charMapStart && c <= m_charMapEnd) ? charMap[c-m_charMapStart] : c;
727727
}
728728

729-
@property EString replacementSequence()()
729+
@property EString replacementSequence() @safe pure @nogc nothrow
730730
{
731731
return cast(EString)("?");
732732
}
@@ -1389,17 +1389,17 @@ template EncoderInstance(CharType : dchar)
13891389
return "UTF-32";
13901390
}
13911391

1392-
bool canEncode()(dchar c)
1392+
bool canEncode(dchar c) @safe pure @nogc nothrow
13931393
{
13941394
return isValidCodePoint(c);
13951395
}
13961396

1397-
bool isValidCodeUnit()(dchar c)
1397+
bool isValidCodeUnit(dchar c) @safe pure @nogc nothrow
13981398
{
13991399
return isValidCodePoint(c);
14001400
}
14011401

1402-
size_t encodedLength()(dchar c)
1402+
size_t encodedLength(dchar c) @safe pure @nogc nothrow
14031403
in
14041404
{
14051405
assert(canEncode(c));
@@ -2462,7 +2462,7 @@ abstract class EncodingScheme
24622462
* Params:
24632463
* s = the array to be tested
24642464
*/
2465-
bool isValid()(const(ubyte)[] s)
2465+
bool isValid(const(ubyte)[] s)
24662466
{
24672467
while (s.length != 0)
24682468
{

0 commit comments

Comments
 (0)