};
-// Allocator for use when no new c++ heap allocation is allowed.
-// Given a preallocated buffer up front and does no allocation while
-// building message.
-class NoAllocationStringAllocator V8_FINAL : public StringAllocator {
- public:
- NoAllocationStringAllocator(char* memory, unsigned size);
- virtual char* allocate(unsigned bytes) V8_OVERRIDE { return space_; }
- virtual char* grow(unsigned* bytes) V8_OVERRIDE;
-
- private:
- unsigned size_;
- char* space_;
-};
-
-
class FmtElm V8_FINAL {
public:
FmtElm(int value) : type_(INT) { // NOLINT
DISALLOW_IMPLICIT_CONSTRUCTORS(StringStream);
};
-
-// 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_;
-};
-
} } // namespace v8::internal
#endif // V8_STRING_STREAM_H_