“Do the benefits of U ++ outweigh its unusual and high“ entry barrier ”? In my opinion, yes. U ++ is a great choice for cross-platform projects that are being developed from scratch, especially if you expect heavy use of databases. ”
//: // , 4 void Func() {}; void Func4(int, double, String, Value) {} // GUI_APP_MAIN { Callback cb = callback(Func); cb(); //stateful Callback cb4 = callback4(Func4, 1, 2, AsString(3), 4); cb4(); //stateless Callback4<int double string value> cb1 = callback(Func4); cb1(1, 2, AsString(3), 4); } // class AppMain { public: // THISBACK typedef AppMain CLASSNAME; Callback cb; Callback cb4; AppMain() { cb = THISBACK(Func); cb4 = THISBACK4(Func4, 1, 2, AsString(3), 4); } void Func() {}; void Func4(int, double, String, Value) {} }; // GUI_APP_MAIN { AppMain m; m.cb = callback(&m, &AppMain::Func); m.cb4 = callback4(&m, &AppMain::Func4, 1, 2, AsString(3), 4); } </int>
// SomeClass - Single<someclass>().SomeMethod();
// StdLogSetup(LOG_COUT|LOG_FILE); ... LOG(Format("Total %d files have sended\n", n)); LOG("Total " << n << " files have sended");
VectorMap<string string> config = LoadIniFile(GetExeDirFile("config.ini")); String host = config.Get("HOST"); int port = ScanInt(config.Get("PORT")); for (int i = 0; i < config.GetCount(); i++) { if ("FILE" == config.GetKey(i)) { Cout() << config[i] << "\n"; } }
// Thread::Start(callback(Func)); //c Thread th; th.Run(callback(Func)); th.Wait(); Thread::ShutdownThreads();
FileIn fp(fname); Json json; json("fname", fname)("fsize", (int)fp.GetSize())("fdata", Base64Encode(LoadFile(fname))); ValueArray jsonAr = ParseJSON(json.ToString()); fname = jsonAr[0]; int fsize = jsonAr[1]; String fdata = Base64Decode(jsonAr[2]);
TcpSocket server; if (!server.Listen(port)) { LOG(Format("Can't open server port %d for listening\n", port)); return; } for(;;) { LOG("Waiting..."); TcpSocket socket; if (socket.Accept(server)) { String msg = ""; for (int c = socket.Get(); c > 0 && c != '\n'; c = socket.Get()) { msg.Cat(c); } } }
RegExp reg("(\\\\)"); String path = "D:\\test.txt"; if (reg.Match(path)) { int last; int first; reg.GetMatchPos(0, first, last); String drive = path.Mid(0, last); String fname = path.Mid(last); }
GUI_APP_MAIN { double *d = new double(0); }
Color rgb_color = Color(109, 171, 211); String qtf_color = Format("@(%d.%d.%d)", rgb_color.GetR(), rgb_color.GetG(), rgb_color.GetB()); String qtf; qtf.Cat(Format("[R9/%s Habrahabr &]", qtf_color)); qtf.Cat(Format("[_%s ] [ ] [_%sq\\&a] [_%s ] [_%s ] [_%s ]", qtf_color, qtf_color, qtf_color, qtf_color, qtf_color)); Report rep; rep << qtf; ReportWindow().Perform(rep);
#include <OfficeAutomation/OfficeAutomation.h> GUI_APP_MAIN { //Excel OfficeSheet sheet; bool xlsOn = sheet.IsAvailable("Microsoft"); if (xlsOn) sheet.Init("Microsoft"); //Open Office Calc if (!xlsOn) { xlsOn = sheet.IsAvailable("Open"); if (xlsOn) sheet.Init("Open"); } if (xlsOn) { FileSel fs; fs.Type(" ", "*.xls *.xlsx"); fs.AllFilesType(); if (fs.ExecuteOpen(" Excel ")) { sheet.OpenSheet(~fs, true); sheet.AddSheet(true); } } //Word OfficeDoc doc; // Word2003 Word2007, - Word2003. . bool docOn = doc.IsAvailable("Microsoft"); if (docOn) doc.Init("Microsoft"); //Open Office Writer if (!docOn) { docOn = doc.IsAvailable("Open"); if (docOn) doc.Init("Open"); } if (docOn) { FileSel fs; fs.Type(" Word", "*.doc *.docx *.rtf"); fs.AllFilesType(); if (fs.ExecuteOpen(" Word ")) { doc.OpenDoc(~fs, true); doc.AddDoc(true); } } }
SetLanguage(SetLNGCharset(GetSystemLNG(), CHARSET_UTF8));
obj.f()
code obj.f()
not be transformed into obj.f() ()
Source: https://habr.com/ru/post/194590/
All Articles