void test_copy_ctor() { concurrent::sync_object<std::string> blub ("Hello World!"); concurrent::sync_object<std::string> blub2 (blub); blub2 <= ( [](std::string& s) -> void { std::cout << s << std::endl; }); }
void test_copy() { concurrent::sync_object<std::string> blub ("Hello World!"); concurrent::sync_object<std::string> blub2 ("Hello Ape!"); blub = blub2; blub <= ( [](std::string& s) -> void { std::cout << s << std::endl; }); }
void test_move() { concurrent::sync_object<std::string> blub ("Hello World!"); concurrent::sync_object<std::string> blub2 ("Hello Ape!"); blub2 = std::move(blub); blub2 <= ( [](std::string& s) -> void { std::cout << s << std::endl; }); }
void test_simple() { concurrent::sync_object<std::string> blub("World Hello"); // Testing with lambda expression. blub <= ( [](std::string& s) -> void { std::cout << s << std::endl; }); // Testing with free function. blub <= &func_functor; // [Note] std::addressof cannot be used here. // testing with functor struct. blub <= foo_functor(); }
int main(void) { xpcc::accessor::Flash<int> bar(&foo); out = *bar; function(xpcc::modifier::asFlash(string)); xpcc::accessor::Flash<int32_t> blub(bla); out = blub[2]; while (1) { } }
std::wstring ParseXORContents(std::wstring &TempLine) { /*Check if the line has an XOR in it, accounts for multiple XORs on the same line*/ std::size_t StartXOR = 0; std::size_t EndQuote = 0; std::size_t StartQuote = 0; std::size_t EndXOR = 0; int StartSearch = 0; bool NeedsEnd = false; int EraseFixup = 0; int InsertFixup = 0; std::wstring TotalLine = TempLine; if (TempLine.length() <= 0) return TempLine; //BS Loop SHOULD exit before this while (EndQuote<TempLine.length()) { //Do We need beginning of XOR or End if (!NeedsEnd) { //Find Start of XOR Macro StartXOR = TempLine.find(L"XOR(", StartSearch); if (StartXOR == std::string::npos) return TotalLine; NeedsEnd = true; //Move to End of XOR( character Sequence StartXOR += 4; //Find Start quote after macro StartQuote = TempLine.find(L"\"", StartXOR); if (StartQuote == std::string::npos) return TempLine; StartQuote += 1; //Move to End of Quote } else { EndQuote = TempLine.find(L"\"", StartQuote); if (EndQuote == std::string::npos) return TempLine; bool FoundUnEscapedEnd = false; int EscapedFixup = 0; while (!FoundUnEscapedEnd) { if (TempLine.at(EndQuote - 1) != '\\' || (TempLine.at(EndQuote - 2) == '\\' && TempLine.at(EndQuote - 1) == '\\')) FoundUnEscapedEnd = true; else { EscapedFixup += 1; EndQuote = TempLine.find(L"\"", StartQuote + EscapedFixup); if (EndQuote == std::string::npos) return TempLine; } } NeedsEnd = false; //For Next Iteration ignore previous StartSearch = EndQuote; std::wstring XORContents = TempLine.substr(StartQuote, EndQuote - StartQuote); BOOL Success; std::wstring EncryptedSubString = StringToWString(blub(WStringToString(XORContents), Success)); if (!Success) return TempLine; EndXOR = TempLine.find(L")", EndQuote); if (EndXOR == std::string::npos) return TempLine; //Move to end of ) and go back to beginning of XOR Macro EndXOR += 1; StartXOR -= 4; //Erase Raw text and replace with encrypted TotalLine.erase(StartXOR - EraseFixup + InsertFixup, EndXOR - StartXOR); TotalLine.insert(StartXOR - EraseFixup + InsertFixup, EncryptedSubString); //Next Time around we need to account for the changed length of the string InsertFixup += EncryptedSubString.length(); EraseFixup += (EndXOR - StartXOR); } } return TempLine; }