File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -317,8 +317,10 @@ namespace Json {
317317// EnumValues enumValues() const;
318318// # endif
319319
320+ // / Comments must be //... or /* ... */
320321 void setComment ( const char *comment,
321322 CommentPlacement placement );
323+ // / Comments must be //... or /* ... */
322324 void setComment ( const std::string &comment,
323325 CommentPlacement placement );
324326 bool hasComment ( CommentPlacement placement ) const ;
Original file line number Diff line number Diff line change 1+ #include < iostream>
12#include < json/value.h>
23#include < json/writer.h>
34#include < utility>
@@ -149,6 +150,9 @@ Value::CommentInfo::setComment( const char *text )
149150{
150151 if ( comment_ )
151152 valueAllocator ()->releaseStringValue ( comment_ );
153+ JSON_ASSERT ( text );
154+ JSON_ASSERT_MESSAGE ( text[0 ]==NULL || text[0 ]==' /' , " Comments must start with /" );
155+ // It seems that /**/ style comments are acceptable as well.
152156 comment_ = valueAllocator ()->duplicateStringValue ( text );
153157}
154158
You can’t perform that action at this time.
0 commit comments