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 » Community » Newbie corner » Help needed with Convert class
Help needed with Convert class [message #40753] Thu, 12 September 2013 20:50 Go to previous message
pacoquintana is currently offline  pacoquintana
Messages: 12
Registered: December 2011
Location: Spain
Promising Member
Hi all.:
I need some help about date time format and convert
In my application I use SQLITE 3 with a column to store date and time in a TIME column
in app.layout an sqlArray has to columns, one to display date and the next one to display time coming from the same colum time in sqlite.
Working with a convert class to display date in the first sqlArray.column and time in the next one so :

Convert& DateDateConvert();
Convert& DateTimeConvert();

struct DateDateConvertCls : Convert {
virtual Value Format(const Value& q) const;
};

Value DateDateConvertCls::Format(const Value& q) const
{
Time d = q;
return !d.IsValid() ? String() : ::Format("%1:04d-%2:02d-%3:02d", d.year, d.month, d.day);
}

Convert& DateDateConvert()
{
return Single<DateDateConvertCls>();
}


struct DateTimeConvertCls : Convert {
virtual Value Format(const Value& q) const;
};

Value DateTimeConvertCls::Format(const Value& q) const
{
Time d = q;
return !d.IsValid() ? String() : ::Format("%1:02d-%2:02d-%3:02d", d.hour, d.minute, d.second);
}

Convert& DateTimeConvert()
{
return Single<DateTimeConvertCls>();
}

In the Layout :
qs.AddColumn(O_DATE, "fecha").SetConvert(DateDateConvert());
qs.AddColumnAt(1, "Hora").SetConvert(DateTimeConvert());

It compiles and link but I get an Assertion error.
I can not understand how Convert class woks, so any "good Elmer" can explain me how it works ?
Thank you very much


1add1f71cc45f0a88caa948bf339b589
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Save and file extension
Next Topic: Build options
Goto Forum:
  


Current Time: Sun Apr 28 15:21:54 CEST 2024

Total time taken to generate the page: 0.02969 seconds