/// This file is part of the X3DToolKit library
/// Copyright (C) 2002-2004  Yannick Le Goc (legoc@imag.fr)

/// http://artis.imag.fr/Members/Yannick.Legoc/X3D/

/// This library is free software; you can redistribute it and/or
/// modify it under the terms of the GNU Lesser General Public
/// License as published by the Free Software Foundation; either
/// version 2.1 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
/// Lesser General Public License for more details.

/// You should have received a copy of the GNU Lesser 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
#ifndef X3DTK_SFSTRING_H
#define X3DTK_SFSTRING_H

#include "Platform.h"

#include <string>

namespace X3DTK {

/*! \brief Class declared in <b><X3DTK/kernel.h></b> providing a string.
 * 
 *  SFString is derived from std::string. Functions are added like the 
 *  different conversions.
 *
 *  \ingroup base
 */

class SFString : public std::string
{
public:
  /// Default constructor.
  SFString();
  /// Conversion from char *.
  SFString(const char *s);
  /// Conversion from char *.
  SFString(const unsigned char *s);
  /// Conversion from std::string.
  SFString(const std::string &s);
  /// Copy constructor.
  SFString(const SFString &s);
  /// Returns the string.
  SFString toSFString() const;
  
  /// Conversion to char *
  operator const char *() const;
  /// Conversion to int.  
  int toInt() const;
  /// Conversion to unsigned int.  
  unsigned int toUint() const;
  /// Conversion to float.  
  float toFloat() const;
  /// Conversion to double.  
  double toDouble() const;
  /// Returns a string that is the string converted to lowercase.
  SFString lower() const;
  /// Returns a string that is the string converted to uppercase.
  SFString upper() const;
  /// Returns the name of the file, it means without the path and without the extension.
  SFString getName() const;
  /// Returns the extension of the file.
  SFString getExtension() const;
  /// Returns the file of the string supposed to be a file.
  SFString getFile() const;
  /// Returns the path of the string supposed to be a file.
  SFString getPath() const;
  
  /// Converts a floating number to a SFString.  
  static SFString number(float f);
  /// Converts a double number to a SFString.
  static SFString number(double d);
  /// Converts an integer to a SFString.
  static SFString number(int i); 
  /// Converts an unsigned integer to a SFString.
  static SFString number(unsigned int ui); 
};

}

#endif
