// string standard header -*-c++-*-
// Copyright 2009-2020 IAR Systems AB.
#ifndef _DLIB5_STRING_
#define _DLIB5_STRING_

#ifndef _SYSTEM_BUILD
#pragma system_include
#endif

#include <dlib5/xstring>
//#include <istream>

_DLIB5_BEGIN

// string OPERATORS
inline string operator+(const string& _Left, const string& _Right)
{       // return string + string
  return (string(_Left) += _Right);
}

inline string operator+(const char *_Left, const string& _Right)
{       // return NTBS + string
  return (string(_Left) += _Right);
}

inline string operator+(const char _Left, const string& _Right)
{       // return char + string
  return (string(1, _Left) += _Right);
}

inline string operator+(const string& _Left, const char *_Right)
{       // return string + NTBS
  return (string(_Left) += _Right);
}

inline string operator+(const string& _Left, const char _Right)
{       // return string + char
  return (string(_Left) += _Right);
}

inline bool operator==(const string& _Left, const string& _Right)
{       // test for string equality
  return (_Left.compare(_Right) == 0);
}

inline bool operator==(const char * _Left, const string& _Right)
{       // test for NTBS vs. string equality
  return (_Right.compare(_Left) == 0);
}

inline bool operator==(const string& _Left, const char *_Right)
{       // test for string vs. NTBS equality
  return (_Left.compare(_Right) == 0);
}

inline bool operator!=(const string& _Left, const string& _Right)
{       // test for string inequality
  return (!(_Left == _Right));
}

inline bool operator!=(const char *_Left, const string& _Right)
{       // test for NTBS vs. string inequality
  return (!(_Left == _Right));
}

inline bool operator!=(const string& _Left, const char *_Right)
{       // test for string vs. NTBS inequality
  return (!(_Left == _Right));
}

inline bool operator<(const string& _Left, const string& _Right)
{       // test if string < string
  return (_Left.compare(_Right) < 0);
}

inline bool operator<(const char * _Left, const string& _Right)
{       // test if NTBS < string
  return (_Right.compare(_Left) > 0);
}

inline bool operator<(const string& _Left, const char *_Right)
{       // test if string < NTBS
  return (_Left.compare(_Right) < 0);
}

inline bool operator>(const string& _Left, const string& _Right)
{       // test if string > string
  return (_Right < _Left);
}

inline bool operator>(const char * _Left, const string& _Right)
{       // test if NTBS > string
  return (_Right < _Left);
}

inline bool operator>(const string& _Left, const char *_Right)
{       // test if string > NTBS
  return (_Right < _Left);
}

inline bool operator<=(const string& _Left, const string& _Right)
{       // test if string <= string
  return (!(_Right < _Left));
}

inline bool operator<=(const char * _Left, const string& _Right)
{       // test if NTBS <= string
  return (!(_Right < _Left));
}

inline bool operator<=(const string& _Left, const char *_Right)
{       // test if string <= NTBS
  return (!(_Right < _Left));
}

inline bool operator>=(const string& _Left, const string& _Right)
{       // test if string >= string
  return (!(_Left < _Right));
}

inline bool operator>=(const char * _Left, const string& _Right)
{       // test if NTBS >= string
  return (!(_Left < _Right));
}

inline bool operator>=(const string& _Left, const char *_Right)
{       // test if string >= NTBS
  return (!(_Left < _Right));
}

#if 0
// string INSERTERS AND EXTRACTORS
istream& operator>>(istream& _Istr, string& _Str);

istream& getline(istream& _Istr, string& _Str,
                 const char _Delim = '\n');

ostream& operator<<(ostream& _Ostr, const string& _Str);
#endif

_DLIB5_END
#endif /* _STRING */

/*
 * Copyright (c) 1992-2009 by P.J. Plauger.  ALL RIGHTS RESERVED.
 * Consult your license regarding permissions and restrictions.
 V5.04:0576 */
