Ralf Habacker wrote:
>> It's the only(?) simple alternative we have
>> to the inline solution.
>>
>> But then we must move all the relevant
>> kjs_binding.cpp code into a extra file which
>> will build into the additional shared library.
>>
> Why ? If you define KDE_USTRING_EXPORT for the methods located in
> libkhtml when compiling to dllexport, than any functon in libkhtml
> which requires any of this function will look for a symbol in the recent
> library not for an external in the kjs library. This is what the
> test-kjs.patch does, or does I have misunderstand something important ?
>
Next time when I compile with mingw I'll give it a try.
And you are right, I also don't see a reason why it should not work.
But this solution introduces a additional shared library and
this is the reason I don't like very much.
> The *.ii files in the testcase shows how the export definition of single
> UString members looks.
>
>> Isn't it simpler just to inline for all compilers?
>> It also gives us a little speed-up.
>>
> I don't know about the reasons, why they are defined in kjs_binding.cpp
As I understand it, the reasons for these functions are to help the kde
development but also avoids the binding to Qt when compiled at Apple.
> About how many functions are we talking ?
>
See the attached file which contains all the inline code and which
I forgot to post with the last patch.
Peter
#include "kjs_dom.h"
#include "dom/css_stylesheet.h"
#include "dom/dom_exception.h"
#include "dom/dom2_range.h"
#include "xml/dom2_eventsimpl.h"
namespace KJS
{
UString::UString(const QString &d)
{
unsigned int len = d.length();
UChar *dat = static_cast<UChar*>(fastMalloc(sizeof(UChar)*len));
memcpy(dat, d.unicode(), len * sizeof(UChar));
m_rep = UString::Rep::create(dat, len);
}
UString::UString(const DOM::DOMString &d)
{
if (d.isNull()) {
// we do a conversion here as null DOMStrings shouldn't cross
// the boundary to kjs. They should either be empty strings
// or explicitly converted to KJS::Null via getString().
m_rep = &Rep::empty;
return;
}
unsigned int len = d.length();
UChar *dat = static_cast<UChar*>(fastMalloc(sizeof(UChar)*len));
memcpy(dat, d.unicode(), len * sizeof(UChar));
m_rep = UString::Rep::create(dat, len);
}
DOM::DOMString UString::domString() const
{
return DOM::DOMString((QChar*) data(), size());
}
QString UString::qstring() const
{
return QString((QChar*) data(), size());
}
QConstString UString::qconststring() const
{
return QConstString((QChar*) data(), size());
}
DOM::DOMString Identifier::domString() const
{
return DOM::DOMString((QChar*) data(), size());
}
QString Identifier::qstring() const
{
return QString((QChar*) data(), size());
}
}
_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem