From: Leon W. <moo...@us...> - 2005-04-14 11:49:08
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17669 Modified Files: ConfigFile.cpp ConfigFile.h Log Message: - Added StartExpressions for a Language to the ConfigFile. For language determining by first line. Index: ConfigFile.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/ConfigFile.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ConfigFile.h 14 Apr 2005 11:18:56 -0000 1.21 --- ConfigFile.h 14 Apr 2005 11:48:57 -0000 1.22 *************** *** 73,76 **** --- 73,80 ---- #define TAG_LANGUAGE_AUTOCOMPFILE "AutoCompFile" #define TAG_LANGUAGE_EXTENSIONS "Extensions" + #define TAG_LANGUAGE_STARTEXPRESSIONS "StartExpressions" + + // Language StartExpression tags + #define TAG_EXPRESSION "Expression" // Editor tags *************** *** 258,261 **** --- 262,271 ---- bool RemoveLanguage( int iNumber ); + /// Get all StartExpressions of language iNumber. + bool GetLanguageStartExpressions( int iNumber, CMapStringToString* pMap ); + + /// Set new StartExpressions for language iNumber + bool SetLanguageStartExpressions( int iNumber, CMapStringToString* pMap ); + /// Get the color of the caret/cursor. COLORREF GetCaretColor(); Index: ConfigFile.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/ConfigFile.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ConfigFile.cpp 14 Apr 2005 11:18:56 -0000 1.22 --- ConfigFile.cpp 14 Apr 2005 11:48:56 -0000 1.23 *************** *** 338,342 **** } - // Get the extensions string of languge with number iNumber. CString CConfigFile::GetLanguageExtensions( int iNumber ) --- 338,341 ---- *************** *** 367,371 **** } - // Add a language to the config file. bool CConfigFile::AddLanguage( CString szName, CString szSyntaxFile, CString szAutoCompFile, CString szExtensions ) --- 366,369 ---- *************** *** 437,441 **** } ! /// Get the color of the caret/cursor. COLORREF CConfigFile::GetCaretColor() { --- 435,513 ---- } ! // Get all StartExpressions of language iNumber. ! bool CConfigFile::GetLanguageStartExpressions( int iNumber, CMapStringToString* pMap ) ! { ! unsigned int uiCount; ! CString szNumber; ! pug::xml_node xnode; ! ! // Make sure the file is parsed. ! if( !m_bParsed && !Parse() ) return false; ! ! xnode = GetLanguageNodeByNumber( iNumber ); ! if( xnode.empty() ) return false; ! ! xnode = xnode.first_element_by_name( TAG_LANGUAGE_STARTEXPRESSIONS ); ! if( xnode.empty() ) return false; ! ! szNumber.Format( "%d", iNumber ); ! for( uiCount = 0; uiCount < xnode.children(); ++ uiCount ) ! { ! if( !xnode.child(uiCount).empty() && xnode.child(uiCount).has_child_nodes() ) ! { ! pMap->SetAt( xnode.child(uiCount).child(0).value(), szNumber ); ! } ! } ! ! return true; ! } ! ! // Set new StartExpressions for language iNumber ! bool CConfigFile::SetLanguageStartExpressions( int iNumber, CMapStringToString* pMap ) ! { ! POSITION pos; ! CString szKey; ! CString szData; ! pug::xml_node xnode; ! ! // Make sure the file is parsed. ! if( !m_bParsed && !Parse() ) return false; ! ! xnode = GetLanguageNodeByNumber( iNumber ); ! if( xnode.empty() ) return false; ! ! xnode = xnode.first_element_by_name( TAG_LANGUAGE_STARTEXPRESSIONS ); ! if( xnode.empty() ) ! { ! // Add a new startexpression tag ! xnode = xnode.append_child( pug::node_element ); ! if( xnode.empty() ) return false; ! ! // This is the point where the file is modified. ! m_bModified = true; ! ! // Set the tagname of the new child ! if( !xnode.name( TAG_LANGUAGE_STARTEXPRESSIONS ) ) return false; ! } ! ! // Remove the current list of children. ! while( xnode.has_child_nodes() ) ! { ! if( !xnode.remove_child( 0 ) ) return false; ! m_bModified = true; ! } ! ! pos = pMap->GetStartPosition(); ! while( pos != NULL ) ! { ! pMap->GetNextAssoc( pos, szKey, szData ); ! if( szKey.IsEmpty() ) continue; ! if( !AddChildStringElement( xnode, TAG_EXPRESSION, szKey, false ) ) return false; ! } ! ! return true; ! } ! ! // Get the color of the caret/cursor. COLORREF CConfigFile::GetCaretColor() { *************** *** 443,447 **** } ! /// Set the color ot the caret/cursor. bool CConfigFile::SetCaretColor( COLORREF clrCaret ) { --- 515,519 ---- } ! // Set the color ot the caret/cursor. bool CConfigFile::SetCaretColor( COLORREF clrCaret ) { |