| 3847 | } |
| 3848 | |
| 3849 | void Value::setComment(String comment, CommentPlacement placement) { |
| 3850 | if (!comment.empty() && (comment.back() == '\n')) { |
| 3851 | // Always discard trailing newline, to aid indentation. |
| 3852 | comment.pop_back(); |
| 3853 | } |
| 3854 | JSON_ASSERT_MESSAGE( |
| 3855 | comment.empty() || comment[0] == '/', |
| 3856 | "in Json::Value::setComment(): Comments must start with /"); |
| 3857 | comments_.set(placement, std::move(comment)); |
| 3858 | } |
| 3859 | |
| 3860 | bool Value::hasComment(CommentPlacement placement) const { |
| 3861 | return comments_.has(placement); |