int AffxByteArray::append(const AffxString& srcIn)
{
	AffxString src = srcIn;

	int nOldSize = m_nSize;
	setSize(m_nSize + (int)src.length());

	memcpy(m_pData + nOldSize, src.c_str(), src.length() * sizeof(char));

	return nOldSize;
}
bool AffxByteArray::equals(const AffxString &str) const
{
	bool bEqual = false;

	int iThisSize = getSize();
	int iThatSize = (int)str.length();

	if (iThisSize == iThatSize)
	{
		if ((iThisSize == 0) && (iThatSize == 0)) {bEqual = true;}
		else
		{
			for (int i = 0; (i < iThisSize); i++)
			{
				if (getAt(i) == str.getAt(i))
					bEqual = true;
				else
				{
					bEqual = false;
					break;
				}
			}
		}
	}

	return bEqual;
}
Exemplo n.º 3
0
AffxString CNReporter::prepareAscii(const AffxString& str, int iLength)
{
  AffxString strPrepared = str;
  int iActualLength = (int)strPrepared.length();
  strPrepared.padBlanks(iLength);
  strPrepared.setAt(iActualLength, 0);
  return strPrepared;
}
int AffxByteArray::compareTo(const AffxString & that) const
{
    int iResult = 0;
	int iLength = __minimum(this->m_nSize, (int)that.length());

	bool bEqual = true;
	for (int iIndex = 0; (iIndex < iLength); iIndex++)
	{
	    if (this->m_pData[iIndex] != that.charAt(iIndex))
	    {
	        bEqual = false;
	        iResult = (this->m_pData[iIndex] - that.charAt(iIndex));
	        break;
	    }
	}
	if (bEqual) {iResult = (this->m_nSize - (int)that.length());}

	return iResult;
}
Exemplo n.º 5
0
void CNReporter::loadBuffer(char* pBuffer, int& iIndex, AffxString& str, int iLength)
{
  if (iLength == -1) {
    iLength = str.length();
  }
  unsigned int ui = htonl(iLength);
  memcpy((void*)(pBuffer + iIndex), (void*)&ui, sizeof(unsigned int));
  iIndex += sizeof(unsigned int);
  memcpy((void*)(pBuffer + iIndex), str.c_str(), iLength); iIndex += iLength;
}
bool AffxByteArray::equalsIgnoreCase(const AffxString &str)
{
	bool bEqual = false;

	int iThisSize = getSize();
	int iThatSize = (int)str.length();

	if (iThisSize == iThatSize)
	{
		for (int i = 0; (i < iThisSize); i++)
		{
			if (getAt(i) >= 'A' && getAt(i) <= 'Z')
			{
				if ((getAt(i) == str.getAt(i)) || (getAt(i) + ' ' == str.getAt(i)))
					bEqual = true;
				else
				{
					bEqual = false;
					break;
				}
			}
			else if (getAt(i) >= 'a' && getAt(i) <= 'z')
			{
				if ((getAt(i) == str.getAt(i)) || (getAt(i) - ' ' == str.getAt(i)))
					bEqual = true;
				else
				{
					bEqual = false;
					break;
				}
			}
			else if (getAt(i) == str.getAt(i))
				bEqual = true;
			else
			{
				bEqual = false;
				break;
			}
		}
	}

	return bEqual;
}