Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

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.


index.php?t=getfile&id=4858&private=0



SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: QrCode image generation And debuging QR symbology [message #45339 is a reply to message #45338] Sat, 31 October 2015 14:54 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Package can help to debug QR-generation.

index.php?t=getfile&id=4859&private=0


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: QrCode image generation And debuging QR symbology [message #45340 is a reply to message #45339] Sat, 31 October 2015 14:56 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Files of packages and test application.
1. QrEncode class


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: QrCode image generation And debuging QR symbology [message #45341 is a reply to message #45340] Sat, 31 October 2015 14:58 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Files of packages and test application.
2. QrEncode test application


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: QrCode image generation And debuging QR symbology [message #45342 is a reply to message #45341] Sat, 31 October 2015 14:59 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

It will be pleaser if anybody review my code and point to codestyle mistakes.

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 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
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 (?Smile should be written like this - more spaces:
int cs = casesensitive ? 1 : 0;


4. Decide where you put brackets in your if statement:
if ( qrcode == NULL ) {


It should be
if(qrcode == NULL) {


5. The valid way to represent if/else if/else block is:
if(...) {
   // ...
}
else
if(...) {
   // ...
}
else {
   // ...
}


You made small mistake here (never use this)
} else {


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 #45350 is a reply to message #45349] Sat, 31 October 2015 22:28 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Thank you, Klugier!
But I use little different style.
By the way, I try to say some else thing:
interconnect between classes and functions.

Anyway, thank you.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: QrCode image generation And debuging QR symbology [message #45351 is a reply to message #45350] Sat, 31 October 2015 22:39 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
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 #45377 is a reply to message #45338] Mon, 02 November 2015 19:07 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
NAMESPACE_UPP doesn't open upp namespace for definitions? (too lazy to check the macro)
So QrEncode would end up in Upp::QrEncode then? Which is probably not desired.

I would probably rather go for UPP::String instead of String ... (although now I wonder if it works when Upp namespace is switched off by some flag.. probably yes, as then upp classes end as global, and ::String is fine (notice I used UPP:: instead of Upp::, UPP should be well defined by U++ depending on that flag ... somewhere, not sure in which .h, but very likely some basic from Core)
Re: QrCode image generation And debuging QR symbology [message #45378 is a reply to message #45377] Mon, 02 November 2015 21:20 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello mr_ped,

You are right about "NAMESPACE_UPP", it equals "namespace Upp {". And yes in this case we have Upp::QrEncoder. Please notice that "using namespace Upp" force user to use this namespace in his/her file. So, this is definitely best alternative if you don't like to put "Upp::" before each things that refer to this namespace.

I don't know nothing about turning off namespace Upp. Is UPP not alias to Upp namespace. I mean "namespace UPP = Upp"?

Sincerely,
Klugier


U++ - one framework to rule them all.
Re: QrCode image generation And debuging QR symbology [message #45379 is a reply to message #45338] Tue, 03 November 2015 02:31 Go to previous message
mr_ped is currently offline  mr_ped
Messages: 825
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. Very Happy

[Updated on: Tue, 03 November 2015 02:32]

Report message to a moderator

Previous Topic: PolyXML problems with MSC15
Next Topic: CaptureScreenDll with PDF option
Goto Forum:
  


Current Time: Thu Mar 28 20:35:29 CET 2024

Total time taken to generate the page: 0.01469 seconds