예제 #1
0
void CUITextBox::SplitNone(int nTextCnt )
{
	std::string strTmp;
	int nCurText = 0, tmpCnt = 0;
	int len = m_Str.size();

	while(1)
	{
		int nEnter = 0;
		tmpCnt = nTextCnt;

#if		defined(G_RUSSIA)
		std::string strNofixed;

		strNofixed = m_Str.substr(nCurText, (len - nCurText));
		tmpCnt = UTIL_HELP()->CheckNoFixedLength(_pfdDefaultFont, (char*)strNofixed.c_str(), m_nBoxWidth);
#endif	// G_RUSSIA
		
		CheckSplit(nCurText, tmpCnt, nEnter);

		strTmp = m_Str.substr(nCurText, tmpCnt);
		
		m_vecBoxString.push_back(strTmp.c_str());
		
		nCurText += tmpCnt + nEnter;

		if (nCurText >= len)
			break;
	}
}
예제 #2
0
void CUITextBox::SplitHyphen( int nTextCnt )
{
	std::string strTmp;
	int nCurText = 0, tmpCnt = 0;
	int len = m_Str.size();

	while(1)
	{
		int		pos = 0;

		int nEnter = 0;
		bool bHyphen = false;
		tmpCnt = nTextCnt;

#if		defined(G_RUSSIA)
		std::string strNofixed;

		strNofixed = m_Str.substr(nCurText, (len - nCurText));
		tmpCnt = UTIL_HELP()->CheckNoFixedLength(_pfdDefaultFont, (char*)strNofixed.c_str(), m_nBoxWidth);
#endif	// G_RUSSIA

		CheckSplit(nCurText, tmpCnt, nEnter);

		if (nCurText + tmpCnt < len)
		{
			char szPrev = m_Str[nCurText + tmpCnt - 2];
			char szCur  = m_Str[nCurText + tmpCnt - 1];
			char szNext = m_Str[nCurText + tmpCnt];
	
			// 문자열의 마지막이 영어고 그 다음 문자도 영어일 경우 마지막 문자 "위치"에 하이픈을 추가하고 개행.
			if ( ((szPrev >= 0x41 && szPrev <= 0x5A) || (szPrev >= 0x61 && szPrev <= 0x7a)) &&
				 ((szCur >= 0x41 && szCur <= 0x5A) || (szCur >= 0x61 && szCur <= 0x7a)) )//&&
				 //!((szNext == 0x20 || szNext == 0x2C || szNext == 0x2E)) )
			{
				bHyphen = true;
				--tmpCnt;
			}
			// ' ', ',' '.'
			else if ( ((szPrev == 0x20 || szPrev == 0x2C || szPrev == 0x2E)) && 
					  ((szNext >= 0x41 && szNext <= 0x5A) || (szNext >= 0x61 && szNext <= 0x7a)) )
			{
				--tmpCnt;
			}
		}

		strTmp = m_Str.substr(nCurText, tmpCnt);

		if (bHyphen == true)
			strTmp += '-';

		m_vecBoxString.push_back(strTmp.c_str());

		nCurText += tmpCnt + nEnter;

		if (nCurText >= len)
			break;
	}
}
예제 #3
0
void CUITextBox::SplitCharCount( )
{
	std::string strTmp;
	int nCurText = 0, tmpCnt = 0;
	int len = m_Str.size();

	while(1)
	{
		int nEnter = 0;
		tmpCnt = m_nCharMaxCount;

		CheckSplit(nCurText, tmpCnt, nEnter);

		strTmp = m_Str.substr(nCurText, tmpCnt);

		// 자른 문자열 시작 부분에 공백이나 줄바꿈 문자가 있을경우 제거.
		int i = 0;
		for ( ; i < strTmp.size(); ++i)
		{
			if (strTmp[i]  != ' ' && strTmp[i] != '\r' && strTmp[i] != '\n')
				break;
		}

		if (i > 0 && i != tmpCnt)
		{
			nCurText += i;
			CheckSplit(nCurText, tmpCnt, nEnter);
			strTmp = m_Str.substr(nCurText, tmpCnt);
		}

		if (strTmp.empty() == false)
			m_vecBoxString.push_back(strTmp.c_str());

		nCurText += tmpCnt + nEnter;

		if (nCurText >= len)
			break;
	}
}
예제 #4
0
/* Declare the status of the current hand */
void Box::Status() const
{
	cout << Owner->GetName();
	/* If the current box is the result of a split hand, display a different message */
	if(CheckSplit() == true)
	{
		cout << " (Split Hand)";
	}
	cout << ": (" << Owner->CountStack() << " in your stack, " << Bet << " on the table) You are holding: " << endl << endl;	

	ListHand();
	StatusResult();
}
예제 #5
0
void CUITextBox::SplitSpace( int nTextCnt )
{
	std::string strTmp;
	int nCurText = 0, tmpCnt = 0;
	int len = m_Str.size();

	while(1)
	{
		int		lastSpace = 0;

		int nEnter = 0;
		tmpCnt = nTextCnt;

#if		defined(G_RUSSIA)
		std::string strNofixed;

		strNofixed = m_Str.substr(nCurText, (len - nCurText));
		tmpCnt = UTIL_HELP()->CheckNoFixedLength(_pfdDefaultFont, (char*)strNofixed.c_str(), m_nBoxWidth);
#endif	// G_RUSSIA

		CheckSplit(nCurText, tmpCnt, nEnter);

		strTmp = m_Str.substr(nCurText, tmpCnt);

		lastSpace = strTmp.rfind(0x20, tmpCnt);

		// 잘라낸 문자열에 스페이스가 있는 경우를 검사.
		if (lastSpace != std::string::npos && nCurText + tmpCnt < len)
		{
			// 마지막 문자가 스페이스가 아니어야 한다.
			if (lastSpace != tmpCnt - 1)
			{
				strTmp = m_Str.substr(nCurText, ++lastSpace);
				tmpCnt = lastSpace;
			}
		}

		m_vecBoxString.push_back(strTmp.c_str());

		nCurText += tmpCnt + nEnter;

		if (nCurText >= len)
			break;
	}
}