-
-// Utility class to print a list of items to a stream, divided by a separator.
-class SimpleListPrinter V8_FINAL {
- public:
- explicit SimpleListPrinter(StringStream* stream, char separator = ',') {
- separator_ = separator;
- stream_ = stream;
- first_ = true;
- }
-
- void Add(const char* str) {
- if (first_) {
- first_ = false;
- } else {
- stream_->Put(separator_);
- }
- stream_->Add(str);
- }
-
- private:
- bool first_;
- char separator_;
- StringStream* stream_;
-};
-