ofx_utilities.hh
Go to the documentation of this file.
/***************************************************************************
ofx_util.h
-------------------
copyright : (C) 2002 by Benoit Gr�goire
email : benoitg@coeus.ca
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef OFX_UTIL_H
#define OFX_UTIL_H
#include <string.h>
#include <time.h> // for time_t
#include <cstring>
#include "ParserEventGeneratorKit.h"
/* This file contains various simple functions for type conversion & al */
/*wostream &operator<<(wostream &os, SGMLApplication::CharString s); */
template <typename T>
void STRNCPY(T& dest, const std::string& src)
{
std::strncpy(dest, src.c_str(), sizeof(dest));
}
#define ASSIGN(DEST, VALUE) DEST = (VALUE); DEST ## _valid = true
#define ASSIGN_STRNCPY(DEST, VALUE) STRNCPY(DEST, VALUE); DEST ## _valid = true
std::string CharStringtostring(const SGMLApplication::CharString source);
void AppendCharStringtostring(const SGMLApplication::CharString source, std::string &dest);
time_t ofxdate_to_time_t(const std::string& ofxdate);
double ofxamount_to_double(const std::string ofxamount);
std::string strip_whitespace(const std::string para_string);
int mkTempFileName(const char *tmpl, char *buffer, unsigned int size);
#endif
ofxamount_to_double
double ofxamount_to_double(const std::string ofxamount)
Convert OFX amount of money to double float.
Definition: ofx_utilities.cpp:130
ofxdate_to_time_t
time_t ofxdate_to_time_t(const std::string &ofxdate)
Convert a C++ string containing a time in OFX format to a C time_t.
Definition: ofx_utilities.cpp:68
CharStringtostring
std::string CharStringtostring(const SGMLApplication::CharString source)
Convert OpenSP CharString to a C++ STL string.
Definition: ofx_utilities.cpp:40
STRNCPY
void STRNCPY(T &dest, const std::string &src)
Definition: ofx_utilities.hh:35
AppendCharStringtostring
void AppendCharStringtostring(const SGMLApplication::CharString source, std::string &dest)
Append an OpenSP CharString to an existing C++ STL string.
Definition: ofx_utilities.cpp:52
strip_whitespace
std::string strip_whitespace(const std::string para_string)
Sanitize a string coming from OpenSP.
Definition: ofx_utilities.cpp:153