Files
itgmania212121/stepmania/src/MsdFile.h
T

49 lines
1.2 KiB
C++
Raw Normal View History

#ifndef MSDFILE_H
#define MSDFILE_H
2002-07-23 01:41:40 +00:00
/*
-----------------------------------------------------------------------------
Class: MsdFile
Desc: Wrapper for reading and writing an .sm, .dwi, .or msd file.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
2003-01-14 22:44:30 +00:00
Glenn Maynard
2002-07-23 01:41:40 +00:00
-----------------------------------------------------------------------------
*/
class MsdFile
{
2003-01-14 22:44:30 +00:00
public:
/* #param:param:param:param; <- one whole value */
struct value_t
{
vector<CString> params;
CString operator[](unsigned i) const { if(i >= params.size()) return ""; return params[i]; }
};
virtual ~MsdFile() { }
2003-07-15 00:51:10 +00:00
// Returns true if successful, false otherwise.
2003-01-14 22:44:30 +00:00
bool ReadFile( CString sFilePath );
2003-07-15 00:51:10 +00:00
CString GetError() const { return error; }
2003-01-14 22:44:30 +00:00
unsigned GetNumValues() const { return values.size(); }
unsigned GetNumParams(unsigned val) const { if(val >= GetNumValues()) return 0; return values[val].params.size(); }
const value_t &GetValue(unsigned val) const { ASSERT(val < GetNumValues()); return values[val]; }
CString GetParam(unsigned val, unsigned par) const;
2003-07-15 00:51:10 +00:00
2003-01-14 22:44:30 +00:00
private:
void ReadBuf( char *buf, int len );
void AddParam( char *buf, int len );
void AddValue();
2003-01-14 22:44:30 +00:00
vector<value_t> values;
2003-07-15 00:51:10 +00:00
CString error;
2002-07-23 01:41:40 +00:00
};
#endif