usb: getting string descriptors, minor improvements
[quarnos.git] / libs / string.h
blob98539a665cb53fe57a8278a901e8446586cea50a
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;
64 const char *to_ascii() const;
66 static string from_utf16(char*);
68 bool null() const;
70 string operator+(const int) const;
71 string operator+(const string&) const;
73 void operator+=(const string&);
75 void operator=(const string&);
76 static bool is_digit(char);
78 list<string> split(char) const;
80 buffer to_mem() const;
82 // void serialize(manes::ods::object_stream &ostr) { }
83 //void deserialize(manes::ods::object_stream &ostr) { }
87 /* C-style functions */
88 int strlen(const char *);
89 int strcmp(const char *, const char*);
90 int strncmp(const char *, const char*, int);
91 char *strcpy(char *, const char *);
92 char *strncpy(char *, const char *, int);
93 char *strcat(char *, const char *);
95 void *memcpy(void *, const void *, int);
96 void *memset(void *, int, int);
98 #endif