Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BufferedSerial
Dependents: ThinkSpeak_Test roam_v1 roam_v2 finalv3
Fork of GPRSInterface by
Diff: pico_string.h
- Revision:
- 2:8cb3c0d45988
- Parent:
- 1:7298a7950f65
- Child:
- 3:acf2ea413e72
--- a/pico_string.h Tue Feb 25 05:56:19 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- pico_string.h
- 2014 Copyright (c) Seeed Technology Inc. All right reserved.
-
- Author:lawliet zou(lawliet.zou@gmail.com)
- 2014-2-24
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef __PICO_STRING_H__
-
-class pico_string {
-
-public:
- pico_string(){
- _len = 0;
- _buf = (char*)malloc(1);
- if (_buf) {
- _buf[0] = '\0';
- }
- }
- ~pico_string() {
- if (_buf) {
- free(_buf);
- }
- }
- bool empty() {
- return _len == 0;
- }
- void append(const char* s, int len) {
- if (_buf == NULL) {
- return;
- }
- char* p = (char*)malloc(_len+len+1);
- if (p == NULL) {
- return;
- }
- memcpy(p, _buf, _len);
- memcpy(p+_len, s, len);
- p[_len+len] = '\0';
- free(_buf);
- _buf = p;
- }
- void append(const char* s) {
- append(s, strlen(s));
- }
- char* c_str() {
- if (_buf) {
- return _buf;
- }
- return "";
- }
-private:
- char* _buf;
- int _len;
-};
-
-#endif
