| 1409 | } |
| 1410 | |
| 1411 | void Value::setComment(String comment, CommentPlacement placement) { |
| 1412 | if (!comment.empty() && (comment.back() == '\n')) { |
| 1413 | // Always discard trailing newline, to aid indentation. |
| 1414 | comment.pop_back(); |
| 1415 | } |
| 1416 | JSON_ASSERT_MESSAGE( |
| 1417 | comment.empty() || comment[0] == '/', |
| 1418 | "in Json::Value::setComment(): Comments must start with /"); |
| 1419 | comments_.set(placement, std::move(comment)); |
| 1420 | } |
| 1421 | |
| 1422 | bool Value::hasComment(CommentPlacement placement) const { |
| 1423 | return comments_.has(placement); |