Mistake on this page? Email us
m2mstringbufferbase.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 ARM Limited. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  * Licensed under the Apache License, Version 2.0 (the License); you may
5  * not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef __STRING_BUFFER_BASE_H__
17 #define __STRING_BUFFER_BASE_H__
18 
19 #include <stdint.h>
20 #include <stddef.h>
21 
27 {
28 protected:
29 
30  // inline version of this produces smaller code
31  inline StringBufferBase();
32 
33  // all the docs are at template level, as it is the only public API
34 
35  bool ensure_space(size_t max_size, size_t required_size) const;
36 
37  bool append(char *buff, size_t max_size, char data);
38 
39  bool append(char *buff, size_t max_size, const char *data);
40 
41  bool append(char *buff, size_t max_size, const char *data, size_t data_len);
42 
43  bool append_int(char *buff, size_t max_size, uint16_t data);
44 
45  int find_last_of(const char *buff, char search_char) const;
46 
47 protected:
48  //const size_t _max_size;
49  size_t _curr_size;
50 };
51 
52 inline StringBufferBase::StringBufferBase() : _curr_size(0)
53 {
54 }
55 
56 #endif // !__STRING_BUFFER_BASE_H__
Definition: m2mstringbufferbase.h:26