Removed std.core
This commit is contained in:
parent
080f6177d2
commit
defbb33ce8
BIN
msbuild.binlog
Normal file
BIN
msbuild.binlog
Normal file
Binary file not shown.
|
@ -1,5 +1,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
|
import Shadow.FileFormat;
|
||||||
|
|
||||||
TEST(TestCaseName, TestName) {
|
TEST(TestCaseName, TestName) {
|
||||||
EXPECT_EQ(1, 1);
|
EXPECT_EQ(1, 1);
|
||||||
EXPECT_TRUE(true);
|
EXPECT_TRUE(true);
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
|
|
||||||
// TODO: write your library functions here
|
|
||||||
|
|
|
@ -18,10 +18,22 @@
|
||||||
<ImportGroup Label="Shared">
|
<ImportGroup Label="Shared">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<CompileAs>CompileAsCppModule</CompileAs>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src/**/*.cpp" />
|
<ClCompile Include="src/SFFElement.cpp" />
|
||||||
<ClInclude Include="src/**/*.h" />
|
<ClCompile Include="src/SFFParser.cpp" />
|
||||||
|
|
||||||
|
<ClCompile Include="src/SFFElement.ixx" />
|
||||||
|
<ClCompile Include="src/Shadow.FileFormat.ixx" />
|
||||||
|
<ClCompile Include="src/SFFParser.ixx" />
|
||||||
|
<ClCompile Include="src/SFFVersion.ixx" />
|
||||||
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\shadow-utility\shadow-utility.vcxproj">
|
<ProjectReference Include="..\shadow-utility\shadow-utility.vcxproj">
|
||||||
<Project>{7b9e6056-e4fb-411b-9612-a2fd679c2b69}</Project>
|
<Project>{7b9e6056-e4fb-411b-9612-a2fd679c2b69}</Project>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src/**/*.cpp">
|
<ClCompile Include="src\SFFParser.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src/**/*.cpp">
|
<ClCompile Include="src/**/*.cpp">
|
||||||
|
@ -24,9 +24,20 @@
|
||||||
<ClCompile Include="src/**/*.cpp">
|
<ClCompile Include="src/**/*.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src/SFFElement.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src/SFFParser.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="SFFElement.ixx" />
|
||||||
|
<ClCompile Include="Shadow.FileFormat.ixx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="src/**/*.h">
|
<ClInclude Include="src\SFFParser.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\SFFVersion.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src/**/*.h">
|
<ClInclude Include="src/**/*.h">
|
||||||
|
@ -41,5 +52,14 @@
|
||||||
<ClInclude Include="src/**/*.h">
|
<ClInclude Include="src/**/*.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src/**/*.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src/SFFParser.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src/SFFVersion.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,26 +1,37 @@
|
||||||
//#include "pch.h"
|
module;
|
||||||
#include "SFFElement.h"
|
|
||||||
|
|
||||||
SFFElement* SFFElement::GetFirstChild()
|
import <string>;
|
||||||
{
|
|
||||||
return children.size() > 0 ? children[0]: nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
SFFElement* SFFElement::GetChildByIndex(int i)
|
import shadow_utils;
|
||||||
{
|
|
||||||
ChildrenMap::iterator it = children.begin();
|
module Shadow.FileFormat:SFFElement;
|
||||||
for (size_t i = 0; i < i; i++)
|
|
||||||
|
|
||||||
|
namespace Shadow::SFF {
|
||||||
|
|
||||||
|
|
||||||
|
SFFElement* SFFElement::GetFirstChild()
|
||||||
{
|
{
|
||||||
it++;
|
return children.size() > 0 ? children.begin()->second : nullptr;
|
||||||
}
|
}
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
SFFElement* SFFElement::GetChildByName(std::string name)
|
SFFElement* SFFElement::GetChildByIndex(int index)
|
||||||
{
|
{
|
||||||
ChildrenMap::iterator it = children.find(name);
|
ChildrenMap::iterator it = children.begin();
|
||||||
if (it != children.end()) {
|
for (size_t i = 0; i < index; i++)
|
||||||
|
{
|
||||||
|
it++;
|
||||||
|
}
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
return nullptr;
|
|
||||||
}
|
SFFElement* SFFElement::GetChildByName(std::string name)
|
||||||
|
{
|
||||||
|
ChildrenMap::iterator it = children.find(name);
|
||||||
|
if (it != children.end()) {
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <list>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class SFFElement
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SFFElement* parent;
|
|
||||||
|
|
||||||
std::string name;
|
|
||||||
|
|
||||||
bool isBlock;
|
|
||||||
|
|
||||||
std::string value;
|
|
||||||
typedef std::map<std::string, SFFElement*> ChildrenMap;
|
|
||||||
|
|
||||||
std::list<SFFElement*> properties_old;
|
|
||||||
std::map<std::string, SFFElement*> children;
|
|
||||||
|
|
||||||
std::string GetStringProperty(std::string name);
|
|
||||||
|
|
||||||
SFFElement* GetFirstChild();
|
|
||||||
|
|
||||||
SFFElement* GetChildByIndex(int i);
|
|
||||||
SFFElement* GetChildByName(std::string name);
|
|
||||||
|
|
||||||
~SFFElement();
|
|
||||||
|
|
||||||
};
|
|
40
projs/shadow-file-format/src/SFFElement.ixx
Normal file
40
projs/shadow-file-format/src/SFFElement.ixx
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
module;
|
||||||
|
|
||||||
|
import <string>;
|
||||||
|
import <map>;
|
||||||
|
import <list>;
|
||||||
|
|
||||||
|
export module Shadow.FileFormat:SFFElement;
|
||||||
|
|
||||||
|
|
||||||
|
export namespace Shadow::SFF {
|
||||||
|
|
||||||
|
class SFFElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SFFElement* parent;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
bool isBlock;
|
||||||
|
|
||||||
|
std::string value;
|
||||||
|
typedef std::map<std::string, SFFElement*> ChildrenMap;
|
||||||
|
|
||||||
|
std::list<SFFElement*> properties_old;
|
||||||
|
std::map<std::string, SFFElement*> children;
|
||||||
|
|
||||||
|
std::string GetStringProperty(std::string name);
|
||||||
|
|
||||||
|
|
||||||
|
SFFElement* GetFirstChild();
|
||||||
|
|
||||||
|
SFFElement* GetChildByIndex(int index);
|
||||||
|
|
||||||
|
SFFElement* GetChildByName(std::string name);
|
||||||
|
|
||||||
|
~SFFElement();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -1,12 +1,17 @@
|
||||||
#include "SFFParser.h"
|
module;
|
||||||
|
import <string>;
|
||||||
#include <fstream>
|
import <iostream>;
|
||||||
#include <iostream>
|
import <string>;
|
||||||
|
|
||||||
import shadow_utils;
|
import shadow_utils;
|
||||||
|
|
||||||
|
module Shadow.FileFormat:SFFParser;
|
||||||
|
|
||||||
namespace ShadowEngine::SFF {
|
import :SFFElement;
|
||||||
|
import :SFFVersion;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Shadow::SFF {
|
||||||
|
|
||||||
SFFElement* SFFParser::ReadFromStream(std::istream& stream)
|
SFFElement* SFFParser::ReadFromStream(std::istream& stream)
|
||||||
{
|
{
|
||||||
|
@ -27,8 +32,6 @@ namespace ShadowEngine::SFF {
|
||||||
auto* current = new SFFElement;
|
auto* current = new SFFElement;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string buffer;
|
std::string buffer;
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
|
|
|
@ -1,12 +1,19 @@
|
||||||
#pragma once
|
module;
|
||||||
#include "SFFElement.h"
|
|
||||||
#include "SFFVersion.h"
|
|
||||||
|
|
||||||
namespace ShadowEngine::SFF {
|
import <string>;
|
||||||
|
import <iostream>;
|
||||||
|
|
||||||
|
export module Shadow.FileFormat:SFFParser;
|
||||||
|
|
||||||
|
import :SFFElement;
|
||||||
|
import :SFFVersion;
|
||||||
|
|
||||||
|
export namespace Shadow::SFF {
|
||||||
|
|
||||||
class SFFParser
|
class SFFParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static SFFElement* ReadFromStream(std::istream& stream);
|
static SFFElement* ReadFromStream(std::istream& stream);
|
||||||
|
|
||||||
static SFFVersion ReadVersionFromHeader(std::istream& stream);
|
static SFFVersion ReadVersionFromHeader(std::istream& stream);
|
|
@ -1,25 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
struct SFFVersion {
|
|
||||||
public:
|
|
||||||
int mayor;
|
|
||||||
int minor;
|
|
||||||
int patch;
|
|
||||||
|
|
||||||
bool invalid;
|
|
||||||
|
|
||||||
SFFVersion(int ma, int mi, int pa)
|
|
||||||
{
|
|
||||||
this->mayor = ma;
|
|
||||||
this->minor = mi;
|
|
||||||
this->patch = pa;
|
|
||||||
|
|
||||||
if (ma >= 0 && mi >= 0 && pa >= 0) {
|
|
||||||
this->invalid = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
invalid = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
28
projs/shadow-file-format/src/SFFVersion.ixx
Normal file
28
projs/shadow-file-format/src/SFFVersion.ixx
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
export module Shadow.FileFormat:SFFVersion;
|
||||||
|
|
||||||
|
export namespace Shadow::SFF {
|
||||||
|
|
||||||
|
struct SFFVersion {
|
||||||
|
public:
|
||||||
|
int mayor;
|
||||||
|
int minor;
|
||||||
|
int patch;
|
||||||
|
|
||||||
|
bool invalid;
|
||||||
|
|
||||||
|
SFFVersion(int ma, int mi, int pa)
|
||||||
|
{
|
||||||
|
this->mayor = ma;
|
||||||
|
this->minor = mi;
|
||||||
|
this->patch = pa;
|
||||||
|
|
||||||
|
if (ma >= 0 && mi >= 0 && pa >= 0) {
|
||||||
|
this->invalid = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
invalid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
5
projs/shadow-file-format/src/Shadow.FileFormat.ixx
Normal file
5
projs/shadow-file-format/src/Shadow.FileFormat.ixx
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export module Shadow.FileFormat;
|
||||||
|
|
||||||
|
export import :SFFElement;
|
||||||
|
export import :SFFParser;
|
||||||
|
export import :SFFVersion;
|
|
@ -1,5 +1,9 @@
|
||||||
|
module;
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
export module shadow_utils;
|
export module shadow_utils;
|
||||||
|
|
||||||
import std.core;
|
|
||||||
|
|
||||||
export std::vector<std::string> explode(const std::string& s, const char& c);
|
export std::vector<std::string> explode(const std::string& s, const char& c);
|
|
@ -1,8 +1,10 @@
|
||||||
|
module;
|
||||||
|
|
||||||
|
import <string>;
|
||||||
|
import <vector>;
|
||||||
|
|
||||||
module shadow_utils;
|
module shadow_utils;
|
||||||
|
|
||||||
import std.core;
|
|
||||||
|
|
||||||
|
|
||||||
inline std::vector<std::string> explode(const std::string& s, const char& c)
|
inline std::vector<std::string> explode(const std::string& s, const char& c)
|
||||||
{
|
{
|
||||||
std::string buff;
|
std::string buff;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user