Skip to content

Commit

Permalink
Removed using std::(w)string
Browse files Browse the repository at this point in the history
  • Loading branch information
matt77hias committed Jun 4, 2018
1 parent 9bc5e48 commit 6d16452
Show file tree
Hide file tree
Showing 65 changed files with 208 additions and 212 deletions.
2 changes: 1 addition & 1 deletion MAGE/Core/src/scene/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//-----------------------------------------------------------------------------
namespace mage {

Node::Node(string name)
Node::Node(std::string name)
: m_transform(),
m_parent(nullptr),
m_childs(),
Expand Down
8 changes: 4 additions & 4 deletions MAGE/Core/src/scene/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace mage {
@param[in] name
The name of the node.
*/
explicit Node(string name = "");
explicit Node(std::string name = "");

/**
Constructs a node from the given node.
Expand Down Expand Up @@ -456,7 +456,7 @@ namespace mage {
@return A reference to the name of this node.
*/
[[nodiscard]]
const string& GetName() const noexcept {
const std::string& GetName() const noexcept {
return m_name;
}

Expand All @@ -466,7 +466,7 @@ namespace mage {
@param[in] name
The name.
*/
void SetName(string name) noexcept {
void SetName(std::string name) noexcept {
m_name = std::move(name);
}

Expand Down Expand Up @@ -539,7 +539,7 @@ namespace mage {
/**
The name of this node.
*/
string m_name;
std::string m_name;
};
}

Expand Down
6 changes: 3 additions & 3 deletions MAGE/MAGE/src/engine_setup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace mage {
The name of the application.
*/
explicit EngineSetup(NotNull< HINSTANCE > instance,
wstring name = L"MAGE")
std::wstring name = L"MAGE")
: m_instance(instance),
m_name(std::move(name)) {}

Expand Down Expand Up @@ -103,7 +103,7 @@ namespace mage {
@return A reference to the name of the application.
*/
[[nodiscard]]
const wstring& GetApplicationName() const noexcept {
const std::wstring& GetApplicationName() const noexcept {
return m_name;
}

Expand All @@ -121,6 +121,6 @@ namespace mage {
/**
The name of the application.
*/
wstring m_name;
std::wstring m_name;
};
}
6 changes: 3 additions & 3 deletions MAGE/MAGE/src/scene/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//-----------------------------------------------------------------------------
namespace mage {

Scene::Scene(string name)
Scene::Scene(std::string name)
: m_name(std::move(name)),
m_nodes(),
m_scripts() {}
Expand Down Expand Up @@ -79,9 +79,9 @@ namespace mage {
using namespace rendering;
using ModelPtr = ProxyPtr< Model >;
using NodePtr = ProxyPtr< Node >;
using NodePair = std::pair< NodePtr, string >;
using NodePair = std::pair< NodePtr, std::string >;

std::map< string, NodePair > mapping;
std::map< std::string, NodePair > mapping;
NodePtr root;
size_t nb_root_childs = 0;

Expand Down
8 changes: 4 additions & 4 deletions MAGE/MAGE/src/scene/scene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ namespace mage {
@return A reference to the name of this scene.
*/
[[nodiscard]]
const string& GetName() const noexcept {
const std::string& GetName() const noexcept {
return m_name;
}

Expand All @@ -128,7 +128,7 @@ namespace mage {
@param[in] name
The name.
*/
void SetName(string name) noexcept {
void SetName(std::string name) noexcept {
m_name = std::move(name);
}

Expand All @@ -144,7 +144,7 @@ namespace mage {
@param[in] name
The name of the scene.
*/
explicit Scene(string name);
explicit Scene(std::string name);

/**
Constructs a scene from the given scene.
Expand Down Expand Up @@ -216,7 +216,7 @@ namespace mage {
/**
The name of this scene.
*/
string m_name;
std::string m_name;
};
}

Expand Down
2 changes: 1 addition & 1 deletion MAGE/Rendering/src/loaders/material_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace mage::rendering::loader {
ResourceManager& resource_manaer,
std::vector< Material >& materials) {

wstring extension(path.extension());
std::wstring extension(path.extension());
TransformToLowerCase(extension);

if (L".mtl" == extension) {
Expand Down
10 changes: 5 additions & 5 deletions MAGE/Rendering/src/loaders/mdl/mdl_reader.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace mage::rendering::loader {
else {
Warning("%ls: line %u: unsupported keyword token: %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
return;
}

Expand All @@ -65,12 +65,12 @@ namespace mage::rendering::loader {
template< typename VertexT, typename IndexT >
void MDLReader< VertexT, IndexT >::ReadMDLSubModel() {
ModelPart model_part;
model_part.m_child = Read< string >();
model_part.m_parent = Read< string >();
model_part.m_child = Read< std::string >();
model_part.m_parent = Read< std::string >();
model_part.m_transform.SetTranslation(Read< F32, 3 >());
model_part.m_transform.SetRotation( Read< F32, 3 >());
model_part.m_transform.SetScale( Read< F32, 3 >());
model_part.m_material = Read< string >();
model_part.m_material = Read< std::string >();
model_part.m_start_index = Read< U32 >();
model_part.m_nb_indices = Read< U32 >();

Expand All @@ -79,7 +79,7 @@ namespace mage::rendering::loader {

template< typename VertexT, typename IndexT >
void MDLReader< VertexT, IndexT >::ReadMDLMaterialLibrary() {
const auto mtl_name = StringToWString(Read< string >());
const auto mtl_name = StringToWString(Read< std::string >());
auto mtl_path = GetPath();
mtl_path.replace_filename(mtl_name);

Expand Down
2 changes: 1 addition & 1 deletion MAGE/Rendering/src/loaders/mdl/mdl_writer.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace mage::rendering::loader {
return;
}

const auto mtl_fname = WStringToString(wstring(mtl_path.filename()));
const auto mtl_fname = WStringToString(std::wstring(mtl_path.filename()));

char buffer[MAX_PATH];
const auto not_null_buffer = NotNull< const_zstring >(buffer);
Expand Down
4 changes: 2 additions & 2 deletions MAGE/Rendering/src/loaders/model_loader.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace mage::rendering::loader {
ModelOutput< VertexT, IndexT >& model_output,
const MeshDescriptor< VertexT, IndexT >& mesh_desc) {

wstring extension(path.extension());
std::wstring extension(path.extension());
TransformToLowerCase(extension);

if (L".mdl" == extension) {
Expand All @@ -39,7 +39,7 @@ namespace mage::rendering::loader {
void ExportModelToFile(const std::filesystem::path& path,
const ModelOutput< VertexT, IndexT >& model_output) {

wstring extension(path.extension());
std::wstring extension(path.extension());
TransformToLowerCase(extension);

if (L".mdl" == extension) {
Expand Down
6 changes: 3 additions & 3 deletions MAGE/Rendering/src/loaders/mtl/mtl_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace mage::rendering::loader {
else {
Warning("%ls: line %u: unsupported keyword token: %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
return;
}

Expand All @@ -73,7 +73,7 @@ namespace mage::rendering::loader {
void MTLReader::ReadMTLMaterialName() {
auto& material = m_material_buffer.emplace_back(
CreateDefaultMaterial(m_resource_manager));
material.SetName(Read< string >());
material.SetName(Read< std::string >());
}

void MTLReader::ReadMTLBaseColor() {
Expand Down Expand Up @@ -140,7 +140,7 @@ namespace mage::rendering::loader {
[[nodiscard]]
TexturePtr MTLReader::ReadMTLTexture() {
// "-options args" are not supported and are not allowed.
const auto texture_name = StringToWString(Read< string >());
const auto texture_name = StringToWString(Read< std::string >());
auto texture_path = GetPath();
texture_path.replace_filename(texture_name);

Expand Down
24 changes: 12 additions & 12 deletions MAGE/Rendering/src/loaders/obj/obj_reader.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace mage::rendering::loader {
else {
Warning("%ls: line %u: unsupported keyword token: %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
return;
}

Expand All @@ -102,7 +102,7 @@ namespace mage::rendering::loader {

template< typename VertexT, typename IndexT >
void OBJReader< VertexT, IndexT >::ReadOBJMaterialLibrary() {
const auto mtl_name = StringToWString(Read< string >());
const auto mtl_name = StringToWString(Read< std::string >());
auto mtl_path = GetPath();
mtl_path.replace_filename(mtl_name);

Expand All @@ -113,7 +113,7 @@ namespace mage::rendering::loader {

template< typename VertexT, typename IndexT >
void OBJReader< VertexT, IndexT >::ReadOBJMaterialUse() {
m_model_output.SetMaterial(Read< string >());
m_model_output.SetMaterial(Read< std::string >());
}

template< typename VertexT, typename IndexT >
Expand All @@ -122,10 +122,10 @@ namespace mage::rendering::loader {
m_model_output.EndModelPart();

ModelPart model_part;
model_part.m_child = Read< string >();
model_part.m_child = Read< std::string >();
if (ContainsTokens()) {
if (!Contains< F32 >()) {
model_part.m_parent = Read< string >();
model_part.m_parent = Read< std::string >();
}

auto translation = InvertHandness(Point3(Read< F32, 3 >()));
Expand Down Expand Up @@ -273,7 +273,7 @@ namespace mage::rendering::loader {
else {
throw Exception("%ls: line %u: invalid v index value found in %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
}


Expand All @@ -287,7 +287,7 @@ namespace mage::rendering::loader {
else {
throw Exception("%ls: line %u: invalid vn index value found in %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
}
}
else if (const auto slash1 = token.find("/");
Expand All @@ -305,7 +305,7 @@ namespace mage::rendering::loader {
else {
throw Exception("%ls: line %u: invalid v index value found in %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
}

if (const auto slash2 = token.find("/", slash1 + 1);
Expand All @@ -321,7 +321,7 @@ namespace mage::rendering::loader {
else {
throw Exception("%ls: line %u: invalid vt index value found in %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
}

if (const auto result
Expand All @@ -334,7 +334,7 @@ namespace mage::rendering::loader {
else {
throw Exception("%ls: line %u: invalid vn index value found in %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
}
}
else if (const auto result
Expand All @@ -347,7 +347,7 @@ namespace mage::rendering::loader {
else {
throw Exception("%ls: line %u: invalid vt index value found in %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
}
}
else if (const auto result
Expand All @@ -360,7 +360,7 @@ namespace mage::rendering::loader {
else {
throw Exception("%ls: line %u: invalid v index value found in %s.",
GetPath().c_str(), GetCurrentLineNumber(),
string(token).c_str());
std::string(token).c_str());
}

const auto v = static_cast< U32 >((0 <= v_index) ? v_index
Expand Down
2 changes: 1 addition & 1 deletion MAGE/Rendering/src/loaders/sprite_font_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace mage::rendering::loader {
SpriteFontOutput& output,
const SpriteFontDescriptor& desc) {

wstring extension(path.extension());
std::wstring extension(path.extension());
TransformToLowerCase(extension);

if (L".font" == extension) {
Expand Down
6 changes: 3 additions & 3 deletions MAGE/Rendering/src/loaders/texture_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace mage::rendering::loader {
ID3D11Device& device,
NotNull< ID3D11ShaderResourceView** > texture_srv) {

wstring extension(path.extension());
std::wstring extension(path.extension());
TransformToLowerCase(extension);

if (L".dds" == extension) {
Expand Down Expand Up @@ -58,7 +58,7 @@ namespace mage::rendering::loader {
*/
[[nodiscard]]
static inline const GUID
GetGUIDContainerFormat(const wstring& extension) noexcept {
GetGUIDContainerFormat(const std::wstring& extension) noexcept {

if (L".png" == extension) {
return GUID_ContainerFormatPng;
Expand Down Expand Up @@ -96,7 +96,7 @@ namespace mage::rendering::loader {
ID3D11DeviceContext& device_context,
ID3D11Resource& texture) {

wstring extension(path.extension());
std::wstring extension(path.extension());
TransformToLowerCase(extension);

if (L".dds" == extension) {
Expand Down
6 changes: 3 additions & 3 deletions MAGE/Rendering/src/renderer/swap_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ namespace mage::rendering {
Failed to take a screenshot of the current back buffer
of this swap chain.
*/
void TakeScreenShot(const wstring& fname) const;
void TakeScreenShot(const std::wstring& fname) const;

private:

Expand Down Expand Up @@ -465,7 +465,7 @@ namespace mage::rendering {
m_swap_chain->Present(sync_interval, 0u);
}

void SwapChain::Impl::TakeScreenShot(const wstring& fname) const {
void SwapChain::Impl::TakeScreenShot(const std::wstring& fname) const {
ComPtr< ID3D11Texture2D > back_buffer;
{
// Access the only back buffer of the swap-chain.
Expand Down Expand Up @@ -558,7 +558,7 @@ namespace mage::rendering {
m_impl->Present();
}

void SwapChain::TakeScreenShot(const wstring& fname) const {
void SwapChain::TakeScreenShot(const std::wstring& fname) const {
m_impl->TakeScreenShot(fname);
}

Expand Down
Loading

0 comments on commit 6d16452

Please sign in to comment.