123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #pragma once
- #include "openmpt/all/BuildSettings.hpp"
- #include "tuning.h"
- #include <vector>
- #include <string>
- OPENMPT_NAMESPACE_BEGIN
- namespace Tuning {
- class CTuningCollection
- {
- public:
- static constexpr char s_FileExtension[4] = ".tc";
-
-
-
-
-
-
-
-
-
-
- static constexpr size_t s_nMaxTuningCount = 255 + 255 + 2 ;
- public:
-
- CTuning* AddTuning(std::unique_ptr<CTuning> pT);
- CTuning* AddTuning(std::istream &inStrm, mpt::Charset defaultCharset);
-
- bool Remove(const std::size_t i);
- bool Remove(const CTuning *pT);
- std::size_t GetNumTunings() const
- {
- return m_Tunings.size();
- }
- CTuning* GetTuning(std::size_t i)
- {
- if(i >= m_Tunings.size())
- {
- return nullptr;
- }
- return m_Tunings[i].get();
- }
- const CTuning* GetTuning(std::size_t i) const
- {
- if (i >= m_Tunings.size())
- {
- return nullptr;
- }
- return m_Tunings[i].get();
- }
-
- CTuning* GetTuning(const mpt::ustring &name);
- const CTuning* GetTuning(const mpt::ustring &name) const;
- Tuning::SerializationResult Serialize(std::ostream &oStrm, const mpt::ustring &name) const;
- Tuning::SerializationResult Deserialize(std::istream &iStrm, mpt::ustring &name, mpt::Charset defaultCharset);
- auto begin() { return m_Tunings.begin(); }
- auto begin() const { return m_Tunings.begin(); }
- auto cbegin() { return m_Tunings.cbegin(); }
- auto end() { return m_Tunings.end(); }
- auto end() const { return m_Tunings.end(); }
- auto cend() { return m_Tunings.cend(); }
- private:
- std::vector<std::unique_ptr<CTuning> > m_Tunings;
- private:
- Tuning::SerializationResult DeserializeOLD(std::istream &inStrm, mpt::ustring &uname, mpt::Charset defaultCharset);
- };
- #ifdef MODPLUG_TRACKER
- bool UnpackTuningCollection(const CTuningCollection &tc, const mpt::PathString &prefix);
- #endif
- }
- typedef Tuning::CTuningCollection CTuningCollection;
- OPENMPT_NAMESPACE_END
|