reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
DataBuffer.hxx
Go to the documentation of this file.
1#ifndef DATA_BUFFER_HXX
2#define DATA_BUFFER_HXX
3
4#include <cstddef>
5
6namespace reTurn {
7
8void ArrayDeallocator(char* data);
9
11{
12public:
13 typedef void(*deallocator)(char*);
14
18
19 static DataBuffer* own(char* data, size_t size, deallocator dealloc = ArrayDeallocator);
20
21 const char* data() const noexcept;
22 size_t size() const noexcept;
23 char& operator[](size_t p);
24 char operator[](size_t p) const;
25
26 size_t truncate(size_t newSize);
27 size_t offset(size_t bytes);
28
29 char* mutableData() noexcept;
30 size_t& mutableSize() noexcept;
31
33 char* mBuffer;
34 size_t mSize;
35 char* mStart;
36 deallocator mDealloc;
37};
38
39}
40
41#endif
42
43
44/* ====================================================================
45
46 Copyright (c) 2007-2008, Plantronics, Inc.
47 All rights reserved.
48
49 Redistribution and use in source and binary forms, with or without
50 modification, are permitted provided that the following conditions are
51 met:
52
53 1. Redistributions of source code must retain the above copyright
54 notice, this list of conditions and the following disclaimer.
55
56 2. Redistributions in binary form must reproduce the above copyright
57 notice, this list of conditions and the following disclaimer in the
58 documentation and/or other materials provided with the distribution.
59
60 3. Neither the name of Plantronics nor the names of its contributors
61 may be used to endorse or promote products derived from this
62 software without specific prior written permission.
63
64 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
65 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
66 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
67 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
68 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
69 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
70 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
71 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
72 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
73 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
74 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
75
76 ==================================================================== */
static DataBuffer * own(char *data, size_t size, deallocator dealloc=ArrayDeallocator)
size_t offset(size_t bytes)
void(* deallocator)(char *)
char * mutableData() noexcept
const char * data() const noexcept
size_t & mutableSize() noexcept
size_t size() const noexcept
size_t truncate(size_t newSize)
void ArrayDeallocator(char *data)
Definition DataBuffer.cxx:8
void list()
Definition userAdmin.cxx:66