Sun CC compilation fixes

This commit is contained in:
Aleksandar Fabijanic
2009-03-30 14:28:46 +00:00
parent 21ca665427
commit 5ba59148d4
34 changed files with 389 additions and 16 deletions

View File

@@ -49,7 +49,7 @@
namespace Poco {
namespace WebWidgets {
class Cell;
class Cell;
namespace ExtJS {

View File

@@ -69,14 +69,13 @@ public:
template <typename T>
static void write(const T& t, std::ostream& out)
inline void write(const T& t, std::ostream& out)
{
out << t;
}
template <>
void write(const std::string& t, std::ostream& out)
inline void write(const std::string& t, std::ostream& out)
{
out << "'" << Utility::safe(t) << "'";
}
@@ -181,7 +180,6 @@ public:
{
}
void addFixed(const std::string& name, const std::string& fixedContent)
/// Adds a variable with a given fixed string content. The content will not be wrapped
/// with ' ' but will be written as is
@@ -201,6 +199,13 @@ public:
addFixed(name, var);
}
template <typename Ret>
void addDynamic(const char* pName, Ret (Class::*Function)() const)
/// Overload for char*. Forwards to the call using std::string.
{
addDynamic<Ret>(std::string(pName), Function);
}
void writeData(const void* pAny, std::ostream& out)
/// Writes the content of the table used to dynamically
/// initialize Table Columns

View File

@@ -53,32 +53,38 @@ TableCellHandlerFactory::TableCellHandlerFactory()
{
{
TableCellHandler<CheckButtonCell>::Ptr pHandle(new TableCellHandler<CheckButtonCell>("Ext.form.Checkbox", true, true));
pHandle->addDynamic<bool>("checked", &CheckButtonCell::getBool);
typedef bool (CheckButtonCell::*Function)() const;
pHandle->addDynamic<bool>("checked", Function(&CheckButtonCell::getBool));
registerFactory(typeid(CheckButtonCell), pHandle);
}
{
TableCellHandler<TextEditCell>::Ptr pHandle(new TableCellHandler<TextEditCell>("Ext.form.TextArea", true, true));
pHandle->addDynamic<std::string>("value", &TextEditCell::getString);
typedef std::string (TextEditCell::*Function)() const;
pHandle->addDynamic<std::string>("value", Function(&TextEditCell::getString));
registerFactory(typeid(TextEditCell), pHandle);
}
{
TableCellHandler<TextFieldCell>::Ptr pHandle(new TableCellHandler<TextFieldCell>("Ext.form.TextField", true, false));
pHandle->addDynamic<std::string>("value", &TextFieldCell::getString);
typedef std::string (TextFieldCell::*Function)() const;
pHandle->addDynamic<std::string>("value", Function(&TextFieldCell::getString));
registerFactory(typeid(TextFieldCell), pHandle);
}
{
TableCellHandler<NumberFieldCell>::Ptr pHandle(new TableCellHandler<NumberFieldCell>("Ext.form.NumberField", true, false));
pHandle->addDynamic<std::string>("value", &NumberFieldCell::getString);
typedef std::string (NumberFieldCell::*Function)() const;
pHandle->addDynamic<std::string>("value", Function(&NumberFieldCell::getString));
registerFactory(typeid(NumberFieldCell), pHandle);
}
{
TableCellHandler<ComboBoxCell>::Ptr pHandle(new TableCellHandler<ComboBoxCell>("Ext.form.ComboBox", true, false));
pHandle->addDynamic<std::string>("value", &ComboBoxCell::getString);
typedef std::string (ComboBoxCell::*Function)() const;
pHandle->addDynamic<std::string>("value", Function(&ComboBoxCell::getString));
registerFactory(typeid(ComboBoxCell), pHandle);
}
{
TableCellHandler<ButtonCell>::Ptr pHandle(new TableCellHandler<ButtonCell>("Ext.Button", false, true));
pHandle->addDynamic<std::string>("text", &ButtonCell::getString);
typedef std::string (ButtonCell::*Function)() const;
pHandle->addDynamic<std::string>("text", Function(&ButtonCell::getString));
registerFactory(typeid(ButtonCell), pHandle);
}
{

View File

@@ -454,7 +454,6 @@ bool Utility::writeJSEvent(std::ostream& out, const std::string& eventName, cons
out << "fn:" << fct << "{";
writeFunctionCode(out, "all", delegates);
out << "}"; //closes fn
}
if (delayTime > 0)
{

View File

@@ -1188,7 +1188,11 @@ void ExtJSTest::testFunction()
ptrBut2->setToolTip("click here to disable");
ptrFrm->add(ptrBut2);
TableCellHandler<CheckButtonCell>::Ptr pHandle(new TableCellHandler<CheckButtonCell>("Ext.form.Checkbox", false, true));
pHandle->addDynamic<bool>("checked", &CheckButtonCell::getBool);
// this is really clumsy, but it seems to be the only way to force Sun CC to digest it
typedef bool (CheckButtonCell::*Fun)() const;
pHandle->addDynamic<bool>("checked", Fun(&CheckButtonCell::getBool));
pHandle->addFixed("dummy", "dummy");
std::ostringstream str;
pHandle->writeData(ptrBut->cell<CheckButtonCell>(), str);
@@ -1387,6 +1391,7 @@ void ExtJSTest::testJSEvent()
"all.invoke(p1);"
"}"
"}");
assert (result == expected);
}