-
-
Notifications
You must be signed in to change notification settings - Fork 87
コーディング規約
Kasugaccho edited this page Oct 13, 2019
·
11 revisions
DungeonTemplateLibraryへ新しい機能を追加する者は以下のコーディング規約のもとにソースコードを追加すること。
クラス名/構造体名はパスカルケース(アッパーキャメルケース)にすること。
class Sample {};
class SampleClass {};
class SampleClass2 {};
class SampleTestTest {};class sample {};
class sampleClass {};
class sample_class {};
class Sample_Class {};関数名はローワーキャメルケースにすること。
void sample();
void sampleClass();
void sampleClass2();
void sampleTestTest();void Sample();
void SampleClass();
void sample_class();
void sample_Class();
void Sample_Class();ファイル名はパスカルケース(アッパーキャメルケース)にすること。
また拡張子として末尾に .hpp をつけること。
Sample.hpp
SampleClass.hpp
SampleClass2.hpp
SampleTestTest.hppsample.hpp
sampleClass.hpp
sample_class.hpp
Sample_Class.hpp
SampleClass.cpp
SampleTestTest.hC/C++で使われる一般の整数型はほとんど使用しない。 代わりとなる型を使用する。
| C/C++の型 | DTLで使用する型 | 型の実装ヘッダ |
|---|---|---|
| char | char | <DTL/Type/IntX.hpp> |
| unsigned char | ::dtl::type::uint8 | <DTL/Type/IntX.hpp> |
| signed char | ::dtl::type::int8 | <DTL/Type/IntX.hpp> |
| unsigned short | ::dtl::type::uint16 | <DTL/Type/IntX.hpp> |
| (signed) short | ::dtl::type::int16 | <DTL/Type/IntX.hpp> |
| unsigned int | ::dtl::type::uint32 | <DTL/Type/IntX.hpp> |
| (signed) int | ::dtl::type::int32 | <DTL/Type/IntX.hpp> |
| unsigned long | ::dtl::type::uint32 | <DTL/Type/IntX.hpp> |
| (signed) long | ::dtl::type::int32 | <DTL/Type/IntX.hpp> |
| unsigned long long | ::dtl::type::uint64 | <DTL/Type/IntX.hpp> |
| (signed) long long | ::dtl::type::int64 | <DTL/Type/IntX.hpp> |
| uint8_t | ::dtl::type::uint8 | <DTL/Type/IntX.hpp> |
| int8_t | ::dtl::type::int8 | <DTL/Type/IntX.hpp> |
| uint16_t | ::dtl::type::uint16 | <DTL/Type/IntX.hpp> |
| int16_t | ::dtl::type::int16 | <DTL/Type/IntX.hpp> |
| uint32_t | ::dtl::type::uint32 | <DTL/Type/IntX.hpp> |
| int32_t | ::dtl::type::int32 | <DTL/Type/IntX.hpp> |
| uint32_t | ::dtl::type::uint32 | <DTL/Type/IntX.hpp> |
| int32_t | ::dtl::type::int32 | <DTL/Type/IntX.hpp> |
| uint64_t | ::dtl::type::uint64 | <DTL/Type/IntX.hpp> |
| int64_t | ::dtl::type::int64 | <DTL/Type/IntX.hpp> |
| uint_least8_t | ::dtl::type::uint_least8 | <DTL/Type/IntX.hpp> |
| int_least8_t | ::dtl::type::int_least8 | <DTL/Type/IntX.hpp> |
| uint_least16_t | ::dtl::type::uint_least16 | <DTL/Type/IntX.hpp> |
| int_least16_t | ::dtl::type::int_least16 | <DTL/Type/IntX.hpp> |
| uint_least32_t | ::dtl::type::uint_least32 | <DTL/Type/IntX.hpp> |
| int_least32_t | ::dtl::type::int_least32 | <DTL/Type/IntX.hpp> |
| uint_least32_t | ::dtl::type::uint_least32 | <DTL/Type/IntX.hpp> |
| int_least32_t | ::dtl::type::int_least32 | <DTL/Type/IntX.hpp> |
| uint_least64_t | ::dtl::type::uint_least64 | <DTL/Type/IntX.hpp> |
| int_least64_t | ::dtl::type::int_least64 | <DTL/Type/IntX.hpp> |
| uint_fast8_t | ::dtl::type::uint_fast8 | <DTL/Type/IntX.hpp> |
| int_fast8_t | ::dtl::type::int_fast8 | <DTL/Type/IntX.hpp> |
| uint_fast16_t | ::dtl::type::uint_fast16 | <DTL/Type/IntX.hpp> |
| int_fast16_t | ::dtl::type::int_fast16 | <DTL/Type/IntX.hpp> |
| uint_fast32_t | ::dtl::type::uint_fast32 | <DTL/Type/IntX.hpp> |
| int_fast32_t | ::dtl::type::int_fast32 | <DTL/Type/IntX.hpp> |
| uint_fast32_t | ::dtl::type::uint_fast32 | <DTL/Type/IntX.hpp> |
| int_fast32_t | ::dtl::type::int_fast32 | <DTL/Type/IntX.hpp> |
| uint_fast64_t | ::dtl::type::uint_fast64 | <DTL/Type/IntX.hpp> |
| int_fast64_t | ::dtl::type::int_fast64 | <DTL/Type/IntX.hpp> |
| size_t | ::dtl::type::size | <DTL/Type/SizeT.hpp> |
| ptrdiff_t | ::dtl::type::ssize | <DTL/Type/SSizeT.hpp> |
配列の添え字に使用する型は ::dtl::type::size である。
DTLでは以下の3種類のマクロを使用する。
| マクロの種類 | 説明 |
|---|---|
| INCLUDED_DUNGEON_TEMPLATE_LIBRARY_XXX | インクルードガードに使用する。 |
| DUNGEON_TEMPLATE_LIBRARY_XXX | 重要なマクロに使用する。 |
| DTL_XXX | それ以外のマクロに使用する。 |
インクルードとして使用する。
#ifndef INCLUDED_DUNGEON_TEMPLATE_LIBRARY_XXX
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_XXX
// 中身
#endif //Included Dungeon Template Library絶対に使用してはならない。
Copyright (c) 2018-2021 As Project.
Distributed under the Boost Software License, Version 1.0.(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)