Skip to content

Commit

Permalink
[共通] ドキュメント追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Reputeless committed Nov 19, 2023
1 parent a6ae932 commit 11d4d8f
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Siv3D/include/Siv3D/AsyncTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ namespace s3d
SIV3D_NODISCARD_CXX20
AsyncTask(AsyncTask&& other) noexcept;

/// @brief 非同期処理のタスクを作成します
/// @brief 非同期処理のタスクを作成します
/// @tparam Fty 非同期処理のタスクで実行する関数の型
/// @tparam ...Args 非同期処理のタスクで実行する関数の引数の型
/// @param f 非同期処理のタスクで実行する関数
/// @param ...args 非同期処理のタスクで実行する関数の引数
/// @remark 作成と同時にタスクが非同期で実行されます
/// @remark 作成と同時にタスクが非同期で実行されます。
/// @remark 参照を渡す場合は `std::ref()` を使ってください。
template <class Fty, class... Args, std::enable_if_t<std::is_invocable_v<Fty, Args...>>* = nullptr>
SIV3D_NODISCARD_CXX20
explicit AsyncTask(Fty&& f, Args&&... args);
Expand Down Expand Up @@ -99,12 +100,13 @@ namespace s3d
template <class Fty, class... Args, std::enable_if_t<std::is_invocable_v<Fty, Args...>>* = nullptr>
AsyncTask(Fty, Args...)->AsyncTask<std::invoke_result_t<std::decay_t<Fty>, std::decay_t<Args>...>>;

/// @brief 非同期処理のタスクを作成します
/// @brief 非同期処理のタスクを作成します
/// @tparam Fty 非同期処理のタスクで実行する関数の型
/// @tparam ...Args 非同期処理のタスクで実行する関数の引数の型
/// @param f 非同期処理のタスクで実行する関数
/// @param ...args 非同期処理のタスクで実行する関数の引数
/// @remark 作成と同時にタスクが非同期で実行されます
/// @remark 作成と同時にタスクが非同期で実行されます。
/// @remark 参照を渡す場合は `std::ref()` を使ってください。
/// @return 作成された非同期処理のタスク
template <class Fty, class... Args, std::enable_if_t<std::is_invocable_v<Fty, Args...>>* = nullptr>
[[nodiscard]]
Expand Down
4 changes: 4 additions & 0 deletions Siv3D/include/Siv3D/Circle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,13 @@ namespace s3d
[[nodiscard]]
constexpr position_type left() const noexcept;

/// @brief X 軸に平行な直径(線分)を返します。
/// @return X 軸に平行な直径(線分)
[[nodiscard]]
constexpr Line horizontalDiameter() const noexcept;

/// @brief Y 軸に平行な直径(線分)を返します。
/// @return Y 軸に平行な直径(線分)
[[nodiscard]]
constexpr Line verticalDiameter() const noexcept;

Expand Down
49 changes: 48 additions & 1 deletion Siv3D/include/Siv3D/ColorF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

namespace s3d
{
/// @brief RGBA カラーを、それぞれの要素について 0.0~1.0 の範囲で表現するクラスです。
/// @brief 色を RGBA 各要素について浮動小数点数で表現するクラスです。
/// @remark 各要素は通常 0.0 以上 1.0 以下の値を持ちます。
struct ColorF
{
/// @brief 赤 | Red
Expand All @@ -38,6 +39,11 @@ namespace s3d
SIV3D_NODISCARD_CXX20
ColorF(const ColorF&) = default;

/// @brief 色を作成します。
/// @param _r 赤成分
/// @param _g 緑成分
/// @param _b 青成分
/// @param _a アルファ成分
SIV3D_NODISCARD_CXX20
constexpr ColorF(double _r, double _g, double _b, double _a = 1.0) noexcept;

Expand Down Expand Up @@ -172,18 +178,29 @@ namespace s3d
[[deprecated("use withA()")]]
constexpr ColorF withAlpha(double _a) const noexcept;

/// @brief グレースケール値を返します。
/// @remark グレースケール値は、`(0.299 * r) + (0.587 * g) + (0.114 * b)` で計算されます。
/// @return グレースケール値
[[nodiscard]]
constexpr double grayscale() const noexcept;

/// @brief RGB 各成分の最小値を返します。
/// @return RGB 各成分の最小値
[[nodiscard]]
constexpr double minRGBComponent() const noexcept;

/// @brief RGB 各成分の最大値を返します。
/// @return RGB 各成分の最大値
[[nodiscard]]
constexpr double maxRGBComponent() const noexcept;

/// @brief RGBA 各成分の最小値を返します。
/// @return RGBA 各成分の最小値
[[nodiscard]]
constexpr double minComponent() const noexcept;

/// @brief RGBA 各成分の最大値を返します。
/// @return RGBA 各成分の最大値
[[nodiscard]]
constexpr double maxComponent() const noexcept;

Expand All @@ -202,45 +219,75 @@ namespace s3d
[[nodiscard]]
size_t hash() const noexcept;

/// @brief 色を Color で返します。
/// @remark 各成分は 0.0~1.0 の範囲にクランプされます。
/// @return 変換された Color
[[nodiscard]]
constexpr Color toColor() const noexcept;

/// @brief Float4{ r, g, b, a } を返します。
/// @return Float4{ r, g, b, a }
[[nodiscard]]
constexpr Float4 toFloat4() const noexcept;

/// @brief Vec4{ r, g, b, a } を返します。
/// @return Vec4{ r, g, b, a }
[[nodiscard]]
constexpr Vec4 toVec4() const noexcept;

/// @brief Vec2{ r, g } を返します。
/// @return Vec2{ r, g }
[[nodiscard]]
constexpr Vec2 rg() const noexcept;

/// @brief Vec2{ g, b } を返します。
/// @return Vec2{ g, b }
[[nodiscard]]
constexpr Vec2 gb() const noexcept;

/// @brief Vec2{ b, a } を返します。
/// @return Vec2{ b, a }
[[nodiscard]]
constexpr Vec2 ba() const noexcept;

/// @brief Vec3{ r, g, b } を返します。
/// @return Vec3{ r, g, b }
[[nodiscard]]
constexpr Vec3 rgb() const noexcept;

/// @brief Vec3{ g, b, a } を返します。
/// @return Vec3{ g, b, a }
[[nodiscard]]
constexpr Vec3 gba() const noexcept;

/// @brief Vec3{ b, g, r } を返します。
/// @return Vec3{ b, g, r }
[[nodiscard]]
constexpr Vec3 bgr() const noexcept;

/// @brief Vec4{ r, g, b, a } を返します。
/// @remark `toVec4()` と同じです。
/// @return Vec4{ r, g, b, a }
[[nodiscard]]
constexpr Vec4 rgba() const noexcept;

/// @brief Vec4{ r, g, b, 0 } を返します。
/// @return Vec4{ r, g, b, 0 }
[[nodiscard]]
constexpr Vec4 rgb0() const noexcept;

/// @brief Vec4{ r, g, b, 1 } を返します。
/// @return Vec4{ r, g, b, 1 }
[[nodiscard]]
constexpr Vec4 rgb1() const noexcept;

/// @brief Vec4{ a, r, g, b } を返します。
/// @return Vec4{ a, r, g, b }
[[nodiscard]]
constexpr Vec4 argb() const noexcept;

/// @brief Vec4{ a, b, g, r } を返します。
/// @return Vec4{ a, b, g, r }
[[nodiscard]]
constexpr Vec4 abgr() const noexcept;

Expand Down
39 changes: 39 additions & 0 deletions Siv3D/include/Siv3D/INI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,46 +94,82 @@ namespace s3d

INI();

/// @brief INI 形式のデータをファイルからロードして作成します。
/// @param path ファイルパス
/// @param encoding テキストエンコーディング
/// @remark ファイルのすべての内容を読み取り、以降はファイルには一切アクセスしません。
explicit INI(FilePathView path, const Optional<TextEncoding>& encoding = unspecified);

template <class Reader, std::enable_if_t<std::is_base_of_v<IReader, Reader> && !std::is_lvalue_reference_v<Reader>>* = nullptr>
explicit INI(Reader&& reader, const Optional<TextEncoding>& encoding = unspecified);

explicit INI(std::unique_ptr<IReader>&& reader, const Optional<TextEncoding>& encoding = unspecified);

/// @brief INI 形式のデータをファイルからロードします。
/// @param path ファイルパス
/// @param encoding テキストエンコーディング
/// @remark ファイルのすべての内容を読み取り、以降はファイルには一切アクセスしません。
/// @return ロードに成功した場合 true, それ以外の場合は false
bool load(FilePathView path, const Optional<TextEncoding>& encoding = unspecified);

template <class Reader, std::enable_if_t<std::is_base_of_v<IReader, Reader> && !std::is_lvalue_reference_v<Reader>>* = nullptr>
bool load(Reader&& reader, const Optional<TextEncoding>& encoding = unspecified);

bool load(std::unique_ptr<IReader>&& reader, const Optional<TextEncoding>& encoding = unspecified);

/// @brief 保持しているデータを消去します。
void clear();

/// @brief データが空であるかを返します。
/// @return データが空である場合 true, それ以外の場合は false
[[nodiscard]]
bool isEmpty() const noexcept;

/// @brief データが空でないかを返します。
/// @return データが空でない場合 true, それ以外の場合は false
[[nodiscard]]
explicit operator bool() const noexcept;

/// @brief セクションの一覧を返します。
/// @return セクションの一覧
[[nodiscard]]
const Array<INISection>& sections() const noexcept;

/// @brief 指定したセクションが存在するかを返します。
/// @param section セクション名
/// @return 指定したセクションが存在する場合 true, それ以外の場合は false
[[nodiscard]]
bool hasSection(SectionView section) const;

/// @brief 指定したセクションを返します。
/// @param section セクション名
/// @return セクション
[[nodiscard]]
const INISection& getSection(SectionView section) const;

/// @brief プロパティが存在するかを返します。
/// @param section セクション名
/// @param name プロパティ名
/// @return プロパティが存在する場合 true, それ以外の場合は false
[[nodiscard]]
bool hasValue(SectionView section, NameView name) const;

/// @brief プロパティの値を返します。
/// @param section セクション名
/// @param name プロパティ名
/// @return プロパティの値
[[nodiscard]]
const String& getValue(SectionView section, NameView name) const;

/// @brief セクションに属さないグローバルプロパティが存在するかを返します。
/// @param name プロパティ名
/// @return グローバルプロパティが存在する場合 true, それ以外の場合は false
[[nodiscard]]
bool hasGlobalValue(NameView name) const;

/// @brief セクションに属さないグローバルプロパティの値を返します。
/// @param name プロパティ名
/// @return グローバルプロパティの値
[[nodiscard]]
const String& getGlobalValue(NameView name) const;

Expand Down Expand Up @@ -181,6 +217,9 @@ namespace s3d
template <class Type>
void writeGlobal(NameView name, const Type& value);

/// @brief INI 形式のデータをファイルに保存します。
/// @param path ファイルパス
/// @return 保存に成功した場合 true, それ以外の場合は false
bool save(FilePathView path) const;

private:
Expand Down
41 changes: 41 additions & 0 deletions Siv3D/include/Siv3D/Point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,15 @@ namespace s3d
[[nodiscard]]
constexpr value_type elem(size_t index) const noexcept;

/// @brief x 成分へのポインタを返します。
/// @rematk 戻り値に対して [0] で x 成分、[1] で y 成分にアクセスできます。
/// @return x 成分へのポインタ
[[nodiscard]]
value_type* getPointer() noexcept;

/// @brief x 成分へのポインタを返します。
/// @rematk 戻り値に対して [0] で x 成分、[1] で y 成分にアクセスできます。
/// @return x 成分へのポインタ
[[nodiscard]]
const value_type* getPointer() const noexcept;

Expand Down Expand Up @@ -173,15 +179,24 @@ namespace s3d
|| (lhs.y != rhs.y);
}

/// @brief すべての成分が 0 であるかを返します。
/// @return すべての成分が 0 である場合 true, それ以外の場合は false
[[nodiscard]]
constexpr bool isZero() const noexcept;

/// @brief 最大の成分を返します。
/// @remark Point{ 3, 2 } の場合、3 を返します。
/// @return 最大の成分
[[nodiscard]]
constexpr value_type minComponent() const noexcept;

/// @brief 最小の成分を返します。
/// @remark Point{ 3, 2 } の場合、2 を返します。
/// @return 最小の成分
[[nodiscard]]
constexpr value_type maxComponent() const noexcept;

/// @brief すべての成分を 0 にします。
constexpr void clear() noexcept;

/// @brief x 成分のみを変更した自身のコピーを返します。
Expand All @@ -200,12 +215,23 @@ namespace s3d

constexpr Point& set(Point p) noexcept;

/// @brief 現在の座標から移動した座標を返します。
/// @param _x X 方向の移動量
/// @param _y Y 方向の移動量
/// @return 現在の座標から移動した座標
[[nodiscard]]
constexpr Point movedBy(value_type _x, value_type _y) const noexcept;

/// @brief 現在の座標から移動した座標を返します。
/// @param p 移動量
/// @return 現在の座標から移動した座標
[[nodiscard]]
constexpr Point movedBy(Point p) const noexcept;

/// @brief 現在の座標から移動した座標を返します。
/// @tparam Type 移動量を表す二次元ベクトルの要素の型
/// @param v 移動量
/// @return 現在の座標から移動した座標
template <class Type>
[[nodiscard]]
constexpr Vector2D<Type> movedBy(Vector2D<Type> v) const noexcept;
Expand All @@ -214,6 +240,10 @@ namespace s3d

constexpr Point& moveBy(Point p) noexcept;

/// @brief 水平方向のアスペクト比を返します。
/// @tparam Type 戻り値の型
/// @remark Point{ 3, 2 } の場合、1.5 を返します。
/// @return 水平方向のアスペクト比
template <class Type = double>
[[nodiscard]]
constexpr Type horizontalAspectRatio() const noexcept;
Expand Down Expand Up @@ -339,10 +369,18 @@ namespace s3d
[[nodiscard]]
constexpr Point getPerpendicularCCW() const noexcept;

/// @brief 別の座標との中間にある座標を返します。
/// @tparam Type 戻り値の二次元座標の要素の型
/// @param other 別の座標
/// @return 別の座標との中間にある座標
template <class Type = double>
[[nodiscard]]
constexpr Vector2D<Type> getMidpoint(Point other) const noexcept;

/// @brief 別の座標との中間にある座標を返します。
/// @tparam Type 戻り値の二次元座標の要素の型
/// @param other 別の座標
/// @return 別の座標との中間にある座標
template <class Type>
[[nodiscard]]
constexpr Vector2D<Type> getMidpoint(Vector2D<Type> other) const noexcept;
Expand All @@ -359,6 +397,9 @@ namespace s3d
[[nodiscard]]
constexpr Vector2D<Type> lerp(Vector2D<Type> other, double f) const noexcept;

/// @brief この座標を中心とした円を作成して返します。
/// @param r 円の半径
/// @return この座標を中心とした円
[[nodiscard]]
Circle asCircle(double r) const noexcept;

Expand Down
Loading

0 comments on commit 11d4d8f

Please sign in to comment.