2 messages in com.mysql.lists.plusplusRe: Operator overload of query...| From | Sent On | Attachments |
|---|---|---|
| Rune Solem | 28 Dec 2000 02:29 | |
| Florian G. Pflug | 29 Dec 2000 17:06 |
| Subject: | Re: Operator overload of query...![]() |
|---|---|
| From: | Florian G. Pflug (fg...@phlo.org) |
| Date: | 12/29/2000 05:06:46 PM |
| List: | com.mysql.lists.plusplus |
On Thu, Dec 28, 2000 at 11:29:54AM +0100, Rune Solem wrote:
Hi all
Does anyone know which stream I am going to overload, when I want to to an overload of the query << operator
If you don't understand what I mean I will try and explain ( because I am not sure I understand the first line)
I want to do something like this:
ostream& operator << (ostream &os, const struct tm& t) {
os << "Daylight Savings = " << t.tm_isdst << endl; os << "Day of year = " << t.tm_yday << endl; os << "Day of week = " << t.tm_wday << endl; os << "Year = " << t.tm_year+1900 << endl; os << "Month = " << t.tm_mon+1 << endl; os << "Day of month = " << t.tm_mday << endl; os << "Hour = " << t.tm_hour << endl; os << "Minute = " << t.tm_min << endl; os << "Second = " << t.tm_sec << endl; os << t.tm_mon+1 "_" << t.tm_year+1900; return os; };
Just change it to
Query &operator << (Query &os, const struct tm &t) {... }
Since the class Query is the one you can normally use the << operator on, this should work. It may be more elegant to overload the << operator for a base class of Query. You will have to check the mysql++ source for this.
Greetings, Florian Pflug




