Stroikaは、モダンでポータブルなC ++アプリケーションフレームワークです。安全で柔軟なビルディングブロックを提供することにより、C ++アプリケーションの書き込みを容易にし、他の有用なライブラリでラッパーを提供するラッパーは、すべての人がより見かけに連携するのに役立ちます。
String a = u8" abc " ;
String b = u32 " abc " ;
CallFunction (a+b);
// trim whitespace, and convert to u16string for some legacy API
std::u16string uuu = (a+b).Trim ().As<u16string>();
// tokenize
String t{ " ABC DEF G " };
Assert (t.Tokenize ()[1] == "DEF"); // most Stroika types automatically support formattable<>
DbgTrace ( " v = {} " _f, v); // to a tracelog file, or debugger
cerr << " v = {} " _f (v) << endl; // OR iostreams (unicode mapped automatically) // nb: String is an Iterable<Character>,
// despite internally representing the characters very differently
bool IsAllWhitespace (String s) const
{
return not s. Find ([] (Character c) -> bool { return not c. IsWhitespace (); });
}
Iterable< int > c { 1 , 2 , 2 , 5 , 9 , 4 , 5 , 6 };
EXPECT_TRUE (c.Distinct ().SetEquals ({ 1 , 2 , 4 , 5 , 6 , 9 }));
Iterable< int > c { 3 , 4 , 7 };
// Map iterates over 'c' and produces the template argument container
// automatically by appending the result of each lambda application
EXPECT_EQ ((c.Map<vector<String>> ([] ( int i) { return " {} " _f (i); }), vector<String>{ " 3 " , " 4 " , " 7 " }));牛(コピーオンワイトは、多くの場合、ほとんどの一般的なケースでパフォーマンスを大幅に改善することがよくあります)
stack = push/pop、sequence = array-likeアクセス、map = {from:to}などのアクセスパターンで定義されています
表現透明性
Stroikaは、豊富なコンテナのアーチ型とデータ構造のインプレンスを提供します。
extern void f (Set< int >);
// use the default Set<> representation - the best for type 'int'
Set< int > s{ 1 , 2 , 3 };
f (s); // data not actually copied - Stroika containers use 'copy-on-write (COW)'
s = Concrete::SortedSet_SkipList< int >{s}; // Use a skiplist to represent the set
f (s); // call f the same way regardless of data structure used for implementation
// set equality not order dependent (regardless of data structure)
Assert (s == { 2 , 3 , 1 }); 詳細については、コンテナサンプルを参照してください
MyClass someObject = ...;
VariantValue v = mapper.FromObject (someObject); // Map object to a VariantValue
// Serialize using any serialization writer defined in
// Stroika::Foundation::DataExchange::Variant (we selected JSON)
Streams::MemoryStream:: Ptr <byte> tmpStream = Streams::MemoryStream::New<byte> ();
Variant::JSON::Writer{}.Write (v, tmpStream);
// You can persist these to file if you wish
{
using namespace IO ::FileSystem ;
FileOutputStream:: Ptr tmpFileStream =
FileOutputStream::New ( WellKnownLocations::GetTemporary () / " t.txt " );
Variant::JSON::Writer{}. Write (v, tmpFileStream);
}詳細については、シリアル化サンプルを参照してください
Route{ " variables/(.+) " _RegEx,
// explicit message handler
[ this ] (Message& m, const String& varName) {
WriteResponse (m. rwResponse (), kVariables_ , kMapper . FromObject ( fWSImpl_ -> Variables_GET (varName)));
}},
Route{HTTP::MethodsRegEx:: kPost , " plus " _RegEx,
// automatically map high level functions via ObjectVariantMapper
ObjectRequestHandler::Factory{ kBinaryOpObjRequestOptions_ ,
[ this ] (Number arg1, Number arg2) { return fWSImpl_ -> plus (arg1, arg2); }}},詳細については、Webサービスサンプルを参照してください。
圧縮、暗号化、IO、ネットワーキング、データ処理を行います。
// @todo INCOMPLETE - BAD EXAMPLE---
const OpenSSL::DerivedKey kDerivedKey =
OpenSSL::EVP_BytesToKey{ OpenSSL::CipherAlgorithms::kAES_256_CBC (), OpenSSL::DigestAlgorithms:: kMD5 , " password " };
const Memory::BLOB srcText =
Memory::BLOB::FromHex ( " 2d ... " ); // ...
// EncodeAES takes a stream, and produces a stream
// which can be chained with the gzip Transformer, which takes a stream, and produces a
Compression::GZip::Compress::New ().Transform (EncodeAES ( kDerivedKey , srcText.As<Streams::InputStream:: Ptr <byte>> (), AESOptions::e256_CBC))スタイル的には、Stroikaは標準のC ++ライブラリ、ブースト、およびその他の多くのC ++ライブラリとは異なります。タイプの階層の抽象化は、人々がどのように推論するかにより適しています。また、テンプレートと概念は、強力でありながら、プログラマーの意図を不明瞭であいまいにすることができます。また、Stroikaは、インターフェイスの実装からの分離を強調しています。ヘッダー内のインターフェイスを慎重に文書化し、実装を他のファイルに分離します。
Stroikaは、ほとんどのアプリケーションに適用可能な建物ブロッククラスを提供する2つのレイヤーで構成されています。

フレームワークは基礎に依存します。基礎モジュールは頻繁に互いに依存します。ただし、基礎レイヤーコードには、ファンデーションの外側の依存関係は含まれていません(標準のC ++ライブラリと、OpenSSLのようにオプションまたは参照されるさまざまなサードパルティキャンコンポーネントライブラリを除く)。
読みたくない - コードしたいだけです。数分でマシンに最初のStroikaベースのアプリケーションを構築するためのステップバイステップの手順(ダウンロード/コンパイル時間が少ない - 変化)。
ストロイカの最大の強みは、その最大の弱点でもあります。
Stroika V3はアクティブ開発(安定していない)で、20以降のC ++が必要です。
Stroika V2.1は安定しており(維持状態)、C ++ 17以降が必要です。バージョン2.1は、多くのC ++ 20の機能(利用可能な場合は3方向競合などなど)も条件付きでサポートしています。
Stroika V2.0は非常に安定しており、C ++ 14以降が必要です。 Stroika V2.0は、さまざまなオープンソースおよび商用アプリケーションを強化するために使用されます。
Linux、MacOS、Windows
Stroika V3
TBDですが、これまでのところVS2K22(17.9)以降のWindows、Xcode 15(.2)以降はMacOS、G ++ 11以降、およびClang ++ 15以降のように見えます。
Stroika V2.1
X86、ARM(+M1)、GCC 8 Thru GCC 12、Clang 6 Thru Clang 14、Visual Studio.Net 2017、Visual Studio.Net 2019およびVisual Studio.Net 2022、Xcode 13、14、15でテストしました。
Stroika V2.0
x86、arm、gcc 5 thru gcc 8、clang 3 thru clang 6、xcode 8 thru 9でテストしました。
githubアクション
| 枝 | 状態 | |
|---|---|---|
| V3リリース | ![]() | .github/workflows/build-n-test.yml |
| v3-dev | ![]() | .github/workflows/build-n-test.yml |
個々のリリースの変更の詳細については、次を参照してください。
Release-notes.md
「始めましょう」、指示、デザイン、その他のドキュメントを作成します。
ドキュメント/
サンプルを通して見ることは、開始する良い方法でもあります。
サンプル/
でバグ/問題を報告してください:
http://stroika-bugs.sophists.com