| 3836 | } |
| 3837 | |
| 3838 | void Value::setComment(String comment, CommentPlacement placement) { |
| 3839 | if (!comment.empty() && (comment.back() == '\n')) { |
| 3840 | // Always discard trailing newline, to aid indentation. |
| 3841 | comment.pop_back(); |
| 3842 | } |
| 3843 | JSON_ASSERT(!comment.empty()); |
| 3844 | JSON_ASSERT_MESSAGE( |
| 3845 | comment[0] == '\0' || comment[0] == '/', |
| 3846 | "in Json::Value::setComment(): Comments must start with /"); |
| 3847 | comments_.set(placement, std::move(comment)); |
| 3848 | } |
| 3849 | |
| 3850 | bool Value::hasComment(CommentPlacement placement) const { |
| 3851 | return comments_.has(placement); |
no test coverage detected