mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
MusicMod: Prepare to fix the MusicMod build
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3505 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
122
Externals/MusicMod/Player/Src/PlaylistModel.h
vendored
Normal file
122
Externals/MusicMod/Player/Src/PlaylistModel.h
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Plainamp, Open source Winamp core
|
||||
//
|
||||
// Copyright <20> 2005 Sebastian Pipping <webmaster@hartwork.org>
|
||||
//
|
||||
// --> http://www.hartwork.org
|
||||
//
|
||||
// This source code is released under the GNU General Public License (GPL).
|
||||
// See GPL.txt for details. Any non-GPL usage is strictly forbidden.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// =======================================================================================
|
||||
#include "Console.h"
|
||||
#include "Global.h"
|
||||
// =======================================================================================
|
||||
|
||||
|
||||
#ifndef PLAYLIST_MODEL_H
|
||||
#define PLAYLIST_MODEL_H 1
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
|
||||
class PlaylistModel
|
||||
{
|
||||
vector<TCHAR *> _database;
|
||||
int _iCurIndex;
|
||||
int * _piCurIndex;
|
||||
|
||||
public:
|
||||
PlaylistModel()
|
||||
{
|
||||
_piCurIndex = &_iCurIndex;
|
||||
}
|
||||
|
||||
PlaylistModel( int * piIndexSlave )
|
||||
{
|
||||
_piCurIndex = piIndexSlave;
|
||||
}
|
||||
|
||||
void SetCurIndexSlave( int * piIndexSlave )
|
||||
{
|
||||
// *piIndexSlave = *_piCurIndex;
|
||||
_piCurIndex = piIndexSlave;
|
||||
}
|
||||
|
||||
// =======================================================================================
|
||||
// This is where the _database is populated
|
||||
// =======================================================================================
|
||||
void PushBack( TCHAR * szText )
|
||||
{
|
||||
Console::Append( TEXT( "PlaylistModel.h:_database.PushBack() was called " ) );
|
||||
|
||||
_database.push_back( szText ); // this is a <vector> API call
|
||||
}
|
||||
|
||||
void Insert( int i, TCHAR * szText )
|
||||
{
|
||||
Console::Append( TEXT( "PlaylistModel.h:_database.Insert() was called " ) );
|
||||
|
||||
if( i <= *_piCurIndex ) ( *_piCurIndex )++;
|
||||
_database.insert( _database.begin() + i, szText );
|
||||
}
|
||||
|
||||
void Erase( int i )
|
||||
{
|
||||
if( i < *_piCurIndex ) ( *_piCurIndex )--;
|
||||
_database.erase( _database.begin() + i );
|
||||
}
|
||||
|
||||
const TCHAR * Get( int i )
|
||||
{
|
||||
//Console::Append( TEXT( "PlaylistModel.h:_database.Get() was called " ) );
|
||||
|
||||
if( 0 > i || i >= ( int )_database.size() )
|
||||
{
|
||||
static const TCHAR * szError = TEXT( "INDEX OUT OF RANGE" );
|
||||
return szError;
|
||||
}
|
||||
|
||||
return _database[ i ];
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
_database.clear();
|
||||
*_piCurIndex = -1;
|
||||
}
|
||||
|
||||
int GetMaxIndex()
|
||||
{
|
||||
return _database.size() - 1;
|
||||
}
|
||||
|
||||
int GetCurIndex()
|
||||
{
|
||||
return *_piCurIndex;
|
||||
}
|
||||
|
||||
void SetCurIndex( int iIndex )
|
||||
{
|
||||
|
||||
if( 0 > iIndex || iIndex >= ( int )_database.size() )
|
||||
{
|
||||
INFO_LOG(AUDIO,"SetCurIndex > Return");
|
||||
return;
|
||||
}
|
||||
|
||||
*_piCurIndex = iIndex;
|
||||
}
|
||||
|
||||
int GetSize()
|
||||
{
|
||||
return _database.size();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // PLAYLIST_MODEL_H
|
Reference in New Issue
Block a user