[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TashkeelHandler: A QT C++ Class



Asalamu alaikum.

On Thursday 01 September 2005 00:30, Mete Kural wrote:

> Mashallah TashkeelHandler sounds very powerful.

Thank you for the compliment. It does have problems, though.
You can abuse it by entering a letter in the regular expression
string (the QString "a"). This will delete the letter for you.
If you need to a guard you must check that the sent regex string
is not a letter. :)

To guard you do (In the removeTashkeel member):

if(!tashkeel.contains(r1))
{ 
  // invalid regex...
  // do something...
  // probably abort() or throw an exception...
}

before the else that assigns r1 to rule1.

> I would be delighted to see  a version of QT GUI that provides the user
> the option to view the Quran text  with varying levels of marks. I lack
> the C++ skills to do this myself though. 

You have a regex class in Java. All you have to do is find out if you have split
and join members (perl has them) and apply the technique (My case with Java is
similar to your case with C++.)

> If you add this feature by any chance in a future GUI version that would be neat.

TashkeelHandler is class that can be used in a GUI or CLI applications.
It's just a matter of creating an instance and using any of its member
functions. It's actually for programmers, to give them ideas or for their
direct use. The quality is not suitable for production, it should be used
for experimentation only.

The client application using the class could be any application that uses
Arabic strings. Actually, I use it as a shared library. To do so, the user
(A programmer familiar with QT) can create a file called tashkeelhandler.pro
in the same directory where the tashkeelhandler.cc and the .h files are
located and put the following lines to it:

TEMPLATE = lib
INCLUDEPATH += .
HEADERS += tashkeelhandler.h
SOURCES += tashkeelhandler.cc
TARGET = tashkeel
target.path += /usr/local/lib
INSTALLS += target

and then type:
qmake (That will generate a Makefile with -fPIC, -shared etc.)
make (This will create the libtashkeel .so files.)
make install (will install the library)

Wishing you and your family peace and good health.

Salam,
Abdalla Alothman