/* Copyright (C) 1997, 1998, 1999, 2000 by Alex Pfaffe (Digital Dawn Graphics Inc) 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 (at your option) 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 MERCHANTABILITY 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _ddgStr_Class_ #define _ddgStr_Class_ #include "util/ddg.h" class WEXP ddgStr { bool _assign( const char *b, int size); public: char *s; unsigned int l; ddgStr(void); ddgStr(const char *ss, int size = 0); ddgStr(const int s); ddgStr(const ddgStr *str) { s = NULL; assign(str->s); } ddgStr(const ddgStr &str) { s = NULL; assign(str.s); } ~ddgStr(); bool assign( const char * b ); bool assign( const ddgStr * str ) { return assign(str->s); } inline operator char *() { return s; } inline operator const char *() { return s; } inline operator ddgStr *() { return this; } ddgStr& operator +=( const ddgStr& s); unsigned int length(void) { return l; } static unsigned int length( const char *s) { char *p = (char *)s; while( *p ) { p++;} return p-s; } static bool equal(const char * a, const char *b) { while(*a && *b && *a == *b) { a++; b++; } if (!*a && !*b) return true; return false; } inline bool equal( const char *b) { return equal(s,b);} static float stof( const char * s); static int stoi( const char * s); char *findChar( const char target ); }; #ifdef DDGSTREAM WEXP ostream& WFEXP operator << ( ostream&s, const ddgStr v ); WEXP ostream& WFEXP operator << ( ostream&s, const ddgStr* v ); WEXP istream& WFEXP operator >> ( istream& s, ddgStr& v); #endif // DDGSTREAM #endif