TGPuttyLib icon indicating copy to clipboard operation
TGPuttyLib copied to clipboard

Example using Unicode strings and real C++ code?

Open patlecat opened this issue 3 years ago • 3 comments

It would be helpful to have an example of a generic C++ use of strings with STL that can run under Windows and Linux. The examples now are very specific to compiler vendors only, I don't see this as an advantage, especially for a C++ user. Also I find the mislabelling of C code as "C++" not appropriate.

patlecat avatar Oct 13 '21 17:10 patlecat

Hello, OK ... what does generic mean, or which compiler should I do it with?

Maybe one or two files would work as pure C code but currently use the cpp extension. I don't intend to change that. The project description says that there are C++ bindings and that is true.

superflexible avatar Oct 13 '21 20:10 superflexible

Generic means standard CPP as per the ISO definition so C++17 for example that will run on most modern day compilers.

I could not see any C++ code apart from std::cout in the examples, where are those C++ example files and where is that C++ extension that you talk about I could not find it?

patlecat avatar Oct 15 '21 08:10 patlecat

Hello, this is the C++ class that has the best chance to be converted to completely generic C++: https://github.com/superflexible/TGPuttyLib/blob/master/tgputtylibvcclass.h https://github.com/superflexible/TGPuttyLib/blob/master/tgputtylibvcclass.cpp

It's not Unicode however. You need to call your favorite UTF8 encode/decode functions for every string you pass or get to this class.

Feel free to fork and contribute via pull requests, if you like. Maybe one day I can make a generic Unicode class that's not compiler specific.

superflexible avatar Oct 15 '21 13:10 superflexible