I wanted to put this out there and get your opinions.
I've been working on kind of large C++ library which tries borrow as many idioms from Delphi and C# as possible, which can integrate well with C#/Mono/Delphi (and Free Pascal), and works on all platforms. It's ready for me to release but I want to write a few more demos. It'll be on git hub or some other public open source repository soon.
Here is a test application I ran this morning which exports functions and interface objects to a C++ application:
http://codebot.org/c-code.txt
3 files. Delphi source unit, C++ header importing Delphi function, C++ main to test it:
Another example. A very small and fairly robust multi-threaded web server:
http://codebot.org/webserver.txt
1 file. C++ main test on Windows, Linux and MacOS X
I am using some C++11 features and will probably use more as MSVC and GCC support for C++11 improves. The purpose of this library is to make C++ more like Delphi and C# and to also integrate well with Delphi. And also of course, to work in places Delphi has a hard time with.
What the library includes so far is:
Tested cross platform support for Windows, Linux, MacOS X, Android
Works with MSVC and GCC (Tested with no warnings/errors in Visual Studio 2010 and Eclipse with CDT)
Unified object hierarchy with a base value type class
Unified exception handling with base exception class
Exception handling tracks the method/function causing the error
String type with copy on write memory management
Fairly complete set of string methods including:
Split/Join, SubString, IndexOf, FirstOf, LastOf, Trim, UperCase, LowerCase ect ...
regular expressions
Custom event handler types
Example: listOfStrings->OnChange += event(StringsChangeMethod);
Automatic reference counting and disposal for items derive from object class
Unified file systems, directory, and path operations
Date and time classes
Example: DateTime d = DateTime::Now().AddDays(-1); WriteLine(d.ToFormat("DDDD, MMMM D YYYY h:mm am/pm"));
Output: Tuesday April 3 2012, 10:43 am
Stream class with MemoryStream, FileStream, ResourceStream, StringStream
Interop support for interfaces types (COM type interfaces) on all platforms
Example: Interface<INode> node; node = document->Root();
RTTI operations Is<T> and As<T>.
Example if (Is<Document>(node)) As<Document>(node)->Save("resut.xml");
Cross platform XML library with full xpath and xslt support
Every class can work with custom formatting (WriteLine, Format, ToFormat)
Example: WriteLine("The value is {0:trim} and PI is {1:#.##}", " Hello ", Math::PI)
Output: The value is Hello and PI is 3.14
A few generic "ready to go" container types
Threading support on all platforms
Unit testing framework
Feedback appreciated.
It will be of git hub or some other online repository soon.
-
-
COW strings? Really? Especially using C++11?
Other than that, based on what little I can review it sounds interesting.
-
2 hours ago, wkempf wrote
COW strings? Really? Especially using C++11?
Other than that, based on what little I can review it sounds interesting.
can you expand on this one for the ignorant among us?
What dont you like about/what is wrong with COW strings? especially when using C++11
-
Most implementors of the standard libraries abandoned COW strings many years ago. Turns out they are usually a pessimization not an optimization. In C++11 even in the cases where you could benefit from COW, you'll get the same benefit with less complication by using a move constructor. I've not followed the standard that well over the years, since I've moved on to other languages, but I know that there was discussion of mandating basic_string not use COW, and there was a reason for it. You can find lots of information on this topic by Googling for it.
To be honest, the approach used by other languages is probably much better. Make you're strings immutable. Include a string builder to do the occasional complex string manipulation logic.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.