src/lib/BasicUnescapingProcessor.h
branchv_0
changeset 36 b4fbf2772cfd
parent 33 3b81fbeb5f3b
equal deleted inserted replaced
35:930f17f16fd7 36:b4fbf2772cfd
    36 		for (int i = 0, length = s.size(); i < length; i++) {
    36 		for (int i = 0, length = s.size(); i < length; i++) {
    37 			char ch = s[i];
    37 			char ch = s[i];
    38 			if (i + 1 < length && ch == ESC) {
    38 			if (i + 1 < length && ch == ESC) {
    39 				ch = s[i + 1];
    39 				ch = s[i + 1];
    40 				if (ch == 'n') put(result, '\n', i);
    40 				if (ch == 'n') put(result, '\n', i);
    41 				else if (ch == 'r') put(result, '\r', i);
    41 				else if (ch == 'r') put(result, '\r', i); // TODO: should be 0x0d, not 0x0a like \n
    42 				else if (ch == 't') put(result, '\t', i);
    42 				else if (ch == 't') put(result, '\t', i);
    43 				else if (ch == 's') put(result, ' ', i); // TODO: Reconsider what is „basic“ escaping and should be supported.
    43 				else if (ch == 's') put(result, ' ', i); // TODO: Reconsider what is „basic“ escaping and should be supported.
    44 				else if (ch == '"') put(result, ch, i); //        The delimiters (\n,]",') are already unescaped during the first stage in the INIReader while parsing (the delimiter relevant to given environment is unescaped, e.g. \" in "quoted" value).
    44 				else if (ch == '"') put(result, ch, i); //        The delimiters (\n,]",') are already unescaped during the first stage in the INIReader while parsing (the delimiter relevant to given environment is unescaped, e.g. \" in "quoted" value).
    45 				else if (ch == '\'') put(result, ch, i); //       So it does not necessary to do it here. But someone might write a="xxx\'zzz" however it is superfluous because a="xxx'zzz" will also work.
    45 				else if (ch == '\'') put(result, ch, i); //       So it does not necessary to do it here. But someone might write a="xxx\'zzz" however it is superfluous because a="xxx'zzz" will also work.
    46 				else if (ch == '[') put(result, ch, i);
    46 				else if (ch == '[') put(result, ch, i);