Files
Work/guitar/Tablature.hpp
2024-08-07 09:16:27 -04:00

97 lines
2.4 KiB
C++

#ifndef _GUITAR_TABLATURE_HPP_
#define _GUITAR_TABLATURE_HPP_
#ifndef _GUITAR_TABENTRY_HPP_
#include <guitar/TabEntry.hpp>
#endif
#ifndef _GUITAR_TABLINES_HPP_
#include <guitar/TabLines.hpp>
#endif
#ifndef _GUITAR_FRETBOARD_HPP_
#include <guitar/Fretboard.hpp>
#endif
#ifndef _GUITAR_RANGE_HPP_
#include <guitar/Range.hpp>
#endif
class GUIWindow;
class TabPage;
class Tablature
{
public:
typedef enum LastError{None,FileOpenError,NoTabsParsedError,NoFrettedNotesError};
Tablature();
Tablature(const String &pathFileName);
virtual ~Tablature();
bool open(const String &pathFileTablature); // open tablature file
bool import(String pathFileTablature); // import tablature file into project
bool save(void); // save tablature file
bool saveAs(const String &pathFileTablature); // save tablature file as...
bool openProject(const String &pathFileName); // open existing project file
bool saveProject(const String &pathFileName=String()); // save current project
bool play(MIDIOutputDevice &midiDevice);
LastError getLastError(void)const;
const String &getPathFileTablature(void)const;
const String &getPathFileProject(void)const;
const TabEntries &getTabEntries(void)const;
void setTabEntries(const TabEntries &entries);
const TabRanges &getTabRanges(void)const;
void setTabRanges(const TabRanges &ranges);
static String getPathFileProject(const String &pathFileTablature);
private:
bool loadTabFile(const String &pathFileName);
bool parseTab(void);
bool isTabLine(const String &strLine,int &startElement)const;
bool setTypeAt(int index,const NoteType &noteType);
void parseTypes(String strLine);
void parseRange(String strLine);
void parseComment(String strLine);
void parseSeparator(String strLine);
String getTypes(void)const;
TabEntries mTabEntries;
TabRanges mTabRanges;
Block<TabLines> mTablature;
Fretboard mFretboard;
String mPathFileName;
LastError mLastError;
String mPathFileTablature;
String mPathFileProject;
};
inline
Tablature::Tablature()
{
}
inline
Tablature::Tablature(const String &pathFileName)
{
open(pathFileName);
}
inline
Tablature::~Tablature()
{
}
inline
Tablature::LastError Tablature::getLastError(void)const
{
return mLastError;
}
inline
const String &Tablature::getPathFileTablature(void)const
{
return mPathFileTablature;
}
inline
const String &Tablature::getPathFileProject(void)const
{
return mPathFileProject;
}
#endif