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 " }));소 (Copy-on-Write는 종종 가장 일반적인 경우의 성능을 크게 향상시킵니다)
API는 스택 = 푸시/팝, 시퀀스 = 배열 액세스, 맵 = {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); }}},자세한 내용은 웹 서비스 샘플을 참조하십시오.
압축, 암호화, 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-tepactroach-to-performance.md 참조). 유형 계층의 추상화는 사람들의 이유와 템플릿과 개념 (강력하지만 강력한)의 의도에 더 적합합니다. 또한 Stroika는 인터페이스를 구현에서 분리하는 것을 강조합니다. 헤더의 인터페이스를 신중하게 문서화하고 구현을 다른 파일로 분리합니다.
Stroika는 대부분의 응용 프로그램에 적용 가능한 빌딩 블록 클래스를 제공하는 2 개의 레이어와 다른 도메인에서 풍부한 코드 모음을 제공하는 일련의 도메인 별 프레임 워크를 제공합니다.

프레임 워크는 기초에 달려 있습니다. 기초 모듈은 종종 서로 의존합니다. 그러나 기초 계층 코드에는 기초 외부의 종속성이 포함되어 있지 않습니다 (표준 C ++ 라이브러리 제외 및 OpenSSL과 같이 다양한 ThirdPartyComponent 라이브러리가 포함되거나 참조).
읽고 싶지 않아 - 그냥 코딩하고 싶어요. 컴퓨터에 첫 번째 Stroika 기반 애플리케이션을 구축하는 단계별 지침 (몇 분 안에 1 분 안에) (다운로드/컴파일 시간 - 다양 함).
Stroika의 가장 큰 강점은 또한 가장 큰 약점입니다.
활성 개발에서 Stroika v3 ( 안정적이지 않음 ), C ++ 20 이상이 필요합니다.
Stroika v2.1은 안정적 이며 (유지성) C ++ 17 이상이 필요합니다. 버전 2.1은 또한 조건부로 많은 C ++ 20 기능 (예 : 사용 가능한 경우 3 방향 비교 등)을 지원합니다.
Stroika v2.0은 매우 안정적이며 C ++ 14 이상이 필요합니다. Stroika v2.0은 다양한 오픈 소스 및 상업용 응용 프로그램에 전원을 공급하는 데 사용됩니다.
Linux, Macos, Windows
Stroika V3
TBD이지만 지금까지는 Windows에서 VS2K22 (17.9) 또는 이후에 MacOS에서 Xcode 15 (.2), 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 wru GCC 8, Clang 3 Thru Clang 6, Xcode 8 Thru에서 테스트.
Github 동작
| 가지 | 상태 | |
|---|---|---|
| v3 릴리스 | ![]() | .github/Workflows/build-n-test.yml |
| v3-dev | ![]() | .github/Workflows/build-n-test.yml |
개별 릴리스 변경에 대한 자세한 내용은 다음을 참조하십시오.
Release-notes.md
"시작", 지침, 디자인 및 기타 문서 구축 :
선적 서류 비치/
샘플을 살펴 보는 것도 시작하는 좋은 방법입니다.
샘플/
버그/문제를 다음과 같이보고하십시오.
http://stroika-bugs.sophists.com