mirror of https://github.com/buggins/dlangui.git
foreach loops pt. 3
This commit is contained in:
parent
1b4a34b68d
commit
b8a533c598
|
@ -286,7 +286,7 @@ class EditOperation {
|
||||||
_action = action;
|
_action = action;
|
||||||
_range = range;
|
_range = range;
|
||||||
_content.length = text.length;
|
_content.length = text.length;
|
||||||
for(int i = 0; i < text.length; i++)
|
foreach(i; 0 .. text.length)
|
||||||
_content[i] = text[i].dup;
|
_content[i] = text[i].dup;
|
||||||
//_content = text;
|
//_content = text;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ class EditOperation {
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
void modified(bool all = true) {
|
void modified(bool all = true) {
|
||||||
for (int i = 0; i < _oldEditMarks.length; i++) {
|
foreach(i; 0 .. _oldEditMarks.length) {
|
||||||
if (all || _oldEditMarks[i] == EditStateMark.saved)
|
if (all || _oldEditMarks[i] == EditStateMark.saved)
|
||||||
_oldEditMarks[i] = EditStateMark.changed;
|
_oldEditMarks[i] = EditStateMark.changed;
|
||||||
}
|
}
|
||||||
|
@ -402,10 +402,10 @@ class UndoBuffer {
|
||||||
/// current state is saved
|
/// current state is saved
|
||||||
void saved() {
|
void saved() {
|
||||||
_savedState = _undoList.peekBack;
|
_savedState = _undoList.peekBack;
|
||||||
for (int i = 0; i < _undoList.length; i++) {
|
foreach(i; 0 .. _undoList.length) {
|
||||||
_undoList[i].modified();
|
_undoList[i].modified();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < _redoList.length; i++) {
|
foreach(i; 0 .. _redoList.length) {
|
||||||
_redoList[i].modified();
|
_redoList[i].modified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ class UndoBuffer {
|
||||||
bool savedInRedo() {
|
bool savedInRedo() {
|
||||||
if (!_savedState)
|
if (!_savedState)
|
||||||
return false;
|
return false;
|
||||||
for (int i = 0; i < _redoList.length; i++) {
|
foreach(i; 0 .. _redoList.length) {
|
||||||
if (_savedState is _redoList[i])
|
if (_savedState is _redoList[i])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -677,7 +677,7 @@ class EditableContent {
|
||||||
/// call listener to say that content is saved
|
/// call listener to say that content is saved
|
||||||
void notifyContentSaved() {
|
void notifyContentSaved() {
|
||||||
// mark all changed lines as saved
|
// mark all changed lines as saved
|
||||||
for (int i = 0; i < _editMarks.length; i++) {
|
foreach(i; 0 .. _editMarks.length) {
|
||||||
if (_editMarks[i] == EditStateMark.changed)
|
if (_editMarks[i] == EditStateMark.changed)
|
||||||
_editMarks[i] = EditStateMark.saved;
|
_editMarks[i] = EditStateMark.saved;
|
||||||
}
|
}
|
||||||
|
@ -711,18 +711,18 @@ class EditableContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void markChangedLines(int startLine, int endLine) {
|
protected void markChangedLines(int startLine, int endLine) {
|
||||||
for (int i = startLine; i < endLine; i++) {
|
foreach(i; startLine .. endLine) {
|
||||||
_editMarks[i] = EditStateMark.changed;
|
_editMarks[i] = EditStateMark.changed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// set props arrays size equal to text line sizes, bit fill with unknown token
|
/// set props arrays size equal to text line sizes, bit fill with unknown token
|
||||||
protected void clearTokenProps(int startLine, int endLine) {
|
protected void clearTokenProps(int startLine, int endLine) {
|
||||||
for (int i = startLine; i < endLine; i++) {
|
foreach(i; startLine .. endLine) {
|
||||||
if (hasSyntaxHighlight) {
|
if (hasSyntaxHighlight) {
|
||||||
int len = cast(int)_lines[i].length;
|
int len = cast(int)_lines[i].length;
|
||||||
_tokenProps[i].length = len;
|
_tokenProps[i].length = len;
|
||||||
for (int j = 0; j < len; j++)
|
foreach(j; 0 .. len)
|
||||||
_tokenProps[i][j] = TOKEN_UNKNOWN;
|
_tokenProps[i][j] = TOKEN_UNKNOWN;
|
||||||
} else {
|
} else {
|
||||||
_tokenProps[i] = null; // no token props
|
_tokenProps[i] = null; // no token props
|
||||||
|
@ -732,7 +732,7 @@ class EditableContent {
|
||||||
|
|
||||||
void clearEditMarks() {
|
void clearEditMarks() {
|
||||||
_editMarks.length = _lines.length;
|
_editMarks.length = _lines.length;
|
||||||
for (int i = 0; i < _editMarks.length; i++)
|
foreach(i; 0 .. _editMarks.length)
|
||||||
_editMarks[i] = EditStateMark.unchanged;
|
_editMarks[i] = EditStateMark.unchanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ class EditableContent {
|
||||||
int x = 0;
|
int x = 0;
|
||||||
while (x + tabSize <= pos) {
|
while (x + tabSize <= pos) {
|
||||||
if (useSpacesForTabs) {
|
if (useSpacesForTabs) {
|
||||||
for (int i = 0; i < tabSize; i++)
|
foreach(i; 0 .. tabSize)
|
||||||
buf ~= ' ';
|
buf ~= ' ';
|
||||||
} else {
|
} else {
|
||||||
buf ~= '\t';
|
buf ~= '\t';
|
||||||
|
@ -1068,7 +1068,7 @@ class EditableContent {
|
||||||
_tokenProps[i] = _tokenProps[i - count];
|
_tokenProps[i] = _tokenProps[i - count];
|
||||||
_editMarks[i] = _editMarks[i - count];
|
_editMarks[i] = _editMarks[i - count];
|
||||||
}
|
}
|
||||||
for (int i = start; i < start + count; i++) {
|
foreach(i; start .. start + count) {
|
||||||
_lines[i] = ""d;
|
_lines[i] = ""d;
|
||||||
_tokenProps[i] = null;
|
_tokenProps[i] = null;
|
||||||
_editMarks[i] = EditStateMark.changed;
|
_editMarks[i] = EditStateMark.changed;
|
||||||
|
@ -1091,7 +1091,7 @@ class EditableContent {
|
||||||
// remove extra lines
|
// remove extra lines
|
||||||
removeLines(before.start.line + 1, linesBefore - linesAfter);
|
removeLines(before.start.line + 1, linesBefore - linesAfter);
|
||||||
}
|
}
|
||||||
for (int i = after.start.line; i <= after.end.line; i++) {
|
foreach(int i; after.start.line .. after.end.line + 1) {
|
||||||
if (marks) {
|
if (marks) {
|
||||||
//if (i - after.start.line < marks.length)
|
//if (i - after.start.line < marks.length)
|
||||||
_editMarks[i] = marks[i - after.start.line];
|
_editMarks[i] = marks[i - after.start.line];
|
||||||
|
|
|
@ -204,7 +204,7 @@ class Action {
|
||||||
_state = a._state;
|
_state = a._state;
|
||||||
_defaultState = a._defaultState;
|
_defaultState = a._defaultState;
|
||||||
_accelerators.length = a._accelerators.length;
|
_accelerators.length = a._accelerators.length;
|
||||||
for(int i = 0; i < _accelerators.length; i++)
|
foreach(i; 0 .. _accelerators.length)
|
||||||
_accelerators[i] = a._accelerators[i];
|
_accelerators[i] = a._accelerators[i];
|
||||||
_stringParam = a._stringParam;
|
_stringParam = a._stringParam;
|
||||||
_longParam = a._longParam;
|
_longParam = a._longParam;
|
||||||
|
@ -1424,7 +1424,7 @@ void registerActionEnum(T)() if (is(T == enum)) {
|
||||||
immutable string[] memberNames = enumMemberNames!T;
|
immutable string[] memberNames = enumMemberNames!T;
|
||||||
//pragma(msg, enumMemberValues!T);
|
//pragma(msg, enumMemberValues!T);
|
||||||
//pragma(msg, enumMemberNames!T);
|
//pragma(msg, enumMemberNames!T);
|
||||||
for (int i = 0; i < memberValues.length; i++) {
|
foreach(i; 0 .. memberValues.length) {
|
||||||
actionIdToNameMap[memberValues[i]] = memberNames[i];
|
actionIdToNameMap[memberValues[i]] = memberNames[i];
|
||||||
actionNameToIdMap[memberNames[i]] = memberValues[i];
|
actionNameToIdMap[memberNames[i]] = memberValues[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ struct RootEntry {
|
||||||
version (Windows) {
|
version (Windows) {
|
||||||
import win32.windows;
|
import win32.windows;
|
||||||
uint mask = GetLogicalDrives();
|
uint mask = GetLogicalDrives();
|
||||||
for (int i = 0; i < 26; i++) {
|
foreach(int i; 0 .. 26) {
|
||||||
if (mask & (1 << i)) {
|
if (mask & (1 << i)) {
|
||||||
char letter = cast(char)('A' + i);
|
char letter = cast(char)('A' + i);
|
||||||
string path = "" ~ letter ~ ":\\";
|
string path = "" ~ letter ~ ":\\";
|
||||||
|
@ -257,8 +257,8 @@ bool isPathDelimiter(char ch) {
|
||||||
/** Returns current executable path only, including last path delimiter - removes executable name from result of std.file.thisExePath() */
|
/** Returns current executable path only, including last path delimiter - removes executable name from result of std.file.thisExePath() */
|
||||||
@property string exePath() {
|
@property string exePath() {
|
||||||
string path = thisExePath();
|
string path = thisExePath();
|
||||||
int lastSlash = 0;
|
ulong lastSlash = 0;
|
||||||
for (int i = 0; i < path.length; i++)
|
foreach(i; 0 .. path.length)
|
||||||
if (path[i] == PATH_DELIMITER)
|
if (path[i] == PATH_DELIMITER)
|
||||||
lastSlash = i;
|
lastSlash = i;
|
||||||
return path[0 .. lastSlash + 1];
|
return path[0 .. lastSlash + 1];
|
||||||
|
@ -346,8 +346,8 @@ char[] appendPath(char[] buf, string[] pathItems ...) {
|
||||||
/** Split path into elements, e.g. /home/user/dir1 -> ["home", "user", "dir1"], "c:\dir1\dir2" -> ["c:", "dir1", "dir2"] */
|
/** Split path into elements, e.g. /home/user/dir1 -> ["home", "user", "dir1"], "c:\dir1\dir2" -> ["c:", "dir1", "dir2"] */
|
||||||
string[] splitPath(string path) {
|
string[] splitPath(string path) {
|
||||||
string[] res;
|
string[] res;
|
||||||
int start = 0;
|
ulong start = 0;
|
||||||
for (int i = 0; i <= path.length; i++) {
|
foreach(i; 0 .. path.length + 1) {
|
||||||
char ch = i < path.length ? path[i] : 0;
|
char ch = i < path.length ? path[i] : 0;
|
||||||
if (ch == '\\' || ch == '/' || ch == 0) {
|
if (ch == '\\' || ch == '/' || ch == 0) {
|
||||||
if (start < i)
|
if (start < i)
|
||||||
|
|
|
@ -242,13 +242,13 @@ struct UIStringCollection {
|
||||||
void remove(int index) {
|
void remove(int index) {
|
||||||
if (index < 0 || index >= _length)
|
if (index < 0 || index >= _length)
|
||||||
return;
|
return;
|
||||||
for (size_t i = index; i < _length - 1; i++)
|
foreach(i; index .. _length - 1)
|
||||||
_items[i] = _items[i + 1];
|
_items[i] = _items[i + 1];
|
||||||
_length--;
|
_length--;
|
||||||
}
|
}
|
||||||
/** Return index of first item with specified text or -1 if not found. */
|
/** Return index of first item with specified text or -1 if not found. */
|
||||||
int indexOf(dstring str) const {
|
int indexOf(dstring str) const {
|
||||||
for (int i = 0; i < _length; i++) {
|
foreach(i; 0 .. _length) {
|
||||||
if (_items[i].value.equal(str))
|
if (_items[i].value.equal(str))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ struct UIStringCollection {
|
||||||
}
|
}
|
||||||
/** Return index of first item with specified string resource id or -1 if not found. */
|
/** Return index of first item with specified string resource id or -1 if not found. */
|
||||||
int indexOf(string strId) const {
|
int indexOf(string strId) const {
|
||||||
for (int i = 0; i < _length; i++) {
|
foreach(i; 0 .. _length) {
|
||||||
if (_items[i].id.equal(strId))
|
if (_items[i].id.equal(strId))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,17 +144,17 @@ class OutputLineStream {
|
||||||
case UTF8:
|
case UTF8:
|
||||||
default:
|
default:
|
||||||
char[4] d;
|
char[4] d;
|
||||||
for (int i = 0; i < s.length; i++) {
|
foreach(i; 0 .. s.length) {
|
||||||
int bytes = cast(int)encode(d, s[i]);
|
int bytes = cast(int)encode(d, s[i]);
|
||||||
for (int j = 0; j < bytes; j++)
|
foreach(j; 0 .. bytes)
|
||||||
_buf[_len++] = d[j];
|
_buf[_len++] = d[j];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UTF16BE:
|
case UTF16BE:
|
||||||
wchar[2] d;
|
wchar[2] d;
|
||||||
for (int i = 0; i < s.length; i++) {
|
foreach(i; 0 .. s.length) {
|
||||||
int n = cast(int)encode(d, s[i]);
|
int n = cast(int)encode(d, s[i]);
|
||||||
for (int j = 0; j < n; j++) {
|
foreach(j; 0 .. n) {
|
||||||
_buf[_len++] = cast(char)(d[j] >> 8);
|
_buf[_len++] = cast(char)(d[j] >> 8);
|
||||||
_buf[_len++] = cast(char)(d[j] & 0xFF);
|
_buf[_len++] = cast(char)(d[j] & 0xFF);
|
||||||
}
|
}
|
||||||
|
@ -162,16 +162,16 @@ class OutputLineStream {
|
||||||
break;
|
break;
|
||||||
case UTF16LE:
|
case UTF16LE:
|
||||||
wchar[2] d;
|
wchar[2] d;
|
||||||
for (int i = 0; i < s.length; i++) {
|
foreach(i; 0 .. s.length) {
|
||||||
int n = cast(int)encode(d, s[i]);
|
int n = cast(int)encode(d, s[i]);
|
||||||
for (int j = 0; j < n; j++) {
|
foreach(j; 0 .. n) {
|
||||||
_buf[_len++] = cast(char)(d[j] & 0xFF);
|
_buf[_len++] = cast(char)(d[j] & 0xFF);
|
||||||
_buf[_len++] = cast(char)(d[j] >> 8);
|
_buf[_len++] = cast(char)(d[j] >> 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UTF32LE:
|
case UTF32LE:
|
||||||
for (int i = 0; i < s.length; i++) {
|
foreach(i; 0 .. s.length) {
|
||||||
dchar ch = s[i];
|
dchar ch = s[i];
|
||||||
_buf[_len++] = cast(char)((ch >> 0) & 0xFF);
|
_buf[_len++] = cast(char)((ch >> 0) & 0xFF);
|
||||||
_buf[_len++] = cast(char)((ch >> 8) & 0xFF);
|
_buf[_len++] = cast(char)((ch >> 8) & 0xFF);
|
||||||
|
@ -180,7 +180,7 @@ class OutputLineStream {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UTF32BE:
|
case UTF32BE:
|
||||||
for (int i = 0; i < s.length; i++) {
|
foreach(i; 0 .. s.length) {
|
||||||
dchar ch = s[i];
|
dchar ch = s[i];
|
||||||
_buf[_len++] = cast(char)((ch >> 24) & 0xFF);
|
_buf[_len++] = cast(char)((ch >> 24) & 0xFF);
|
||||||
_buf[_len++] = cast(char)((ch >> 16) & 0xFF);
|
_buf[_len++] = cast(char)((ch >> 16) & 0xFF);
|
||||||
|
@ -315,7 +315,7 @@ class LineStream {
|
||||||
if (_streamEof || bytesLeft > QUARTER_BYTE_BUFFER_SIZE)
|
if (_streamEof || bytesLeft > QUARTER_BYTE_BUFFER_SIZE)
|
||||||
return bytesLeft;
|
return bytesLeft;
|
||||||
if (_pos > 0) {
|
if (_pos > 0) {
|
||||||
for (uint i = 0; i < bytesLeft; i++)
|
foreach(i; 0 .. bytesLeft)
|
||||||
_buf[i] = _buf[i + _pos];
|
_buf[i] = _buf[i + _pos];
|
||||||
_len = bytesLeft;
|
_len = bytesLeft;
|
||||||
_pos = 0;
|
_pos = 0;
|
||||||
|
@ -347,7 +347,7 @@ class LineStream {
|
||||||
if (_textPos > _textBuf.length / 2) {
|
if (_textPos > _textBuf.length / 2) {
|
||||||
uint charCount = _textLen - _textPos;
|
uint charCount = _textLen - _textPos;
|
||||||
dchar * p = _textBuf.ptr;
|
dchar * p = _textBuf.ptr;
|
||||||
for (uint i = 0; i < charCount; i++)
|
foreach(i; 0 .. charCount)
|
||||||
p[i] = p[i + _textPos];
|
p[i] = p[i + _textPos];
|
||||||
_textLen = charCount;
|
_textLen = charCount;
|
||||||
_textPos = 0;
|
_textPos = 0;
|
||||||
|
@ -479,7 +479,7 @@ class LineStream {
|
||||||
public static LineStream create(string code, string filename = "") {
|
public static LineStream create(string code, string filename = "") {
|
||||||
uint len = cast(uint)code.length;
|
uint len = cast(uint)code.length;
|
||||||
ubyte[] data = new ubyte[len + 3];
|
ubyte[] data = new ubyte[len + 3];
|
||||||
for (uint i = 0; i < len; i++)
|
foreach(i; 0 .. len)
|
||||||
data[i + 3] = code[i];
|
data[i + 3] = code[i];
|
||||||
// BOM for UTF8
|
// BOM for UTF8
|
||||||
data[0] = 0xEF;
|
data[0] = 0xEF;
|
||||||
|
|
|
@ -250,7 +250,7 @@ final class Setting {
|
||||||
if (index >= list.length) {
|
if (index >= list.length) {
|
||||||
int oldlen = cast(int)list.length;
|
int oldlen = cast(int)list.length;
|
||||||
list.length = index + 1;
|
list.length = index + 1;
|
||||||
for (int i = oldlen; i < index; i++)
|
foreach(i; oldlen .. index)
|
||||||
list[i] = new Setting(); // insert NULL items in holes
|
list[i] = new Setting(); // insert NULL items in holes
|
||||||
}
|
}
|
||||||
list[index] = value;
|
list[index] = value;
|
||||||
|
@ -268,7 +268,7 @@ final class Setting {
|
||||||
Setting res = get(index);
|
Setting res = get(index);
|
||||||
if (!res)
|
if (!res)
|
||||||
return null;
|
return null;
|
||||||
for (int i = index; i < list.length - 1; i++)
|
foreach(i; index .. list.length - 1)
|
||||||
list[i] = list[i + 1];
|
list[i] = list[i + 1];
|
||||||
list[$ - 1] = null;
|
list[$ - 1] = null;
|
||||||
list.length--;
|
list.length--;
|
||||||
|
@ -280,7 +280,7 @@ final class Setting {
|
||||||
/// deep copy
|
/// deep copy
|
||||||
void copyFrom(ref SettingArray v) {
|
void copyFrom(ref SettingArray v) {
|
||||||
list.length = v.list.length;
|
list.length = v.list.length;
|
||||||
for(int i = 0; i < v.list.length; i++) {
|
foreach(i; 0 .. v.list.length) {
|
||||||
list[i] = v.list[i].clone();
|
list[i] = v.list[i].clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ final class Setting {
|
||||||
Setting res = get(index);
|
Setting res = get(index);
|
||||||
if (!res)
|
if (!res)
|
||||||
return null;
|
return null;
|
||||||
for (int i = index; i < list.length - 1; i++)
|
foreach(i; index .. list.length - 1)
|
||||||
list[i] = list[i + 1];
|
list[i] = list[i + 1];
|
||||||
list[$ - 1] = null;
|
list[$ - 1] = null;
|
||||||
list.length--;
|
list.length--;
|
||||||
|
@ -361,7 +361,7 @@ final class Setting {
|
||||||
/// deep copy
|
/// deep copy
|
||||||
void copyFrom(SettingMap * v) {
|
void copyFrom(SettingMap * v) {
|
||||||
list.length = v.list.length;
|
list.length = v.list.length;
|
||||||
for(int i = 0; i < v.list.length; i++) {
|
foreach(i; 0 .. v.list.length) {
|
||||||
list[i] = v.list[i].clone();
|
list[i] = v.list[i].clone();
|
||||||
}
|
}
|
||||||
destroy(map);
|
destroy(map);
|
||||||
|
@ -541,7 +541,7 @@ final class Setting {
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
case OBJECT:
|
case OBJECT:
|
||||||
string[] res;
|
string[] res;
|
||||||
for(int i = 0; i < length; i++)
|
foreach(i; 0 .. length)
|
||||||
res ~= this[i].str;
|
res ~= this[i].str;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -570,7 +570,7 @@ final class Setting {
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
case OBJECT:
|
case OBJECT:
|
||||||
int[] res;
|
int[] res;
|
||||||
for(int i = 0; i < length; i++)
|
foreach(i; 0 .. length)
|
||||||
res ~= cast(int)this[i].integer;
|
res ~= cast(int)this[i].integer;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ final class Setting {
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
case OBJECT:
|
case OBJECT:
|
||||||
Setting[] res;
|
Setting[] res;
|
||||||
for(int i = 0; i < length; i++)
|
foreach(i; 0 .. length)
|
||||||
res ~= this[i];
|
res ~= this[i];
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -1412,7 +1412,7 @@ final class Setting {
|
||||||
|
|
||||||
void appendTabs(int level) {
|
void appendTabs(int level) {
|
||||||
reserve(level * 4 + 1024);
|
reserve(level * 4 + 1024);
|
||||||
for(int i = 0; i < level; i++) {
|
foreach(i; 0 .. level) {
|
||||||
buffer[pos++] = ' ';
|
buffer[pos++] = ' ';
|
||||||
buffer[pos++] = ' ';
|
buffer[pos++] = ' ';
|
||||||
buffer[pos++] = ' ';
|
buffer[pos++] = ' ';
|
||||||
|
@ -1506,7 +1506,7 @@ final class Setting {
|
||||||
buf.append('[');
|
buf.append('[');
|
||||||
if (pretty && _store.array.length > 0)
|
if (pretty && _store.array.length > 0)
|
||||||
buf.appendEOL();
|
buf.appendEOL();
|
||||||
for (int i = 0; i < _store.array.length; i++) {
|
foreach(i; 0 .. _store.array.length) {
|
||||||
if (pretty)
|
if (pretty)
|
||||||
buf.appendTabs(level + 1);
|
buf.appendTabs(level + 1);
|
||||||
_store.array.get(i).toJSON(buf, level + 1, pretty);
|
_store.array.get(i).toJSON(buf, level + 1, pretty);
|
||||||
|
@ -1590,7 +1590,7 @@ final class Setting {
|
||||||
int line = 1;
|
int line = 1;
|
||||||
int col = 1;
|
int col = 1;
|
||||||
int lineStart = 0;
|
int lineStart = 0;
|
||||||
for (int i = 0; i < pos; i++) {
|
foreach(int i; 0 .. pos) {
|
||||||
char ch = json[i];
|
char ch = json[i];
|
||||||
if (ch == '\r') {
|
if (ch == '\r') {
|
||||||
if (i < json.length - 1 && json[i + 1] == '\n')
|
if (i < json.length - 1 && json[i + 1] == '\n')
|
||||||
|
@ -1656,7 +1656,7 @@ final class Setting {
|
||||||
if (pos >= json.length - 3)
|
if (pos >= json.length - 3)
|
||||||
error("unexpected end of file while parsing unicode character entity inside string");
|
error("unexpected end of file while parsing unicode character entity inside string");
|
||||||
dchar ch = 0;
|
dchar ch = 0;
|
||||||
for (int i = 0; i < 4; i++) {
|
foreach(i; 0 .. 4) {
|
||||||
int d = parseHexDigit(nextChar);
|
int d = parseHexDigit(nextChar);
|
||||||
if (d < 0)
|
if (d < 0)
|
||||||
error("error while parsing unicode character entity inside string");
|
error("error while parsing unicode character entity inside string");
|
||||||
|
@ -1741,7 +1741,7 @@ final class Setting {
|
||||||
// returns true if parsed ok
|
// returns true if parsed ok
|
||||||
if (pos + ident.length > json.length)
|
if (pos + ident.length > json.length)
|
||||||
return false;
|
return false;
|
||||||
for (int i = 0; i < ident.length; i++) {
|
foreach(i; 0 .. ident.length) {
|
||||||
if (ident[i] != json[pos + i])
|
if (ident[i] != json[pos + i])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1921,7 +1921,7 @@ long parseLong(inout string v, long defValue = 0) {
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
long value = 0;
|
long value = 0;
|
||||||
int digits = 0;
|
int digits = 0;
|
||||||
for (int i = 0; i < len; i++) {
|
foreach(i; 0 .. len) {
|
||||||
char ch = v[i];
|
char ch = v[i];
|
||||||
if (ch == '-') {
|
if (ch == '-') {
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
|
@ -1943,7 +1943,7 @@ ulong parseULong(inout string v, ulong defValue = 0) {
|
||||||
return defValue;
|
return defValue;
|
||||||
ulong value = 0;
|
ulong value = 0;
|
||||||
int digits = 0;
|
int digits = 0;
|
||||||
for (int i = 0; i < len; i++) {
|
foreach(i; 0 .. len) {
|
||||||
char ch = v[i];
|
char ch = v[i];
|
||||||
if (ch >= '0' && ch <= '9') {
|
if (ch >= '0' && ch <= '9') {
|
||||||
digits++;
|
digits++;
|
||||||
|
|
Loading…
Reference in New Issue