/*	XString.h
 *
 *		This is my implementation of a string class. I did this
 *	'cause I needed a string class, and the compilers I have access
 *	to don't include the standard C++ string classes.
 */

/*  YAAF - Yet another application framework
 *  Copyright (C) 1997, 1998 William Edward Woody
 *  
 *  This library is free software; you can redistribute it
 *  and/or modify it under the terms of the GNU Library
 *  General Public License as published by the Free Software
 *  Foundation; either version 2 of the License, or any
 *  later version.
 *  
 *  This library is distributed in the hope that it will be
 *  useful, but WITHOUT ANY WARRANTY; without even the implied
 *  warranty of MERCHANTABIILITY or FITNESS FOR A PARTICULAR
 *  PURPOSE. See the GNU Library General Public License for
 *  more details.
 *  
 *  You should have received a copy of the GNU Library General
 *  Public License along with this library; if not, write to the
 *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 *  Boston, MA 02111-1307, USA.
 *  
 *  To contact the author, either e-mail me at woody@pandawave.com, 
 *	or write to
 *  
 *          William Edward Woody
 *          In Phase Consulting
 *          1545 Ard Eevin Avenue
 *          Glendale, CA 91202
 *
 *	Or visit us on the web at http://www.pandawave.com
 */

#ifndef PandaWave_XSTRING
#define PandaWave_XSTRING

#include <XConfig.h>

/************************************************************************/
/*																		*/
/*	Standard Classes													*/
/*																		*/
/************************************************************************/

/*	@C"XGString"
 *	@H"XString.h"
 *	@I
 *
 *		This manages a variable-length C string.
 */

class XGString {
	public:
								XGString();					// create me
								XGString(XGString &);		// copy create me
								XGString(const char *);		// copy create me
		virtual					~XGString();				// delete me
		
		// @G"Copy operator"
		
		/*	@F"XGString::operator ="
		 *	@I
		 *		This copies the XGString object from one to another
		 */
		
		XGString				&operator = (XGString const &x)
									{
										return operator = (x.Get());
									}
		XGString				&operator = (const char *);	// copy C string
		
		/*
		 *	String get/fetch
		 */
		
		// @G"Content access"
		
		/*	@F"XGString::Get"
		 *	@I
		 *		Gets the contents of this string as a C string
		 */
		
		const char				*Get(void) const
									{
										return fData ? fData : "";
									}
	private:
		short					fAlloc;
		char					*fData;
};


#endif
