I want to suggest functions and classes for implementation in CopperSpice

Discuss anything related to product development
Post Reply
Navadvipa Chandra d
Posts: 27
Joined: Sun Apr 19 2020 7:02 pm

I want to suggest functions and classes for implementation in CopperSpice

Post by Navadvipa Chandra d »

Hello? All!

I present to your attention some interesting classes and functions that I did not find in CopperSpice, but which can be added to it very easily.

1. The QStorage and QStorageDB class
It can serialize C++ classes, which do not need to be modified at all.
To do this, you need to create a Storager helper class. Chris Kawa gave me the idea of an assistant class
on the Qt forum. You can choose the location where the class will be stored - in a file, in memory, or in a database.

For example, we want to restore the APrabhupadaLoginDialog dialog box from a file:

Code: Select all

LoadObject< QStoragerPrabhupadaLoginDialog >( APrabhupadaLoginDialog, &AStorage, QStorageKind::File );
And now we save the dialog box to a file.

Code: Select all

SaveObject< QStoragerPrabhupadaLoginDialog >( APrabhupadaLoginDialog, &AStorage, QStorageKind::File );
The QStoragerPrabhupadaLoginDialog class is an assistant class in this case.

2. We can suggest an interesting simple QEmitValue template for consideration.
Using it, for example, as

using QEmitInt = QEmitValue< int >;
using QEmitBool = QEmitValue< bool >;

and also using inheritance
class Languageindex : public QEmitInt

I have solved almost all the problems in my program "Srila Prabhupada's Dictionary!"

3. StringNumberToWords function - converts a numeric string into a verbal form
, for example "123" -> one hundred and twenty-three. I took the algorithm of this function a long time ago somewhere on the Internet. She was on Pascal. Redone it in C++

4. The Like function, it works as a very simplified regular expression, its operation is similar to the LIKE operator in a SELECT SQL query.
In other words, it compares a string with a string mask that contains two special characters.:

% - means any string, including an empty
one _ - means any letter, but not an empty space.

The Like function is still faster than the regular expressions of QRegularExpression, for example,

Like for the word "mach" successfully found 1298 words in 48 milliseconds
The QRegularExpression for the word "mach" successfully found 1298 words in 94 milliseconds

An example is here.

https://github.com/Navadvipa-Chandra-das/PrabhupadaDictionaryCopperSpice

This project took ideas and inspiration from the Kitchen Sink program.
If you have any problems with the launch, write to me, maybe I can help. The project has not been completed yet.

Thanks!
Sincerely, Navadvipa Chandra das.
barbara
Posts: 479
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by barbara »

Thanks for sending us this information. We are always looking for contributors to CopperSpice. If you are looking for other ways to contribute please let us know and we can offer some other suggestions. There are lots of planned areas of improvement.


>> 1. QStorage and QStorageDB class

Without talking about implementation, can you tell us the purpose of these classes. What does it mean to "serialize class"? Are you referring to saving some data?

>> 2. We can suggest an interesting simple QEmitValue template for consideration.

You mentioned "we" so I am curious if there is another person involved. Is this item part of item 1 or a stand alone feature.

>> 3. StringNumberToWords function

This seems like a function specific to your project. Not sure if this really belongs in CS.

>> 4. The Like function, it works as a very simplified regular expression,

Have you used our QRegularExpression class? How would your function be different?

This may sound a bit silly but we need to ensure that all of your work is written by you and not lifted from another project.
We tried the link and it went to a 404. If the repo is not public (which is fine) then please send us an invitation on github.

Barbara
Navadvipa Chandra d
Posts: 27
Joined: Sun Apr 19 2020 7:02 pm

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by Navadvipa Chandra d »

Hello, Barbara and All!

1. Yes, QStorage and QStorageDB class work for saving and restore data.
2. No. While I was working on the project alone.
3. Butter won't spoil porridge. A Russian proverb
4. In regular expressions, the dot symbol "." means any character, and the asterisk symbol "*" means repeating zero or more times. In this case, you just need to change the mask.

I wrote it myself. For example, I've been thinking for a long time, how is it possible to compare a string with a mask?

StringNumberToWords is not my algorithm. This has been going on since the first and second versions of Borland Delphi. The function was either on the FAQ question list, or someone on the forum shared it with everyone.

Yes, that's right. my repository on github turned out to be private. I can't make it publicly available. I've given up on github.

https://gitflic.ru/project/navadvipa-chandra-dasa/slovar-shrily-prabhupady-na-copperspice

Because gitflic did not accept the large Sanskrit.db file.I made three volumes of the archive.

Sanskrit.7z.001
Sanskrit.7z.002
Sanskrit.7z.003

The archive must be unpacked before assembly.

Thanks!
Sincerely, Navadvipa Chandra das.
barbara
Posts: 479
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by barbara »

Thank you for looking at where you can contribute to the CopperSpice project. If you are looking for areas of CS which are on our roadmap for improvement, please let us know and we can suggest a direction.

Your last reply did not provide enough information. Let's look at your requests again.

>> 1. QStorage and QStorageDB class
>> class work for saving and restore data.

We need a lot more information. What data and how is it formatted? Can the user change the format or do they need to use your layout? Does this class marshal data to a file? To a database? What are the advantages?


>> 2. We can suggest an interesting simple QEmitValue template for consideration.

Again, we need a lot more information about what this class does and why it should be added. How does is benefit CopperSpice?


>> 3. StringNumberToWords function

Does your function take international formats into consideration? We know that "numbers to words" in India is not the same as a US format. We are not sure this is related to anything which CS does.


>> 4. The Like function, it works as a very simplified regular expression,

You did not mention if you reviewed our QRegularExpression class Since we have this functionality already it is unclear why it needs to be duplicated. Are you proposing a function or another class?

I believe it would make more sense to improve QRegularExpression if you feel it is not adequate.

Barbara
Navadvipa Chandra d
Posts: 27
Joined: Sun Apr 19 2020 7:02 pm

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by Navadvipa Chandra d »

Hello, Barbara and All!

Have you looked at the source code on the GitFlic website? Have you tried compiling and running the PrabhupadaDictionary.exe ? I sent you a link to a public repository.

https://gitflic.ru/project/navadvipa-chandra-dasa/slovar-shrily-prabhupady-na-copperspice

1. Format binary. The user can decide for himself what and how to record, and how to restore data. For example, I saved an unlimited number of documents in a one file. Each document consisted of data from three database tables that were linked by two master-detail relationships. And during recovery (when reading data from a file), these documents were written to the database, and all the triggers were triggered. The Storager class-helper is responsible for this.

2. You can have a look.

3."The "number to word" is needed when printing financial documents, for example. When translating words, it turned out pretty well in different languages, including English. However, there are absolutely no words "and" in English. If the words "and" are necessary, then the algorithm needs to be further corrected. In this regard, I have a question why is the survey why is CopperSpice exclusively as a highly specialized library? Why CopperSpice can't work in areas where Embarcadero Delphi and C++Builder work?" But in the Russian-language FAQ, the question about the "number to word" function appeared from the earliest versions Delphi. Means that a lot of developers need it!

To test the operation of the "number to word" function, you can uncomment a section of code in the PrabhupadaDictionary source texts.

4. I made it so that the user can choose whether to use regular expressions or the Like function. At first, I also decided that the Like function had outlived its usefulness and that regular expressions were much more attractive to both the user and the programmer. That's the way it is. But I decided to test the speed of work in identical queries. Complex queries of the Like function are too much for the teeth. And since the difference in speed is significant, I decided to leave it. It's so tiny that it won't take up much space. However, it requires preliminary preparation of a comparison mask. It will process double and triple "%" characters incorrectly. For example, you must first replace "%%" with a single "%" and so on until there are no double "%". But this is not so significant. It handles duplicate "%" characters in the tail of the mask, but you can remove this functionality.

With best regards, Navadvipa Chandra das.
Post Reply