summaryrefslogtreecommitdiffstats
path: root/src/test/old/testbuffers.cc
blob: be2298ff838d158cfdf38af8e0ff2084b8e942c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
using namespace std;

#include "include/bufferlist.h"


int main()
{

  bufferptr p1 = new buffer("123456",6);
  bufferptr p2 = p1;

  cout << "it is '" << p1.c_str() << "'" << endl;

  bufferptr p3 = new buffer("abcdef",6);
  
  cout << "p3 is " << p3 << endl;

  bufferlist bl;
  bl.push_back(p2);
  bl.push_back(p1);
  bl.push_back(p3);

  cout << "bl is " << bl << endl;

  cout << "len is " << bl.length() << endl;

  bufferlist took;
  bl.splice(10,4,&took);

  cout << "took out " << took << "leftover is " << bl << endl;
  //cout << "len is " << bl.length() << endl;

  bufferlist bl2;
  bl2.substr_of(bl, 3, 5);
  cout << "bl2 is " << bl2 << endl;
  

}