Add Scene deserialization
This commit is contained in:
@@ -61,6 +61,11 @@ namespace Copium
|
||||
LoadMetaFile(stream);
|
||||
}
|
||||
|
||||
const std::map<std::string, MetaFileClass>& MetaFile::GetMetaFileClasses()
|
||||
{
|
||||
return classes;
|
||||
}
|
||||
|
||||
bool MetaFile::HasMetaClass(const std::string& className) const
|
||||
{
|
||||
return classes.find(className) != classes.end();
|
||||
@@ -161,19 +166,18 @@ namespace Copium
|
||||
{
|
||||
std::vector<MetaFile> metaFiles;
|
||||
std::ifstream stream{file};
|
||||
if(stream)
|
||||
|
||||
CP_ASSERT(stream, "Failed to read file: %s", file.c_str());
|
||||
|
||||
MetaFile meta;
|
||||
while(!stream.eof())
|
||||
{
|
||||
MetaFile meta;
|
||||
while(!stream.eof())
|
||||
{
|
||||
MetaFile meta{};
|
||||
stream >> meta;
|
||||
if(meta.classes.empty())
|
||||
continue;
|
||||
metaFiles.emplace_back(meta);
|
||||
}
|
||||
return metaFiles;
|
||||
MetaFile meta{};
|
||||
stream >> meta;
|
||||
if(meta.classes.empty())
|
||||
continue;
|
||||
metaFiles.emplace_back(meta);
|
||||
}
|
||||
return {};
|
||||
return metaFiles;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ namespace Copium
|
||||
MetaFile(std::istream& stream);
|
||||
|
||||
bool HasMetaClass(const std::string& className) const;
|
||||
|
||||
const std::map<std::string, MetaFileClass>& GetMetaFileClasses();
|
||||
MetaFileClass& GetMetaClass(const std::string& className);
|
||||
const MetaFileClass& GetMetaClass(const std::string& className) const;
|
||||
const std::string& GetFilePath() const;
|
||||
|
||||
@@ -55,17 +55,17 @@ namespace Copium
|
||||
return string;
|
||||
}
|
||||
|
||||
bool Uuid::operator==(const Uuid& rhs)
|
||||
bool Uuid::operator==(const Uuid& rhs) const
|
||||
{
|
||||
return msb == rhs.msb && lsb == rhs.lsb;
|
||||
}
|
||||
|
||||
bool Uuid::operator!=(const Uuid& rhs)
|
||||
bool Uuid::operator!=(const Uuid& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool Uuid::operator<(const Uuid& rhs)
|
||||
bool Uuid::operator<(const Uuid& rhs) const
|
||||
{
|
||||
if (msb != rhs.msb)
|
||||
return msb < rhs.msb;
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace Copium
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
bool operator==(const Uuid& rhs);
|
||||
bool operator!=(const Uuid& rhs);
|
||||
bool operator<(const Uuid& rhs);
|
||||
bool operator==(const Uuid& rhs) const;
|
||||
bool operator!=(const Uuid& rhs) const;
|
||||
bool operator<(const Uuid& rhs) const;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const Uuid& uuid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user