Containers and basic class

Discussion of ideas for features and new projects based on POCO.
pswin
Posts: 6
Joined: 23 Nov 2015, 09:05

Containers and basic class

Postby pswin » 27 Nov 2015, 15:15

Poco is a great library and you can do every thing which you need in network based applications; However, it is suffering from lack of containers and some basic class such as string. In my point of view, adding thread safe containers such as map, vector and ... is essential. because, you need to use additional libraries such as Boost or libraries such as STL which aren't thread safe.

Handling different code-pages or Unicode formats in an HTTPServer is not an easy job, and programmers have to struggle to handle inputs. creating a abstract string class which have ability to deal with different code pages and Unicode string automatically without interfere of programmer could be useful.

I suppose, adding a few range of classes would make it (Poco) a great framework for developing software. It might be able to compete with other powerful libraries such as Qt.

alex
Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Containers and basic class

Postby alex » 27 Nov 2015, 21:48

We do not unnecessarily re-invent the wheel. There is std::string; use it. If you find it lacking, extend it. UTF-8 and std::string are important pillars of POCO and that won't change any time soon. As for STL containers, in addition to proverbial wheel reinventing, making everything thread-safe slows things down significantly, so we have no intention of developing a thread-safe STL equivalent. But we do provide portable abstractions needed to write thread-safe code.

pswin
Posts: 6
Joined: 23 Nov 2015, 09:05

Re: Containers and basic class

Postby pswin » 27 Nov 2015, 23:41

I think, using an uniform classes structure with classes that belong to the just one library and not lots of library such as STL or Boost could be much more better. In addition, there are a lots of libraries which did it. For instance, libraries such as Qt and Boost. This isn't a re-inventing the wheel, but this is making a uniform structure for your great library. You have lots of classes and functions for controlling strings, why you don't want to put them together in a class?. At now, developers have to include many header files and ... just for doing basic string operations.

for example codes like that:

Code: Select all

std::string str1 = "x";
std::string str2 = "x";
...
if ( poco::icompare( str1, str2 ) == 0 )
{
str1 = poco::format("%4d", 42);
}
....


could be handled in much more clear way like that:

Code: Select all

poco::string str1 = "x";
poco::string str2 = "x";
...
if ( str1 == str2 )
{
str1.format("%4d", 42);
}
....


And this is just a simple code. In the complex codes, you have to include many header files, calling many functions and classes, just for doing simple operations.

and again the same things happened in the Files classes in POCO. Poco has lots of class for doing file operations but it doesn't have a base File class for doing basic operations such as read and write. you must use STL classes for it.

alex
Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Containers and basic class

Postby alex » 28 Nov 2015, 02:40

you are missing some important points in these examples:

- poco::icompare is case-insensitive comparison, which str1 == str2 with str1 and str2 being std::string does not provide, unless you use poco::istring

- for file I/O, there's FileStream, which we only have because on windows std::fstream does not deal well with unicode file names

as mentioned, we do not re-invent the wheel; besides, many people use boost alongside poco - if your use-case warrants it, we have no problem with it, we do not strive to replace standard library or boost


Return to “Wishlist”

Who is online

Users browsing this forum: No registered users and 2 guests

cron