Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

ofx_utilities.cpp File Reference

Various simple functions for type conversion & al. More...

Go to the source code of this file.

Functions

int get_sp_char_size (const SGMLApplication::Char *ptr)
 Detect the byte size used by OpenSP. More...

ostream & operator<< (ostream &os, SGMLApplication::CharString s)
 Convert OpenSP CharString to a C++ stream. More...

wchar_t * CharStringtowchar_t (SGMLApplication::CharString source, wchar_t *dest)
 Convert OpenSP CharString and put it in the C wchar_t string provided.

string CharStringtostring (const SGMLApplication::CharString source, string &dest)
 Convert OpenSP CharString to a C++ STL string.

string AppendCharStringtostring (const SGMLApplication::CharString source, string &dest)
 Append an OpenSP CharString to an existing C++ STL string.

time_t ofxdate_to_time_t (const string ofxdate)
 Convert a C++ string containing a time in OFX format to a C time_t. More...

double ofxamount_to_double (const string ofxamount)
 Convert OFX amount of money to double float. More...

string strip_whitespace (const string para_string)
 Sanitize a string coming from OpenSP. More...


Detailed Description

Various simple functions for type conversion & al.

Definition in file ofx_utilities.cpp.


Function Documentation

int get_sp_char_size const SGMLApplication::Char *    ptr [static]
 

Detect the byte size used by OpenSP.

get_sp_char_size(const SGMLApplication::Char * ptr) is a somewhat ugly hack to detect how wide OpenSP's SGMLApplication::Char is. You give it a pointer to a string of char (such as CharString.ptr). It should give you the size of a Char, in multiple or your platform's standard char. The clean way to do this would have been to use the SP_MULTI_BYTE and SP_WCHAR_T_USHORT defines in SGMLApplication.h However, these defines are set at OpenSP compile time, wich is no help to someone with an OpenSP binary package, and litte help even if you compile from source

Definition at line 30 of file ofx_utilities.cpp.

double ofxamount_to_double const string    ofxamount
 

Convert OFX amount of money to double float.

Convert a C++ string containing an amount of money as specified by the OFX standard and convert it to a double float.

Definition at line 163 of file ofx_utilities.cpp.

time_t ofxdate_to_time_t const string    ofxdate
 

Convert a C++ string containing a time in OFX format to a C time_t.

Converts a date from the YYYYMMDDHHMMSS.XXX[gmt offset:tz name] OFX format (see OFX 2.01 spec p.66) to a C time_t. Note that OFX can specify the time up to milliseconds, but ANSI C does not support this precision cleanly. So you wont know the millisecond you were ruined...

Definition at line 109 of file ofx_utilities.cpp.

ostream& operator<< ostream &    os,
SGMLApplication::CharString    s
 

Convert OpenSP CharString to a C++ stream.

Convert an OpenSP CharString directly to a C++ stream, to enable the use of cout directly for debugging.

Definition at line 53 of file ofx_utilities.cpp.

string strip_whitespace const string    para_string
 

Sanitize a string coming from OpenSP.

Many weird caracters can be present inside a SGML element, as a result on the transfer protocol, or for any reason. This function greatly enhances the reliability of the library by zapping those gremlins (backspace,formfeed,newline,carriage return, horizontal and vertical tabs) as well as removing whitespace at the begining and end of the string. Otherwise, many problems will occur during stringmatching.

Definition at line 178 of file ofx_utilities.cpp.


Generated on Sun Nov 24 20:26:32 2002 for LibOFX by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002