BStr::BStr(const this_type & val) : m_str(nullptr) { if (val.m_str) { m_str = ::SysAllocStringLen(val.m_str, val.size()); if (!m_str) CheckCom(E_OUTOFMEMORY); } }
/*! * Lexicographically compares the argument string to this string * * \param that Comparand * \return Zero if the comparand equals this string, a negative value if this string is less than the comparand, * a positive value if this string is greater than the comparand. */ int compare(this_type const& that) const { return compare(0, m_Len, that.c_str(), that.size()); }
/*! * Lexicographically compares the argument string literal to a part of this string * * \pre <tt>pos <= size()</tt> * \param pos Starting position within this string to perform comparison to * \param n Length of the substring of this string to perform comparison to * \param that Comparand * \return Zero if the comparand equals this string, a negative value if this string is less than the comparand, * a positive value if this string is greater than the comparand. * * \b Throws: An <tt>std::exception</tt>-based exception if \a pos is out of range. */ int compare(size_type pos, size_type n, this_type const& that) const { return compare(pos, n, that.c_str(), that.size()); }
friend bool operator==(const this_type& l, const this_type& r) { return l.size() == r.size() && ngx_strncmp(l.data(), r.data(), l.size()) == 0 ; }