LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Blogs > rainbowsally
User Name
Password

Notices



Rate this Entry

qt type id test/demo

Posted 05-27-2012 at 10:38 PM by rainbowsally
Updated 05-27-2012 at 10:40 PM by rainbowsally

Today's features:
  • Use C++ typeid's to compare or check types.
  • Share base64 encoded compressed file/dir data in message forums (example).

The typeid(obj) doesn't require QT, but it also works with it. Here's a simple makefile and a widget to show some type ids and how to compare
them.

After running this you should have a folder named typeid-test. Type 'make' inside that folder to create the 'main' executable.

Requires base64, QT4, make, gcc, and all that good stuff.

file: typeid-test.b64 (executable)
purpose: extract the typeid-test folder and it's contents.
Code:
#!/bin/sh

base64 -d << _eof > typeid-test.tar.gz
H4sIAG07wU8AA+07a3PbOJL5OvwViJyNKUXvh51SbGdtWXF0a0t+yOO9mplS0SRkYUKRHD7s+FLZ
337dAPiSKNuTUZy9W3ZVYhJoNPqFRjcI+fcOZUbFp55fe/GdoA6w3eng38Z2p87fG+02/yvhRaOx
vVVvtjrtdvNFvdHsbDVfkM73YigJgedrLiEvUAPUfQiPut5zMPS84Cfsb38nD/hT9u+0wP6tejO3
/7NA2v5zzf1UNdgDavgWQANvCXuvsH9D2r+xtd3YeoGd0E3q62UjG/7D7a/8aAZy+KGQXP+eq3+X
HeDPxP9Wp4HxvwVoefx/Bli0f8AmU9udV2drnOOR+N9qbW2F9m+129Df6DSgKY//zwC10ppBKZXI
B/AgckMt6mo+NcjUtefEpZrBrBtyOSBTZlKyyd0sYJuKGNMDBEDGRw7X911y5pNLUDsZWGCaqaZT
0rPnDox2yS1Yg9kWaVe3qw1J4mr/fDgYHr0k+6ZJ9Jlm3VCPzDWDEmYRf8Y8MfMdg+5rSkzb88nd
jFrAm87pJvh7qaxbMTVF2WBTy6BTmGPyYXR+MvmobMArs2iiBZAs3QyA6Z0zv2e7tHb2s+YyzfL3
Ul1HAaud7es+KCGrw3FMpmsreg8C37etI9cOnIzeQ6aZ9k1Gx0cwIX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Hr3kN7PITqPIR/Y5EkiuuA1
Z3VTuDAkPzzKExd/XSIOPxcJLB3ZkvWcaWTX9mFpT8hCbZ9o4MV99L6yuo8zlYe+FPBDALyM/cgp
ACFPOAYApG87ByDkzx0E/OgiKocccsghhxxyyCGHHHLIIYcccsghhxxyyCGHHHLIIYcccsghhxxy
yOEHwv8CzRSFPgB4AAA=
_eof

tar -xaf typeid-test.tar.gz
rm -f typeid-test.tar.gz
Copy the above to a text file and either make it executable or run it with sh to create a tarball and then extract it recreating the directory tree and the build files.

See the main.cpp file to see what we are looking at in the display.

;-)
Posted in Uncategorized
Views 725 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 11:52 PM.

Main Menu
Advertisement

Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration