From: Leon W. <moo...@us...> - 2005-04-11 06:40:21
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26332 Modified Files: SyntaxFile.cpp SyntaxFile.h Log Message: - Added SpaceDelimitedKeywordSet for faster access to a delimited Keywordset. Index: SyntaxFile.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/SyntaxFile.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** SyntaxFile.cpp 27 Nov 2004 15:16:40 -0000 1.24 --- SyntaxFile.cpp 11 Apr 2005 06:40:10 -0000 1.25 *************** *** 1,2 **** --- 1,26 ---- + /**************************************************************************** + Copyright (C) AnyEdit Team + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. + + http://www.anyedit.org + *****************************************************************************/ + // SyntaxFile.cpp: implementation of the CSyntaxFile class. // *************** *** 42,47 **** } ! // Function to actually parse the synfile and the ability to check ! // if all goes well. bool CSyntaxFile::Parse() { --- 66,70 ---- } ! // Function to actually parse the synfile and the ability to check if all goes well. bool CSyntaxFile::Parse() { *************** *** 97,100 **** --- 120,125 ---- { Keywords[iCount].Add( CString( xnode.child( iWordCount ).child(0).value() ) ); + if( iWordCount > 0 ) KeywordsSpaceDelimited[iCount] += _T(" "); + KeywordsSpaceDelimited[iCount] += CString( xnode.child( iWordCount ).child(0).value() ); } } *************** *** 118,121 **** --- 143,148 ---- if( iSet < 0 || iSet >= KEYWORDSET_MAX ) return false; + KeywordsSpaceDelimited[iSet].Empty(); + Keywords[iSet].RemoveAll(); int iBegin = 0; *************** *** 136,140 **** szKeyword = szKeywords.Mid( iBegin, iEnd - iBegin ); } ! if( !szKeyword.IsEmpty() ) Keywords[iSet].Add( szKeyword ); iBegin = iEnd + 1; } --- 163,172 ---- szKeyword = szKeywords.Mid( iBegin, iEnd - iBegin ); } ! if( !szKeyword.IsEmpty() ) ! { ! Keywords[iSet].Add( szKeyword ); ! if( iBegin > 0 ) KeywordsSpaceDelimited[iSet] += _T(" "); ! KeywordsSpaceDelimited[iSet] += szKeyword; ! } iBegin = iEnd + 1; } *************** *** 161,164 **** --- 193,203 ---- } + // Gets a String with all keywords out of iSet already delimited with spaces. + CString CSyntaxFile::GetSpaceDelimitedKeywordSet( int iSet ) + { + if( iSet < 0 || iSet >= KEYWORDSET_MAX ) return _T(""); + else return KeywordsSpaceDelimited[iSet]; + } + // Gets a String with all keywords out of iSet separated by cSep CString CSyntaxFile::GetDelimitedKeywordSet( int iSet, char cSep ) Index: SyntaxFile.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/SyntaxFile.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SyntaxFile.h 27 Sep 2004 12:34:00 -0000 1.16 --- SyntaxFile.h 11 Apr 2005 06:40:10 -0000 1.17 *************** *** 1,2 **** --- 1,26 ---- + /**************************************************************************** + Copyright (C) AnyEdit Team + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. + + http://www.anyedit.org + *****************************************************************************/ + // SyntaxFile.h: interface for the CSyntaxFile class. // *************** *** 123,127 **** /// Keep track of the max defined style. int iMaxStyle; ! /// Sorted array with all the keywords of a language CSortedArray<CString, CString> Keywords[KEYWORDSET_MAX]; --- 147,151 ---- /// Keep track of the max defined style. int iMaxStyle; ! /// Sorted array with all the keywords of a language CSortedArray<CString, CString> Keywords[KEYWORDSET_MAX]; *************** *** 130,133 **** --- 154,160 ---- CString KeywordDescription[KEYWORDSET_MAX]; + /// Array with strings containing the all keywords of a set delimited by a space. + CString KeywordsSpaceDelimited[KEYWORDSET_MAX]; + /// Converts a char array with hex chars to an int. int RGBHexValueToColorInt( const CString& szRGBHexValue ); *************** *** 164,167 **** --- 191,197 ---- CString GetDelimitedKeywords( char cSep = ' ' ); + /// Gets a String with the keywords from set iSet delimited by a space. + CString GetSpaceDelimitedKeywordSet( int iSet ); + /// Gets a String with all keywords out of iSet separated by cSep CString GetDelimitedKeywordSet( int iSet, char cSep = ' ' ); |