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 » What about LUA plugin?
Re: What about LUA plugin? [message #5221 is a reply to message #5220] Mon, 11 September 2006 00:24 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
Quote:


struct XmlIO {
template<class T> XmlIO& operator()(const char* tag, T& v)
{ std::cout << "<" << tag << ">" << v << "<\\" << tag << ">"; return *this; }
};



It is bidirectional, so cout does not make it, however I see the point...

Quote:


#define SERIALIZABLE(Class) template<class stream> friend stream& operator<<(stream&, Class&);

// End user code
class C {
int v1, v2;
SERIALIZABLE(Class);
public:
C() : v1(12), v2(24) {}
};



Yep. But using macro is ugly and requires more typing. Instead, there is

template <class T> XmlIO XmlIO::operator()(const char *tag, T& var) {
	XmlIO n(*this, tag);
	Xmlize(n, var);
	return *this;
}


soo if you want to be aspect aware, which I understand as being able to add xmlization to existing class, simply define Xmlize *function* for it.

Xmlize itself has template

template <class T>
void Xmlize(XmlIO xml, T& var)
{
	var.Xmlize(xml);
}


(Now if somebody asks what we mean by "aggresive use of C++", here is the answer).

Note that sometimes you might want to define more funtions to xmlize single type to express the value the type really represents, e.g. there is XmlizeLang that interprets int as language indentifier (e.g. "en-us").

Quote:


About a uppforge, why waiting high demand? Won't the offer create demand? At least, this shall only encourage sharing U++ code, thus giving more examples of U++ code. Maybe just letting a space where to put code snipset would be nice.



What I really wanted to say is that U++ is not popular enough for somebody to start one. If you feel like starting such effort, go for it, it will definitely help us.

Mirek
 
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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: C strings
Next Topic: A new way how to create "plugin"
Goto Forum:
  


Current Time: Thu Aug 14 04:24:34 CEST 2025

Total time taken to generate the page: 0.15312 seconds