VTK
dox/Common/vtkStdString.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkStdString.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00029 #ifndef __vtkStdString_h
00030 #define __vtkStdString_h
00031 
00032 #include "vtkSystemIncludes.h" // For VTK_COMMON_EXPORT.
00033 #include <string>       // For the superclass.
00034 
00035 class vtkStdString;
00036 VTK_COMMON_EXPORT ostream& operator<<(ostream&, const vtkStdString&);
00037 
00038 // Workaround for a difference between GCC visibility and MSVC dllexport
00039 // Not setting the visibility of this class caused the
00040 // vtkArrayIteratorTemplate<vtkStdString> symbols to be hidden on Apple GCC 4.2
00041 // but exporting would cause failure on MSVC 10 (works either way with GCC 4.4
00042 #if defined(__APPLE__) && __GNUC__ >=4
00043 class VTK_COMMON_EXPORT vtkStdString : public std::string
00044 #else
00045 class vtkStdString : public std::string
00046 #endif
00047 {
00048 public:
00049   typedef std::string StdString;
00050   typedef StdString::value_type             value_type;
00051   typedef StdString::pointer                pointer;
00052   typedef StdString::reference              reference;
00053   typedef StdString::const_reference        const_reference;
00054   typedef StdString::size_type              size_type;
00055   typedef StdString::difference_type        difference_type;
00056   typedef StdString::iterator               iterator;
00057   typedef StdString::const_iterator         const_iterator;
00058   typedef StdString::reverse_iterator       reverse_iterator;
00059   typedef StdString::const_reverse_iterator const_reverse_iterator;
00060 
00061   vtkStdString(): StdString() {}
00062   vtkStdString(const value_type* s): StdString(s) {}
00063   vtkStdString(const value_type* s, size_type n): StdString(s, n) {}
00064   vtkStdString(const StdString& s, size_type pos=0, size_type n=npos):
00065     StdString(s, pos, n) {}
00066 
00067   operator const char *() { return this->c_str(); }
00068 };
00069 
00070 #endif