summaryrefslogtreecommitdiff
path: root/utils/String.h
blob: b411dc05fea978ffc483c6f0b47b5e47ce9e50dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *	CENA C++ Utilities
 *
 *	by Stephane Chatty
 *
 *	Copyright 1991, 1992
 *	Laboratoire de Recherche en Informatique (LRI)
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	IvlString allocation and copying
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef String_H_
#define String_H_

#include "cplus_bugs.h"

/*? class StringMemory ?*/
extern	char*	NewString (const char*);
extern	char*	NewString (const char*, int);
extern	char*	NewString (int);
extern	void	FreeString (char*);
/*? end ?*/

class IvlShadowString;

class IvlString {
private:
	char*	Str;
public:
inline		IvlString ()		{ Str = 0; }
		IvlString (const char*);
		IvlString (const char*, int);
		IvlString (int);
		IvlString (const IvlString&);
		IvlString (const IvlShadowString&);
		~IvlString ();
inline	operator	const char* () const		{ return Str; }
	IvlString&	operator = (const IvlString&);
	IvlString&	operator = (const char*);
	IvlString&	operator = (const IvlShadowString&);
	IvlString&	Assign (const char*, int);
	int	Length () const;
};

class IvlShadowString {
private:
	const char*	Str;
public:
inline		IvlShadowString ()	{ Str = 0; }
		IvlShadowString (const char*);
		IvlShadowString (const IvlString&);
inline	IvlShadowString&	operator = (const IvlString& s)	{ Str = (const char*) s; return *this; }
inline	IvlShadowString&	operator = (const char* s)	{ Str = s; return *this; }
inline	operator	const char* () const		{ return Str; }
	int	Length () const;
};

#endif	/* String_H_ */