Temp fork

Dependents:   Seeed_GPRS_Shield

Fork of GPRSInterface by wei zou

Files at this revision

API Documentation at this revision

Comitter:
lawliet
Date:
Tue Feb 25 06:00:32 2014 +0000
Parent:
1:7298a7950f65
Child:
3:acf2ea413e72
Commit message:
version 1.1

Changed in this revision

pico_string.h Show diff for this revision Revisions of this file
--- 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