mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-06-07 09:04:57 +02:00
commit
201904bfbb
@ -376,6 +376,9 @@ bool StyledWriter::isMultineArray(const Value& value) {
|
|||||||
addChildValues_ = true;
|
addChildValues_ = true;
|
||||||
int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
|
int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
|
||||||
for (int index = 0; index < size; ++index) {
|
for (int index = 0; index < size; ++index) {
|
||||||
|
if (hasCommentForValue(value[index])) {
|
||||||
|
isMultiLine = true;
|
||||||
|
}
|
||||||
writeValue(value[index]);
|
writeValue(value[index]);
|
||||||
lineLength += int(childValues_[index].length());
|
lineLength += int(childValues_[index].length());
|
||||||
}
|
}
|
||||||
@ -584,6 +587,9 @@ bool StyledStreamWriter::isMultineArray(const Value& value) {
|
|||||||
addChildValues_ = true;
|
addChildValues_ = true;
|
||||||
int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
|
int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
|
||||||
for (int index = 0; index < size; ++index) {
|
for (int index = 0; index < size; ++index) {
|
||||||
|
if (hasCommentForValue(value[index])) {
|
||||||
|
isMultiLine = true;
|
||||||
|
}
|
||||||
writeValue(value[index]);
|
writeValue(value[index]);
|
||||||
lineLength += int(childValues_[index].length());
|
lineLength += int(childValues_[index].length());
|
||||||
}
|
}
|
||||||
|
4
test/data/test_comment_00.expected
Normal file
4
test/data/test_comment_00.expected
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Comment for array
|
||||||
|
.=[]
|
||||||
|
// Comment within array
|
||||||
|
.[0]="one-element"
|
5
test/data/test_comment_00.json
Normal file
5
test/data/test_comment_00.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Comment for array
|
||||||
|
[
|
||||||
|
// Comment within array
|
||||||
|
"one-element"
|
||||||
|
]
|
Loading…
x
Reference in New Issue
Block a user