shun-iwasawa ef0f8b
#include "toonz/filepathproperties.h"
shun-iwasawa ef0f8b
shun-iwasawa ef0f8b
// TnzCore includes
shun-iwasawa ef0f8b
#include "tstream.h"
shun-iwasawa ef0f8b
shun-iwasawa ef0f8b
FilePathProperties::FilePathProperties()
shun-iwasawa ef0f8b
    : m_useStandard(true)
shun-iwasawa ef0f8b
    , m_acceptNonAlphabetSuffix(false)
shun-iwasawa ef0f8b
    , m_letterCountForSuffix(1) {}
shun-iwasawa ef0f8b
shun-iwasawa ef0f8b
bool FilePathProperties::isDefault() {
shun-iwasawa ef0f8b
  return (m_useStandard == true && m_acceptNonAlphabetSuffix == false &&
shun-iwasawa ef0f8b
          m_letterCountForSuffix == 1);
shun-iwasawa ef0f8b
}
shun-iwasawa ef0f8b
shun-iwasawa ef0f8b
void FilePathProperties::saveData(TOStream& os) const {
shun-iwasawa ef0f8b
  os.child("useStandard") << ((m_useStandard) ? 1 : 0);
shun-iwasawa ef0f8b
  os.child("acceptNonAlphabetSuffix") << ((m_acceptNonAlphabetSuffix) ? 1 : 0);
shun-iwasawa ef0f8b
  os.child("letterCountForSuffix") << m_letterCountForSuffix;
shun-iwasawa ef0f8b
}
shun-iwasawa ef0f8b
shun-iwasawa ef0f8b
// make sure to let TFilePath to know the new properties!
shun-iwasawa ef0f8b
void FilePathProperties::loadData(TIStream& is) {
shun-iwasawa ef0f8b
  int val;
shun-iwasawa ef0f8b
  std::string tagName;
shun-iwasawa ef0f8b
  while (is.matchTag(tagName)) {
shun-iwasawa ef0f8b
    if (tagName == "useStandard") {
shun-iwasawa ef0f8b
      is >> val;
shun-iwasawa ef0f8b
      m_useStandard = (val == 1);
shun-iwasawa ef0f8b
    } else if (tagName == "acceptNonAlphabetSuffix") {
shun-iwasawa ef0f8b
      is >> val;
shun-iwasawa ef0f8b
      m_acceptNonAlphabetSuffix = (val == 1);
shun-iwasawa ef0f8b
    } else if (tagName == "letterCountForSuffix") {
shun-iwasawa ef0f8b
      is >> m_letterCountForSuffix;
shun-iwasawa ef0f8b
    }
shun-iwasawa ef0f8b
    is.closeChild();
shun-iwasawa ef0f8b
  }
shun-iwasawa ef0f8b
}