| 4128 | } |
| 4129 | |
| 4130 | void Value::setComment(String comment, CommentPlacement placement) |
| 4131 | { |
| 4132 | if (!comment.empty() && (comment.back() == '\n')) |
| 4133 | { |
| 4134 | // Always discard trailing newline, to aid indentation. |
| 4135 | comment.pop_back(); |
| 4136 | } |
| 4137 | JSON_ASSERT(!comment.empty()); |
| 4138 | JSON_ASSERT_MESSAGE(comment[0] == '\0' || comment[0] == '/', |
| 4139 | "in Json::Value::setComment(): Comments must start with /"); |
| 4140 | comments_.set(placement, std::move(comment)); |
| 4141 | } |
| 4142 | |
| 4143 | bool Value::hasComment(CommentPlacement placement) const { return comments_.has(placement); } |
| 4144 |
no test coverage detected