kspread_functions_helper.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef kspread_functions_helper_h_
00021 #define kspread_functions_helper_h_
00022
00023
00024 #include <koscript_parser.h>
00025 #include <koscript_util.h>
00026 #include <koscript_func.h>
00027 #include <koscript_synext.h>
00028
00029 #include <qdatetime.h>
00030 #include <qvaluelist.h>
00031
00032 #define SECSPERDAY 86400
00033 #define HALFSEC ( 0.5 / SECSPERDAY )
00034
00035
00036 namespace KSpreadDB
00037 {
00038 enum Comp { isEqual, isLess, isGreater, lessEqual, greaterEqual, notEqual };
00039 enum Type { numeric, string };
00040
00041 struct Condition
00042 {
00043 Comp comp;
00044 int index;
00045 double value;
00046 QString stringValue;
00047 Type type;
00048 };
00049
00050 typedef QValueList<Condition> ConditionList;
00051 }
00052
00053 class EDate : public QDate
00054 {
00055 public:
00056 static uint greg2jul( int y, int m, int d );
00057
00058 static uint greg2jul( QDate const & date );
00059
00060 static void jul2greg( double num, int & y, int & m, int & d );
00061 };
00062
00063 bool getDate( KSContext & context, KSValue::Ptr & arg, QDate & date );
00064 bool getTime( KSContext & context, KSValue::Ptr & arg, QTime & time );
00065
00066 void addMonths( QDate & date, int months );
00067
00068 void subMonths( QDate & date, int months );
00069
00070
00071
00072
00073
00074
00075
00076 int daysPerYear( QDate const & date, int basis );
00077
00078
00079
00080
00081
00082
00083
00084 int daysBetweenDates( QDate const & date1, QDate const & date2, int basis );
00085
00086 double fact( int n );
00087 double combin( int n, int k );
00088 double gaussinv_helper( double x );
00089
00090
00091
00092
00093
00094
00095
00096 bool approx_equal( double a, double b );
00097
00098 bool kspreadfunc_average_helper( KSContext & context, QValueList<KSValue::Ptr> & args,
00099 double & result,int & number, bool aMode );
00100 bool kspreadfunc_stddev_helper( KSContext & context, QValueList<KSValue::Ptr> & args,
00101 double & result, double & avera, bool aMode );
00102
00103 bool kspreadfunc_variance_helper( KSContext & context, QValueList<KSValue::Ptr> & args,
00104 double & result, double avera, bool aMode );
00105
00110 void getCond( KSpreadDB::Condition &cond, QString text );
00111
00116 bool conditionMatches( KSpreadDB::Condition &cond, const double &d );
00121 bool conditionMatches( KSpreadDB::Condition &cond, const QString &d );
00122
00123 #endif
This file is part of the documentation for kspread Library Version 1.4.2.