net: socket system, high level api
[quarnos.git] / libs / string.h
blobe092ec68375797937b494835747767c9469b12f1
1 /* Quarn OS
3 * String
5 * Copyright (C) 2008-2009 Pawel Dziepak
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef _STRING_H_
24 #define _STRING_H_
26 #include "libs/delegate.h"
27 #include "buffer.h"
28 /*#include "manes/obj_val.h"
29 #include "manes/object_stream.h"*/
31 class string /*: public manes::ods::obj_val */{
32 protected:
33 char *data;
34 char error;
35 int used;
37 void save(const char*);
38 public:
39 string(const char*);
40 string(const string &);
42 string(const unsigned int);
43 string(const unsigned int, bool);
45 string(int);
47 string();
48 ~string();
50 int length() const;
51 void reverse();
53 char &operator[](const int);
54 const char &operator[](const int) const;
56 bool operator==(const char*) const;
57 bool operator==(const string&) const;
58 bool operator!=(const string&x) const {
59 return !operator==(x);
62 operator const char*() const;
64 bool null() const;
66 string operator+(const int) const;
67 string operator+(const string&) const;
69 void operator+=(const string&);
71 void operator=(const string&);
72 static bool is_digit(char);
74 buffer to_mem() const;
76 // void serialize(manes::ods::object_stream &ostr) { }
77 //void deserialize(manes::ods::object_stream &ostr) { }
81 /* C-style functions */
82 int strlen(const char *);
83 int strcmp(const char *, const char*);
84 int strncmp(const char *, const char*, int);
85 char *strcpy(char *, const char *);
86 char *strncpy(char *, const char *, int);
87 char *strcat(char *, const char *);
89 void *memcpy(void *, const void *, int);
90 void *memset(void *, int, int);
92 #endif