OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_TOOLS_FLIP_SERVER_SIMPLE_BUFFER_H__ | 5 #ifndef NET_TOOLS_FLIP_SERVER_SIMPLE_BUFFER_H__ |
6 #define NET_TOOLS_FLIP_SERVER_SIMPLE_BUFFER_H__ | 6 #define NET_TOOLS_FLIP_SERVER_SIMPLE_BUFFER_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "net/tools/flip_server/buffer_interface.h" | 11 #include "net/tools/flip_server/buffer_interface.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 class SimpleBuffer : public BufferInterface { | 15 class SimpleBuffer : public BufferInterface { |
16 public: | 16 public: |
17 SimpleBuffer(); | 17 SimpleBuffer(); |
18 explicit SimpleBuffer(int size); | 18 explicit SimpleBuffer(int size); |
19 virtual ~SimpleBuffer() { | 19 virtual ~SimpleBuffer(); |
20 delete[] storage_; | |
21 } | |
22 | 20 |
23 std::string str() const; | 21 std::string str() const; |
24 | 22 |
25 typedef char * iterator; | 23 typedef char * iterator; |
26 typedef const char * const_iterator; | 24 typedef const char * const_iterator; |
27 | 25 |
28 iterator begin() { return storage_ + read_idx_; } | 26 iterator begin() { return storage_ + read_idx_; } |
29 const_iterator begin() const { return storage_ + read_idx_; } | 27 const_iterator begin() const { return storage_ + read_idx_; } |
30 | 28 |
31 iterator end() { return storage_ + write_idx_; } | 29 iterator end() { return storage_ + write_idx_; } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 int read_idx_; | 83 int read_idx_; |
86 int storage_size_; | 84 int storage_size_; |
87 | 85 |
88 private: | 86 private: |
89 //DISALLOW_COPY_AND_ASSIGN(SimpleBuffer); | 87 //DISALLOW_COPY_AND_ASSIGN(SimpleBuffer); |
90 }; | 88 }; |
91 | 89 |
92 } // namespace net | 90 } // namespace net |
93 | 91 |
94 #endif // NET_TOOLS_FLIP_SERVER_SIMPLE_BUFFER_H__ | 92 #endif // NET_TOOLS_FLIP_SERVER_SIMPLE_BUFFER_H__ |
95 | |
OLD | NEW |