|
|
Home » Developing U++ » UppHub » QrCode image generation And debuging QR symbology
QrCode image generation And debuging QR symbology [message #45338] |
Sat, 31 October 2015 14:52  |
|
New package to call QR code generator and make Image object to place to QTF and U++ applications
to compile under linux:
apt-get install libqrencode-dev
to compile under windows:
I can't to to test under windows.
It will be good to notice of details of success copmilation on windows systems.

SergeyNikitin<U++>( linux, wine )
{
under( Ubuntu || Debian || Raspbian );
}
|
|
|
|
|
|
|
Re: QrCode image generation And debuging QR symbology [message #45349 is a reply to message #45342] |
Sat, 31 October 2015 22:12   |
 |
Klugier
Messages: 1099 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello Sergey,
So you want to talk about your coding style? Ok let's start:
1. First of all. Never use "using namespace Upp" in your header file. Instead of this use NAMESPACE_UPP & END_UPP_NAMESPACE macro.
using namespace Upp;
class QrEncode {
// ...
};
Should be:
NAMESPACE_UPP
class QrEncode {
// ...
};
END_UPP_NAMESPACE
2. Next simply thing you do in your code regularly is (:
for(int i = 0; i < qrcode->width; i++){
Giv it a space before bracket:
for(int i = 0; i < qrcode->width; i++) {
3. The ternary operator (? should be written like this - more spaces:
int cs = casesensitive ? 1 : 0;
4. Decide where you put brackets in your if statement:
It should be
5. The valid way to represent if/else if/else block is:
if(...) {
// ...
}
else
if(...) {
// ...
}
else {
// ...
}
You made small mistake here (never use this)
6. Method/Function arguments is not perfect:
is = Size(20+border*2,20+border*2);
It should be (a lot more spaces - remember to put space after comma, and after/before math operator like "-" or "+"):
is = Size(20 + border * 2, 20 + border * 2);
7. Operator "<<" should have spaces too:
uint8_t m = 1 << (layer);
8. Method/function opening braket starts always in new line:
Image QrEncode::QrEncode_To_Image(String s1){
Should be
Image QrEncode::QrEncode_To_Image(String s1)
{
9. You have got several tabulation/space problems - you can detect this by showing whitespace in your code or use feature show mismatch witespace in newer ide versions.
10. In class constructor QrEncode you have too many enters at the end.
P.S.
All things wrote in this post base on Ultimate++ code. Please notice that there is not official Ultimate++ coding standard. But I strongly believe that all things I proposed will increase your code read ability.
[EDIT - There is more!]
11. "public/private/protected" goes in the same line as class statment:
class QrEncoder {
typedef QrEncode CLASSNAME;
public:
QrEncoder();
// ...
It should be
class QrEncoder {
typedef QrEncode CLASSNAME;
public:
QrEncoder();
// ...
Sincerely,
Klugier
U++ - one framework to rule them all.
[Updated on: Sat, 31 October 2015 22:25] Report message to a moderator
|
|
|
|
Re: QrCode image generation And debuging QR symbology [message #45351 is a reply to message #45350] |
Sat, 31 October 2015 22:39   |
 |
Klugier
Messages: 1099 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello Sergey,
I understand that you can use your own coding standard in your private project. But if you want to post things in bazzar it should be a little bit more standardize. It is important, because users didn't want to read code that it is different than others. This is probably the reason why i don't like code in bazzar. The interesting thing here is that all core ultimate++ packages look very similar. Even when i contributed code to ultimate++ (look at the Android Builder code) I always wanted it to be compatibility with the rest of the code. And yes i used different coding standard for my "private" apps.
Please notice that some things in you code like "using namespace Upp" in header can lead to error in the future. It happens when user want to include your file, but didn't want to use namespace Upp.
You can also use const reference in String parameter:
Image QrEncode::QrEncode_To_Image(const String& s1)
Sincerely and thanks for discussion,
Klugier
U++ - one framework to rule them all.
[Updated on: Sun, 01 November 2015 00:15] Report message to a moderator
|
|
|
|
|
Re: QrCode image generation And debuging QR symbology [message #45379 is a reply to message #45338] |
Tue, 03 November 2015 02:31  |
mr_ped
Messages: 826 Registered: November 2005 Location: Czech Republic - Praha
|
Experienced Contributor |
|
|
Normally UPP is Upp, so UPP::String is Upp::String.
But there is (or was) a way to compile upp without Upp namespace, at that point UPP is probably empty, so UPP::String is compiled as ::String I guess. Sorry, I'm too lazy to verify it.
Anyway, in Bazaar Packages, when you are creating .h file, I would go for UPP::upp_class way.
Can't really see any downside about it, at least you see at first sight where the header is using the Upp classes, where it is using std::, and others. And the public header files should be as short and lean, as possible, so I will not accept "more writing" argument either.
Then the implementation in the .cpp is free to use "using namespace Upp;" to save typing, as the user of package usually doesn't need to read and understand implementation... as long, as the package works as the public header describes it.
[Updated on: Tue, 03 November 2015 02:32] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Apr 28 18:03:20 CEST 2025
Total time taken to generate the page: 0.00431 seconds
|
|
|