DYTSrouce/src/workspace/FileEntry.h
2025-10-12 22:14:16 +08:00

34 lines
972 B
C

#pragma once
#include <QString>
enum class FileEntryType {
Curve,
Surface,
Table,
Light
};
struct FileEntry {
FileEntryType type;
QString fileName; // relative file name under workspace dir; may be empty
};
inline const char* FileEntryTypeToString(FileEntryType t) {
switch (t) {
case FileEntryType::Curve: return "curve";
case FileEntryType::Surface: return "surface";
case FileEntryType::Table: return "table";
case FileEntryType::Light: return "light";
}
return "unknown";
}
inline bool FileEntryTypeFromString(const char* s, FileEntryType& out) {
if (!s) return false;
if (0 == strcmp(s, "curve")) { out = FileEntryType::Curve; return true; }
if (0 == strcmp(s, "surface")) { out = FileEntryType::Surface; return true; }
if (0 == strcmp(s, "table")) { out = FileEntryType::Table; return true; }
if (0 == strcmp(s, "light")) { out = FileEntryType::Light; return true; }
return false;
}