net: dns client, support for A records
[quarnos.git] / libs / string.h
blobf86663cb1a6630fb5674cfe8e3fd76a9014738bb
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"*/
30 #include "list.h"
32 class string /*: public manes::ods::obj_val */{
33 protected:
34 char *data;
35 char error;
36 int used;
38 void save(const char*);
39 public:
40 string(const char*);
41 string(const string &);
43 string(const unsigned int);
44 string(const unsigned int, bool);
46 string(int);
48 string();
49 ~string();
51 int length() const;
52 void reverse();
54 char &operator[](const int);
55 const char &operator[](const int) const;
57 bool operator==(const char*) const;
58 bool operator==(const string&) const;
59 bool operator!=(const string&x) const {
60 return !operator==(x);
63 operator const char*() const;
65 bool null() const;
67 string operator+(const int) const;
68 string operator+(const string&) const;
70 void operator+=(const string&);
72 void operator=(const string&);
73 static bool is_digit(char);
75 list<string> split(char) const;
77 buffer to_mem() const;
79 // void serialize(manes::ods::object_stream &ostr) { }
80 //void deserialize(manes::ods::object_stream &ostr) { }
84 /* C-style functions */
85 int strlen(const char *);
86 int strcmp(const char *, const char*);
87 int strncmp(const char *, const char*, int);
88 char *strcpy(char *, const char *);
89 char *strncpy(char *, const char *, int);
90 char *strcat(char *, const char *);
92 void *memcpy(void *, const void *, int);
93 void *memset(void *, int, int);
95 #endif