/***************************************************************************
 *                          Zanoza Modeler v2.x                            *
 *      This is unpublished propietary source code of Zanoza Software.     *
 *      The copyright notice does not evidence any actual or intended      *
 *                    publication of such source code.                     *
 *                                                                         *
 *                   Copyright (c) 2002 Zanoza Software.                   *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg M.
 *--------------------------------------------------------------------------
 * @purpose:  ZModeler's string
 *--------------------------------------------------------------------------
 * @histroy: 23.09.2002. Created
 * @histroy: 16.02.2006. UNICODE support removed; optimization added;
 */
#ifndef zstring_h_included
#define zstring_h_included

class DLL_LINKAGE ZString
{
public:
  ZString();
  ZString(const ZString& str);
  ~ZString();
  ZString(LPCTSTR);
  ZString(LPCTSTR, LPCTSTR);//concatination constructor;
  operator LPCTSTR() const
  {
    return m_pszString;
  };
  //unsafe:
  operator LPTSTR()
    { m_nLength = 0; return m_pszString; }

  bool operator! () { return NULL==m_pszString;}
  ZString& operator = (LPCTSTR pstr);

  ZString& operator = (const ZString& str);
  ZString& operator += (const ZString& str);
  ZString& operator += (LPCTSTR str);
  const ZString  operator + (const ZString& str) const;
  const ZString  operator + (LPCTSTR str) const;
  bool operator != (const ZString& str) const;
  bool operator == (const ZString& str) const;
  bool operator <  (const ZString& str) const;
  static ZString string(const long  nValue);
  static ZString string(const float fValue);
  static ZString string(const DWORD dwValue); //0xFE89A13E format
  long length() const;
  inline long bufSize() const { return m_nBufSize; }
  void length(long nSize);
  void bufSize(long nSize);
  ZString& append(LPCTSTR ch, long nLen =-1);
  inline _TCHAR& operator[](int nPos) {return m_pszString[nPos];}
  inline _TCHAR& operator[](long nPos){return m_pszString[nPos];}

private:
  LPTSTR  m_pszString;
  long    m_nLength;
  long    m_nBufSize;
};

#ifndef zsequence_h_included
# include "zsequence.h"
#endif

typedef ZSequence<ZString>  ZStringSeq;

#endif //zstring_h_included

