Example #1
0
bool const operator>(CMyString const& a, CMyString const& b)
{
	int const result = memcmp(a.GetStringData(), b.GetStringData(), min(a.GetLength(), b.GetLength()));

	if (result != 0)
	{
		return (result > 0);
	}

	return (a.GetLength() > b.GetLength());
}
Example #2
0
void CFunc::ParseFunction(CMyString& base, CMyString& type1, CMyString& type2,
                          CMyString& type3, CMyString& descr) const
{
   CMyString type;
   ParseFunction(base,type,descr);
   int len = type.GetLength();
   type1 = firstType(type);
   int len1 = type1.GetLength();
   if (len1 == len) {
      type2 = type3 = type1;
   } else {
      type2 = firstType(type.Mid(len1));
      int len2 = type2.GetLength();
      if (len1 + len2 == len) {
         type3 = type2;
         if (!descr.Found(_T("I")))
            type2 = type1;
      } else {
         type3 = firstType(type.Mid(len1+len2));
      }
   }
} 
Example #3
0
static CMyString firstChanStr(CMyString& descr)
{
   CMyString numStr = _T("1234");
   int index = descr.Find(_T("C"));
   int iP = descr.Find(_T("P"));
   int len = 0;
   CMyString chanStr = _T("");
   if ((iP >= 0) && (index < 0 || (iP < index))) index = iP;
   if ((index < 0) ||
       (descr.GetLength() == index + 1) ||
       (!numStr.Found(descr[index + 1]))) {
      len = 0;
   } else {
      len = 2;
      if ((index > 0) && (descr[index - 1] == 'A')) {
         index--;
         len++;
      }
   }
   CMyString str = descr.Mid(index,len);
   descr = descr.Mid(index + len);
   return str;
}
Example #4
0
void ExpectStringDataImpl(const CMyString & s, const char *data, size_t size)
{
	BOOST_REQUIRE_EQUAL(s.GetLength(), size - 1);
	BOOST_REQUIRE_EQUAL(s.GetStringData(), data);
	BOOST_REQUIRE_EQUAL(memcmp(s.GetStringData(), data, size), 0);
}
Example #5
0
void VerifyString(CMyString const & str, size_t length, std::string const & reference)
{
	BOOST_CHECK_EQUAL(str.GetLength(), length);
	BOOST_CHECK_EQUAL(str.GetStringData(), reference);
}
Example #6
0
CMyString::CMyString(CMyString const & other)
	: CMyString(other.GetStringData(), other.GetLength())
{
}