![]() |
OpenSiv3D
v0.6.5
C++20 framework for creative coding
|
数式パーサ More...
#include <MathParser.hpp>
Public Types | |
using | Fty0 = double(*)() |
using | Fty1 = double(*)(double) |
using | Fty2 = double(*)(double, double) |
using | Fty3 = double(*)(double, double, double) |
using | Fty4 = double(*)(double, double, double, double) |
using | Fty5 = double(*)(double, double, double, double, double) |
using | Fty6 = double(*)(double, double, double, double, double, double) |
using | Fty7 = double(*)(double, double, double, double, double, double, double) |
using | Fty8 = double(*)(double, double, double, double, double, double, double, double) |
using | Fty9 = double(*)(double, double, double, double, double, double, double, double, double) |
using | Fty10 = double(*)(double, double, double, double, double, double, double, double, double, double) |
Public Member Functions | |
SIV3D_NODISCARD_CXX20 | MathParser () |
デフォルトコンストラクタ More... | |
SIV3D_NODISCARD_CXX20 | MathParser (StringView expression) |
数式を設定します。 More... | |
String | getErrorMessage () const |
最後に発生したエラーメッセージを返します。 More... | |
void | setExpression (StringView expression) |
数式を設定します。 More... | |
bool | setConstant (StringView name, double value) |
定数を登録します。 More... | |
bool | setVaribale (StringView name, double *value) |
変数を登録します。 More... | |
bool | setFunction (StringView name, Fty0 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty1 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty2 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty3 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty4 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty5 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty6 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty7 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty8 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty9 f) |
関数を登録します。 More... | |
bool | setFunction (StringView name, Fty10 f) |
関数を登録します。 More... | |
bool | setPrefixOperator (StringView name, Fty1 f) |
プレフィックス演算子を登録します。 More... | |
bool | setPostfixOperator (StringView name, Fty1 f) |
ポストフィックス演算子を登録します。 More... | |
void | removeVariable (StringView name) |
登録した定数または変数を削除します。 More... | |
void | clear () |
数式と登録したすべての内容を削除します。 More... | |
String | getExpression () const |
設定されている数式を返します。 More... | |
HashTable< String, double * > | getUsedVariables () const |
数式で使用されている変数一覧を返します。 More... | |
HashTable< String, double * > | getVariables () const |
登録されている変数一覧を返します。 More... | |
HashTable< String, double > | getConstants () const |
登録されている定数一覧を返します。 More... | |
String | validNameCharacters () const |
定数名、変数名、関数名に使える文字一覧を返します。 More... | |
String | validPrefixCharacters () const |
プレフィックス演算子に使える文字一覧を返します。 More... | |
String | validPostfixCharacters () const |
ポストフィックス演算子に使える文字一覧を返します。 More... | |
Optional< double > | evalOpt () const |
数式を評価した結果を返します。 More... | |
double | evalOr (double defaultValue=Math::NaN) const |
数式を評価した結果を返します。 More... | |
double | eval () const |
数式を評価した結果を返します。 More... | |
Array< double > | evalArray () const |
数式を評価した結果を返します。 More... | |
Vec2 | evalVec2 () const |
数式を評価した結果を返します。 More... | |
Vec3 | evalVec3 () const |
数式を評価した結果を返します。 More... | |
Vec4 | evalVec4 () const |
数式を評価した結果を返します。 More... | |
ColorF | evalColorF () const |
数式を評価した結果を返します。 More... | |
HSV | evalHSV () const |
数式を評価した結果を返します。 More... | |
数式パーサ
using s3d::MathParser::Fty0 = double(*)() |
using s3d::MathParser::Fty1 = double(*)(double) |
using s3d::MathParser::Fty10 = double(*)(double, double, double, double, double, double, double, double, double, double) |
using s3d::MathParser::Fty2 = double(*)(double, double) |
using s3d::MathParser::Fty3 = double(*)(double, double, double) |
using s3d::MathParser::Fty4 = double(*)(double, double, double, double) |
using s3d::MathParser::Fty5 = double(*)(double, double, double, double, double) |
using s3d::MathParser::Fty6 = double(*)(double, double, double, double, double, double) |
using s3d::MathParser::Fty7 = double(*)(double, double, double, double, double, double, double) |
using s3d::MathParser::Fty8 = double(*)(double, double, double, double, double, double, double, double) |
using s3d::MathParser::Fty9 = double(*)(double, double, double, double, double, double, double, double, double) |
SIV3D_NODISCARD_CXX20 s3d::MathParser::MathParser | ( | ) |
デフォルトコンストラクタ
|
explicit |
数式を設定します。
expression | 数式 |
void s3d::MathParser::clear | ( | ) |
数式と登録したすべての内容を削除します。
double s3d::MathParser::eval | ( | ) | const |
数式を評価した結果を返します。
Array<double> s3d::MathParser::evalArray | ( | ) | const |
数式を評価した結果を返します。
ColorF s3d::MathParser::evalColorF | ( | ) | const |
数式を評価した結果を返します。
HSV s3d::MathParser::evalHSV | ( | ) | const |
数式を評価した結果を返します。
Optional<double> s3d::MathParser::evalOpt | ( | ) | const |
数式を評価した結果を返します。
double s3d::MathParser::evalOr | ( | double | defaultValue = Math::NaN | ) | const |
数式を評価した結果を返します。
defaultValue | エラーが発生した場合の代わりの結果 |
Vec2 s3d::MathParser::evalVec2 | ( | ) | const |
数式を評価した結果を返します。
Vec3 s3d::MathParser::evalVec3 | ( | ) | const |
数式を評価した結果を返します。
Vec4 s3d::MathParser::evalVec4 | ( | ) | const |
数式を評価した結果を返します。
登録されている定数一覧を返します。
String s3d::MathParser::getErrorMessage | ( | ) | const |
最後に発生したエラーメッセージを返します。
String s3d::MathParser::getExpression | ( | ) | const |
設定されている数式を返します。
数式で使用されている変数一覧を返します。
登録されている変数一覧を返します。
void s3d::MathParser::removeVariable | ( | StringView | name | ) |
登録した定数または変数を削除します。
name | 定数または変数の名前 |
bool s3d::MathParser::setConstant | ( | StringView | name, |
double | value | ||
) |
定数を登録します。
name | 定数名 |
value | 定数の値 |
void s3d::MathParser::setExpression | ( | StringView | expression | ) |
数式を設定します。
expression | 数式 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty0 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数の無い関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty1 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 1 つの関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty10 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 10 個の関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty2 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 2 つの関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty3 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 3 つの関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty4 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 4 つの関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty5 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 5 つの関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty6 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 6 つの関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty7 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 7 つの関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty8 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 8 つの関数 |
bool s3d::MathParser::setFunction | ( | StringView | name, |
Fty9 | f | ||
) |
関数を登録します。
name | 関数名 |
f | 引数が 9 つの関数 |
bool s3d::MathParser::setPostfixOperator | ( | StringView | name, |
Fty1 | f | ||
) |
ポストフィックス演算子を登録します。
name | 演算子の名前 |
f | 引数が 1 つの関数 |
validPostfixCharacters()
で示されている文字が使えます。 bool s3d::MathParser::setPrefixOperator | ( | StringView | name, |
Fty1 | f | ||
) |
プレフィックス演算子を登録します。
name | 演算子の名前 |
f | 引数が 1 つの関数 |
validPrefixCharacters()
で示されている文字が使えます。 bool s3d::MathParser::setVaribale | ( | StringView | name, |
double * | value | ||
) |
変数を登録します。
name | 変数名 |
value | 変数へのポインタ |
String s3d::MathParser::validNameCharacters | ( | ) | const |
定数名、変数名、関数名に使える文字一覧を返します。
String s3d::MathParser::validPostfixCharacters | ( | ) | const |
ポストフィックス演算子に使える文字一覧を返します。
String s3d::MathParser::validPrefixCharacters | ( | ) | const |
プレフィックス演算子に使える文字一覧を返します。