コード例 #1
0
int parseLines( INXString &csTextBlock, std::list<INXString> &rLines )
{

	// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	// Split-up the received text into new-line terminated pieces.
	// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

	// 1st of all, chop-off any \n's at the beginning of the string, as these are effectively 0-length
	// lines, which are not worth processing further.

	rLines.clear();

	int charPos = csTextBlock.Find('\n');
	int len = csTextBlock.GetLength();
	while(charPos == 0){
		csTextBlock = csTextBlock.Right(len-1);
		charPos = csTextBlock.Find('\n');
		len = csTextBlock.GetLength();
	}


	charPos = csTextBlock.Find('\n');
	len = csTextBlock.GetLength();

	if ( charPos == -1 ) {
		// There is no '\n' at all.  Treat the string as just one line.
		rLines.push_back(csTextBlock);
		csTextBlock = "";

	} else {

		while( charPos != -1 ){

			// The \n is in the middle somewhere - get the left-most substring
			rLines.push_back(csTextBlock.Left(charPos+1) );
			csTextBlock = csTextBlock.Right(csTextBlock.GetLength() - 1 - charPos);

			charPos = csTextBlock.Find('\n');
			len = csTextBlock.GetLength();

		} // while( charPos != -1 )

	} // if(charPos != -1)

	len = csTextBlock.GetLength();

	if ( csTextBlock.GetLength() > 0 ) {
		// Pushthe last non- \n terminated string
		rLines.push_back(csTextBlock);
		csTextBlock = "";

	}
	return rLines.size();

}
コード例 #2
0
void parseSodlWidgetData( const INXString &fileLine, INXString &widgetTag, INXString &targetFileName )
{

	// A GUI tag is preceded by %%%_ which needs to be removed from the GUI file
	widgetTag = fileLine;
	widgetTag.Delete(0, 4);
	// Now that the %%%_ has gone, store value for target file name also.
	targetFileName = widgetTag;

	// where is space between widget tag and target file name
	int posnOfSeparatorSpace = widgetTag.Find(INXString(" "));

	// get the characters of the widget tag (ie up to, not including, the space).
	widgetTag = widgetTag.Left(posnOfSeparatorSpace);

	// Now get the target file name.

	int length = targetFileName.GetLength();
	targetFileName = targetFileName.Right(length-posnOfSeparatorSpace-1);

	return;

}