Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SbString.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SBSTRING_H
00021 #define COIN_SBSTRING_H
00022 
00023 #include <Inventor/system/inttypes.h>
00024 #include <Inventor/SbBasic.h>
00025 
00026 #include <stdio.h>
00027 #include <stdarg.h>
00028 
00029 #define SB_STRING_STATIC_STORAGE_SIZE 128
00030 
00031 
00032 class COIN_DLL_API SbString {
00033 public:
00034   SbString(void);
00035   SbString(const char * str);
00036   SbString(const char * str, int start, int end);
00037   SbString(const SbString & str);
00038   SbString(const int digits);
00039   ~SbString();
00040 
00041   uint32_t hash(void);
00042   int getLength(void) const;
00043   void makeEmpty(SbBool freeold = TRUE);
00044   const char * getString(void) const;
00045   SbString getSubString(int startidx, int endidx = -1) const;
00046   void deleteSubString(int startidx, int endidx = -1);
00047 
00048   void addIntString(const int value);
00049 
00050   char operator [](int index) const;
00051   SbString & operator = (const char * str);
00052   SbString & operator = (const SbString & str);
00053   SbString & operator += (const char * str);
00054   SbString & operator += (const SbString & str);
00055   int operator ! (void) const;
00056   friend COIN_DLL_API int operator == (const SbString & str, const char * s);
00057   friend COIN_DLL_API int operator == (const char * s, const SbString & str);
00058   friend COIN_DLL_API int operator == (const SbString & str1, const SbString & str2);
00059   friend COIN_DLL_API int operator != (const SbString & str, const char * s);
00060   friend COIN_DLL_API int operator != (const char * s, const SbString & str);
00061   friend COIN_DLL_API int operator != (const SbString & str1, const SbString & str2);
00062   static uint32_t hash(const char * s);
00063 
00064   SbString & operator += (const char c);
00065   SbString & sprintf(const char * formatstr, ...);
00066   SbString & vsprintf(const char * formatstr, va_list args);
00067 
00068   void print(FILE * file = stdout) const;
00069 
00070 private:
00071   char * sstring;
00072   int storagesize;
00073   char staticstorage[SB_STRING_STATIC_STORAGE_SIZE];
00074   void expand(int additional);
00075 };
00076 
00077 COIN_DLL_API int operator == (const SbString & str, const char * s);
00078 COIN_DLL_API int operator == (const char * s, const SbString & str);
00079 COIN_DLL_API int operator == (const SbString & str1, const SbString & str2);
00080 COIN_DLL_API int operator != (const SbString & str, const char * s);
00081 COIN_DLL_API int operator != (const char * s, const SbString & str);
00082 COIN_DLL_API int operator != (const SbString & str1, const SbString & str2);
00083 
00084 #ifndef COIN_INTERNAL
00085 // For Open Inventor compatibility.
00086 #include <Inventor/SbName.h>
00087 #endif // !COIN_INTERNAL
00088 
00089 #endif // !COIN_SBSTRING_H

Generated at Tue Mar 5 03:31:11 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001