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 " }));COW (Copy-on-Write มักจะปรับปรุงประสิทธิภาพอย่างมีนัยสำคัญสำหรับกรณีที่พบบ่อยที่สุด)
APIs ที่กำหนดโดยรูปแบบการเข้าถึงเช่น stack = push/pop, sequence = access array-like, map = {จาก: to}, ฯลฯ
ความโปร่งใสในการเป็นตัวแทน
Stroika จัดเตรียมชุด archtypes คอนเทนเนอร์ที่หลากหลายและการรวมโครงสร้างข้อมูล
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); }}},ดูตัวอย่าง WebServices สำหรับรายละเอียดเพิ่มเติม
ทำให้การบีบอัด, การเข้ารหัส, 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 ++ อื่น ๆ อีกมากมายในการที่มัน (ค่อนข้าง) รวบรวม abstractions เชิงวัตถุที่มุ่งเน้นไปที่ template ทั่วไป (ดู stroika-approach-to-performance.md) สิ่งที่เป็นนามธรรมของลำดับชั้นประเภทนั้นเหมาะสมกว่าวิธีการที่ผู้คนมีเหตุผลและเทมเพลตและแนวคิด - ในขณะที่ทรงพลัง - สามารถเป็นคนที่มีความตั้งใจและปิดบังความตั้งใจของโปรแกรมเมอร์ นอกจากนี้ Stroika ยังเน้นการแยกอินเทอร์เฟซจากการใช้งาน: จัดทำเอกสารอินเทอร์เฟซในส่วนหัวอย่างระมัดระวังและแยกการใช้งานไปยังไฟล์อื่น ๆ
Stroika ประกอบด้วย 2 เลเยอร์: มูลนิธิซึ่งจัดให้มีคลาสอาคารอาคารที่ใช้กับแอปพลิเคชันส่วนใหญ่และชุดของเฟรมเวิร์กเฉพาะโดเมนที่ให้การรวบรวมรหัสที่หลากหลายในโดเมนที่แตกต่างกัน

เฟรมเวิร์กขึ้นอยู่กับรากฐาน; โมดูลพื้นฐานมักขึ้นอยู่กับกันและกัน แต่รหัสเลเยอร์พื้นฐานไม่มีการพึ่งพานอกฐานราก (ยกเว้นในไลบรารี C ++ มาตรฐานและไลบรารีที่สามของ PartyChponent รวมหรืออ้างอิงเช่น OpenSSL)
ไม่ต้องการอ่าน - แค่ต้องการรหัส คำแนะนำทีละขั้นตอนเพื่อสร้างแอปพลิเคชันที่ใช้ Stroika ครั้งแรกของคุณบนเครื่องของคุณในไม่กี่นาที (เวลาดาวน์โหลด/คอมไพล์น้อยลง - แตกต่างกันไป)
จุดแข็งที่ยิ่งใหญ่ที่สุดของ Stroika ก็คือจุดอ่อนที่ยิ่งใหญ่ที่สุด:
Stroika V3 ในการพัฒนาที่ใช้งานอยู่ ( ไม่เสถียร ) และต้องใช้ C ++ 20 หรือใหม่กว่า
Stroika v2.1 มี ความเสถียร (ในการบำรุงรักษา) และต้องใช้ C ++ 17 หรือใหม่กว่า เวอร์ชัน 2.1 ยังรองรับคุณสมบัติ C ++ 20 อย่างมีเงื่อนไข (เช่นการเปรียบเทียบสามทาง ฯลฯ หากมี)
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 ถึง 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 ถึง GCC 8, Clang 3 ผ่าน 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