LXRAD 0.7

mstring.h
Go to the documentation of this file.
1/* ########################################################################
2
3 LXRAD - GUI for X programing
4
5 ########################################################################
6
7 Copyright (c) : 2001 Luis Claudio Gamboa Lopes
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 For e-mail suggestions : lcgamboa@yahoo.com
24 ######################################################################## */
25
32#ifndef MSTRING
33#define MSTRING
34
35#include<stdio.h>
36#include<stdlib.h>
37#include<string.h>
38#include<ctype.h>
39
40
41#ifdef _MSTRING
42
43
44 class lxString
45{
46 private:
47 char *Str;
48 public:
49 lxString (void);
50 lxString (const lxString & str);
51 lxString (const char &str);
52 lxString (const char *str);
53 lxString (const char *str, int size);
54 ~lxString (void);
55 const char *c_str (void) const;
56 int compare (const char *str) const;
57 int compare (const lxString & str) const;
58 uint size (void) const;
59 uint length (void) const;
60 lxString substr (uint start, uint length) const;
61 int find (const lxString & str) const;
62 int rfind (const lxString & str) const;
63 int erase (uint start, int num);
64 int copy (char *str, uint sz) const;
65 lxString & operator = (const lxString & str);
66 lxString & operator = (const char *str);
67 lxString operator + (const lxString & str);
68 lxString operator + (const char *str);
69 lxString operator + (const char &str);
70 lxString & operator += (const lxString & str);
71 lxString & operator += (const char *str);
72 lxString & operator += (const char &str);
73 char &operator[] (const uint & index);
74 friend lxString operator + (const char *str1, const lxString & str2);
75 friend lxString operator + (const char &str1, const lxString & str2);
76// friend ostream & operator << (ostream & os, const lxString & str);
77};
78
79#endif
80
81 class lxStringList
82{
83 private:
84 lxString * Lines;
85 int LinesCount;
86 public:
87 lxStringList (void);
88 lxStringList (const lxStringList & list);
89 ~lxStringList (void);
90 void Create ();
91 void Clear ();
92 void AddLine (const lxString line);
93 void InsertLine (lxString line, uint linen);
94 void DelLine (uint linen);
95 bool LoadFromFile (lxString fname);
96 bool SaveToFile (lxString fname);
97 bool AppendToFile (lxString fname);
98 lxStringList & operator = (const lxStringList & list);
99 //propiedades
100 lxString GetLine (uint linen) const;
101#ifdef __UNICODE__
102 const wchar_t *GetLineStr (uint linen) const;
103#else
104 const char *GetLineStr (uint linen) const;
105#endif
106 void SetLine (lxString line, uint linen);
107 uint GetLinesCount (void) const;
108 lxString GetBuffer (void);
109 void SetBuffer (lxString buff);
110};
111
112/*
113#else
114
115 using namespace std;
116#include<string>
117#include<iostream>
118#include<fstream>
119#include<list>
120
121
122 class lxStringList
123{
124 private:
125 list < string > List;
126 list < string >::iterator itList;
127 public:
128 lxStringList (void);
129 lxStringList (const lxStringList & list);
130 ~lxStringList (void);
131 void Create ();
132 void Clear ();
133 void AddLine (string line);
134 void InsertLine (string line, uint linen);
135 void DelLine (uint linen);
136 bool LoadFromFile (string fname);
137 bool SaveToFile (string fname);
138 bool AppendToFile (string fname);
139 //propiedades
140 string GetLine (uint linen) const;
141 const char *GetLineStr (uint linen) const;
142 void SetLine (string line, uint linen);
143 uint GetLinesCount (void) const;
144 string GetBuffer (void);
145 void SetBuffer (string buff);
146};
147#endif
148*/
149
150
151lxString xml_out (lxString name, lxString type, lxString value);
152 void xml_in (lxString data, lxString & name, lxString & type, lxString & value);
153
154/*Deprecate*/
155lxString eqparse (lxString & str, lxString & arg);
156
157lxString LocaleToUtf8 (const lxString str);
158lxString LocaleFromUtf8 (const lxString str);
159
160lxString strndel (const lxString & str, uint n);
161lxString strnadd (const lxString & str, char c, uint n);
162 int atoi (const lxString & str);
163 float atof (const lxString & str);
164 bool atob (const lxString & str);
165lxString itoa (int n, const lxString & format = wxT("%i"));
166lxString itoa (uint n, const lxString & format = wxT("%u"));
167lxString itoa (long n, const lxString & format = wxT("%li"));
168lxString ftoa (float f, const lxString & format = wxT("%f"));
169lxString btoa (bool b);
170
177lxString uppercase (const lxString & str);
184lxString lowercase (const lxString & str);
185
186lxString basename (const lxString & str);
187lxString dirname (const lxString & str);
188
189 bool fgetline (wxTextFile &file, lxString & str);
190
191 void mprint (lxString str);
192
193 void eprint (lxString str);
194
195
196#endif
lxStringList
Definition: mstring.h:82
lowercase
lxString lowercase(const lxString &str)
uppercase
lxString uppercase(const lxString &str)