Home | History | Annotate | Download | only in nacl_ppapi_util
      1 /*
      2  * Copyright (c) 2011 The Chromium Authors. All rights reserved.
      3  * Use of this source code is governed by a BSD-style license that can be
      4  * found in the LICENSE file.
      5  */
      6 
      7 #ifndef NATIVE_CLIENT_TESTS_MANIFEST_FILE_STRING_BUFFER_H_
      8 #define NATIVE_CLIENT_TESTS_MANIFEST_FILE_STRING_BUFFER_H_
      9 
     10 #include <string>
     11 
     12 #include <stdio.h>
     13 #include <stdlib.h>
     14 #include <inttypes.h>
     15 
     16 namespace nacl {
     17 
     18 class StringBuffer {
     19  public:
     20   StringBuffer();
     21   ~StringBuffer();
     22   void DiscardOutput();
     23   void Printf(char const *fmt, ...) __attribute__((format(printf, 2, 3)));
     24   std::string ToString() {
     25     return std::string(buffer_, insert_);
     26   }
     27 
     28  private:
     29   size_t  nbytes_;
     30   size_t  insert_;
     31   char    *buffer_;
     32 };
     33 
     34 }  // namespace nacl
     35 
     36 #endif
     37