diff --git a/code/MMDCpp14.h b/code/MMDCpp14.h index 212897dc2..ad112de0f 100644 --- a/code/MMDCpp14.h +++ b/code/MMDCpp14.h @@ -1,19 +1,20 @@ #pragma once #ifndef MMD_CPP14_H +#define MMD_CPP14_H #include #include #include #include -namespace std { +namespace mmd { template struct _Unique_if { - typedef unique_ptr _Single_object; + typedef std::unique_ptr _Single_object; }; template struct _Unique_if { - typedef unique_ptr _Unknown_bound; + typedef std::unique_ptr _Unknown_bound; }; template struct _Unique_if { @@ -23,14 +24,14 @@ namespace std { template typename _Unique_if::_Single_object make_unique(Args&&... args) { - return unique_ptr(new T(std::forward(args)...)); + return std::unique_ptr(new T(std::forward(args)...)); } template typename _Unique_if::_Unknown_bound make_unique(size_t n) { - typedef typename remove_extent::type U; - return unique_ptr(new U[n]()); + typedef typename std::remove_extent::type U; + return std::unique_ptr(new U[n]()); } template @@ -38,4 +39,4 @@ namespace std { make_unique(Args&&...) = delete; } -#endif \ No newline at end of file +#endif diff --git a/code/MMDPmdParser.h b/code/MMDPmdParser.h index 233e5de14..375c323df 100644 --- a/code/MMDPmdParser.h +++ b/code/MMDPmdParser.h @@ -454,7 +454,7 @@ namespace pmd /// ファイルからPmdModelを生成する static std::unique_ptr LoadFromStream(std::ifstream *stream) { - auto result = std::make_unique(); + auto result = mmd::make_unique(); char buffer[100]; // magic @@ -627,4 +627,4 @@ namespace pmd return result; } }; -} \ No newline at end of file +} diff --git a/code/MMDPmxParser.cpp b/code/MMDPmxParser.cpp index f115f80f8..352259df5 100644 --- a/code/MMDPmxParser.cpp +++ b/code/MMDPmxParser.cpp @@ -163,19 +163,19 @@ namespace pmx switch (this->skinning_type) { case PmxVertexSkinningType::BDEF1: - this->skinning = std::make_unique(); + this->skinning = mmd::make_unique(); break; case PmxVertexSkinningType::BDEF2: - this->skinning = std::make_unique(); + this->skinning = mmd::make_unique(); break; case PmxVertexSkinningType::BDEF4: - this->skinning = std::make_unique(); + this->skinning = mmd::make_unique(); break; case PmxVertexSkinningType::SDEF: - this->skinning = std::make_unique(); + this->skinning = mmd::make_unique(); break; case PmxVertexSkinningType::QDEF: - this->skinning = std::make_unique(); + this->skinning = mmd::make_unique(); break; default: throw "invalid skinning type"; @@ -254,7 +254,7 @@ namespace pmx stream->read((char*) &ik_loop, sizeof(int)); stream->read((char*) &ik_loop_angle_limit, sizeof(float)); stream->read((char*) &ik_link_count, sizeof(int)); - this->ik_links = std::make_unique(ik_link_count); + this->ik_links = mmd::make_unique(ik_link_count); for (int i = 0; i < ik_link_count; i++) { ik_links[i].Read(stream, setting); } @@ -325,28 +325,28 @@ namespace pmx switch (this->morph_type) { case MorphType::Group: - group_offsets = std::make_unique(this->offset_count); + group_offsets = mmd::make_unique(this->offset_count); for (int i = 0; i < offset_count; i++) { group_offsets[i].Read(stream, setting); } break; case MorphType::Vertex: - vertex_offsets = std::make_unique(this->offset_count); + vertex_offsets = mmd::make_unique(this->offset_count); for (int i = 0; i < offset_count; i++) { vertex_offsets[i].Read(stream, setting); } break; case MorphType::Bone: - bone_offsets = std::make_unique(this->offset_count); + bone_offsets = mmd::make_unique(this->offset_count); for (int i = 0; i < offset_count; i++) { bone_offsets[i].Read(stream, setting); } break; case MorphType::Matrial: - material_offsets = std::make_unique(this->offset_count); + material_offsets = mmd::make_unique(this->offset_count); for (int i = 0; i < offset_count; i++) { material_offsets[i].Read(stream, setting); @@ -357,7 +357,7 @@ namespace pmx case MorphType::AdditionalUV2: case MorphType::AdditionalUV3: case MorphType::AdditionalUV4: - uv_offsets = std::make_unique(this->offset_count); + uv_offsets = mmd::make_unique(this->offset_count); for (int i = 0; i < offset_count; i++) { uv_offsets[i].Read(stream, setting); @@ -386,7 +386,7 @@ namespace pmx this->frame_english_name = ReadString(stream, setting->encoding); stream->read((char*) &this->frame_flag, sizeof(uint8_t)); stream->read((char*) &this->element_count, sizeof(int)); - this->elements = std::make_unique(this->element_count); + this->elements = mmd::make_unique(this->element_count); for (int i = 0; i < this->element_count; i++) { this->elements[i].Read(stream, setting); @@ -505,7 +505,7 @@ namespace pmx // 頂点 stream->read((char*) &vertex_count, sizeof(int)); - this->vertices = std::make_unique(vertex_count); + this->vertices = mmd::make_unique(vertex_count); for (int i = 0; i < vertex_count; i++) { vertices[i].Read(stream, &setting); @@ -513,7 +513,7 @@ namespace pmx // 面 stream->read((char*) &index_count, sizeof(int)); - this->indices = std::make_unique(index_count); + this->indices = mmd::make_unique(index_count); for (int i = 0; i < index_count; i++) { this->indices[i] = ReadIndex(stream, setting.vertex_index_size); @@ -521,7 +521,7 @@ namespace pmx // テクスチャ stream->read((char*) &texture_count, sizeof(int)); - this->textures = std::make_unique(texture_count); + this->textures = mmd::make_unique(texture_count); for (int i = 0; i < texture_count; i++) { this->textures[i] = ReadString(stream, setting.encoding); @@ -529,7 +529,7 @@ namespace pmx // マテリアル stream->read((char*) &material_count, sizeof(int)); - this->materials = std::make_unique(material_count); + this->materials = mmd::make_unique(material_count); for (int i = 0; i < material_count; i++) { this->materials[i].Read(stream, &setting); @@ -537,7 +537,7 @@ namespace pmx // ボーン stream->read((char*) &this->bone_count, sizeof(int)); - this->bones = std::make_unique(this->bone_count); + this->bones = mmd::make_unique(this->bone_count); for (int i = 0; i < this->bone_count; i++) { this->bones[i].Read(stream, &setting); @@ -545,7 +545,7 @@ namespace pmx // モーフ stream->read((char*) &this->morph_count, sizeof(int)); - this->morphs = std::make_unique(this->morph_count); + this->morphs = mmd::make_unique(this->morph_count); for (int i = 0; i < this->morph_count; i++) { this->morphs[i].Read(stream, &setting); @@ -553,7 +553,7 @@ namespace pmx // 表示枠 stream->read((char*) &this->frame_count, sizeof(int)); - this->frames = std::make_unique(this->frame_count); + this->frames = mmd::make_unique(this->frame_count); for (int i = 0; i < this->frame_count; i++) { this->frames[i].Read(stream, &setting); @@ -561,7 +561,7 @@ namespace pmx // 剛体 stream->read((char*) &this->rigid_body_count, sizeof(int)); - this->rigid_bodies = std::make_unique(this->rigid_body_count); + this->rigid_bodies = mmd::make_unique(this->rigid_body_count); for (int i = 0; i < this->rigid_body_count; i++) { this->rigid_bodies[i].Read(stream, &setting); @@ -569,7 +569,7 @@ namespace pmx // ジョイント stream->read((char*) &this->joint_count, sizeof(int)); - this->joints = std::make_unique(this->joint_count); + this->joints = mmd::make_unique(this->joint_count); for (int i = 0; i < this->joint_count; i++) { this->joints[i].Read(stream, &setting); @@ -579,7 +579,7 @@ namespace pmx //if (this->version == 2.1f) //{ // stream->read((char*) &this->soft_body_count, sizeof(int)); - // this->soft_bodies = std::make_unique(this->soft_body_count); + // this->soft_bodies = mmd::make_unique(this->soft_body_count); // for (int i = 0; i < this->soft_body_count; i++) // { // this->soft_bodies[i].Read(stream, &setting); @@ -601,7 +601,7 @@ namespace pmx //std::unique_ptr ReadFromStream(std::istream *stream) //{ - // auto pmx = std::make_unique(); + // auto pmx = mmd::make_unique(); // pmx->Read(stream); // return pmx; //} diff --git a/code/MMDVmdParser.h b/code/MMDVmdParser.h index 889a579db..380a10c5d 100644 --- a/code/MMDVmdParser.h +++ b/code/MMDVmdParser.h @@ -220,7 +220,7 @@ namespace vmd { char buffer[30]; - auto result = std::make_unique(); + auto result = mmd::make_unique(); // magic and version stream->read((char*) buffer, 30); @@ -364,4 +364,4 @@ namespace vmd return true; } }; -} \ No newline at end of file +}