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++ » U++ Developers corner » Question: Simple plugin implementation
Re: Question: Simple plugin implementation [message #30873 is a reply to message #30862] Thu, 27 January 2011 10:34 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3432
Registered: August 2008
Senior Veteran
Hello Mirek

A little bit better (not as rich as StreamRaster, but clearer for me Smile). Added "new" instead of ugly global var:

#include <Core/Core.h>

using namespace Upp;

#include "Spreadsheet.h"

class ExcelSpreadsheet : public SpreadsheetPlugin {
	Spreadsheet_METHOD_LIST
};


INITBLOCK {
	RegisterPlugin<ExcelSpreadsheet>("Excel");
}

bool ExcelSpreadsheet::Open(const char *filename) {
	puts("ExcelSpreadsheet::Open");
	return false; 
}

bool ExcelSpreadsheet::SetData(int row, int col, Value val) {
	puts("ExcelSpreadsheet::SetData");
	return false;
}


However all possible plugins are initialized, not just the one to be used.

It is the same in class StreamRaster (file Raster.h):

template <class T> static StreamRaster *FactoryFn() { return new T; }


Every registered class has to be initialized.

[Edit: Simplified INITBLOCK with templates]


Best regards
IƱaki

[Updated on: Thu, 27 January 2011 13:07]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Q: howto incorporate a native console window in GUI
Next Topic: BackgroundTask
Goto Forum:
  


Current Time: Mon Apr 28 10:48:53 CEST 2025

Total time taken to generate the page: 0.00962 seconds