diff --git a/src/NotesWriterSM.h b/src/NotesWriterSM.h index 7907bf7eed..f394a5934b 100644 --- a/src/NotesWriterSM.h +++ b/src/NotesWriterSM.h @@ -16,7 +16,7 @@ namespace NotesWriterSM * @brief Get some contents about the edit file first. * @param pSong the Song in question. * @param pSteps the Steps in question. - * @param sOut unused? + * @param sOut the start of the file contents. */ void GetEditFileContents( const Song *pSong, const Steps *pSteps, RString &sOut ); /** diff --git a/src/NotesWriterSSC.cpp b/src/NotesWriterSSC.cpp index 0da790abd5..d665db7b98 100644 --- a/src/NotesWriterSSC.cpp +++ b/src/NotesWriterSSC.cpp @@ -16,6 +16,10 @@ #include "Song.h" #include "Steps.h" +/** + * @brief Turn the BackgroundChange into a string. + * @param bgc the BackgroundChange in question. + * @return the converted string. */ static RString BackgroundChangeToString( const BackgroundChange &bgc ) { // TODO: Technically we need to double-escape the filename (because it might contain '=') and then @@ -37,6 +41,10 @@ static RString BackgroundChangeToString( const BackgroundChange &bgc ) return s; } +/** + * @brief Write out the common tags for .SM files. + * @param f the file in question. + * @param out the Song in question. */ static void WriteGlobalTags( RageFile &f, const Song &out ) { f.PutLine( ssprintf( "#VERSION:%.2f;", out.m_fVersion ) ); @@ -238,6 +246,10 @@ static void WriteGlobalTags( RageFile &f, const Song &out ) f.PutLine( ";" ); } +/** + * @brief Turn a vector of lines into a single line joined by newline characters. + * @param lines the list of lines to join. + * @return the joined lines. */ static RString JoinLineList( vector &lines ) { for( unsigned i = 0; i < lines.size(); ++i ) @@ -251,7 +263,12 @@ static RString JoinLineList( vector &lines ) return join( "\r\n", lines.begin()+j, lines.end() ); } -static RString GetSSCNotesTag( const Song &song, const Steps &in, bool bSavingCache ) +/** + * @brief Retrieve the individual batches of NoteData. + * @param song the Song in question. + * @param in the Steps in question. + * @return the NoteData in RString form. */ +static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCache ) { vector lines; @@ -396,7 +413,7 @@ bool NotesWriterSSC::Write( RString sPath, const Song &out, const vector FOREACH_CONST( Steps*, vpStepsToSave, s ) { const Steps* pSteps = *s; - RString sTag = GetSSCNotesTag( out, *pSteps, bSavingCache ); + RString sTag = GetSSCNoteData( out, *pSteps, bSavingCache ); f.PutLine( sTag ); } if( f.Flush() == -1 ) @@ -416,7 +433,7 @@ void NotesWriterSSC::GetEditFileContents( const Song *pSong, const Steps *pSteps if( asParts.size() ) sDir = join( "/", asParts.begin()+1, asParts.end() ); sOut += ssprintf( "#SONG:%s;\r\n", sDir.c_str() ); - sOut += GetSSCNotesTag( *pSong, *pSteps, false ); + sOut += GetSSCNoteData( *pSong, *pSteps, false ); } RString NotesWriterSSC::GetEditFileName( const Song *pSong, const Steps *pSteps ) diff --git a/src/NotesWriterSSC.h b/src/NotesWriterSSC.h index 4819dc60d9..f22ba24421 100644 --- a/src/NotesWriterSSC.h +++ b/src/NotesWriterSSC.h @@ -1,22 +1,47 @@ -/* NotesWriterSSC - Writes a Song to an .SSC file. */ - #ifndef NOTES_WRITER_SSC_H #define NOTES_WRITER_SSC_H class Song; class Steps; +/** @brief Writes a Song to an .SSC file. */ namespace NotesWriterSSC { + /** + * @brief Write the song out to a file. + * @param sPath the path to write the file. + * @param out the Song to be written out. + * @param vpStepsToSave the Steps to save. + * @param bSavingCache a flag to see if we're saving certain cache data. + * @return its success or failure. */ bool Write( RString sPath, const Song &out, const vector& vpStepsToSave, bool bSavingCache ); + /** + * @brief Get some contents about the edit file first. + * @param pSong the Song in question. + * @param pSteps the Steps in question. + * @param sOut the start of the file contents. + */ void GetEditFileContents( const Song *pSong, const Steps *pSteps, RString &sOut ); + /** + * @brief Get the name of the edit file to use. + * @param pSong the Song in question. + * @param pSteps the Steps in question. + * @return the name of the edit file. */ RString GetEditFileName( const Song *pSong, const Steps *pSteps ); + /** + * @param Write the edit file to the machine for future use. + * @param pSong the Song in question. + * @param pSteps the Steps in question. + * @param sErrorOut any error messages that may have occurred. + * @return its success or failure. */ bool WriteEditFileToMachine( const Song *pSong, Steps *pSteps, RString &sErrorOut ); } #endif -/* - * (c) 2011 Jason Felds +/** + * @file + * @author Jason Felds (c) 2011 + * @section LICENSE * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a