Almetare  1.15
Alle meine Taschenrechner - Eine C++-Bibliothek zur Entwicklung von Taschenrechnern
util.h
gehe zur Dokumentation dieser Datei
1 //******************************************************************************
2 // Copyright (c) 2002-2005 by Friedemann Seebass, Germany.
3 // Dieses Programm ist freie Software. Siehe GNU GPL Notiz in Datei main.cpp.
4 // This program is free software. See the GNU GPL notice in file main.cpp.
5 // Projekt: Almetare - Alle meine Taschenrechner
6 //******************************************************************************
9 //******************************************************************************
10 // Wann Wer Was
11 // ---------- -------- ---------------------------------------------------------
12 // 22.12.2004 fse Funktion getNextSym() aus Klasse Fx3600pPrgDlg hierher
13 // verlegt, da jetzt auch in CasioSciDatDlg benoetigt
14 // 15.03.2003 fse neue Funktion replace
15 // 22.04.2002 fse erzeugt
16 //******************************************************************************
17 
18 #ifndef UTIL_H
19 #define UTIL_H
20 
21 #ifndef __cplusplus
22 #error util.h is only for C++!
23 #endif
24 
25 //******************************************************************************
26 
27 #include <string>
28 
29 using namespace std;
30 
31 #define FORCE_SCI 0.0000001
32 
33 //******************************************************************************
34 // Klasse Util:
35 //******************************************************************************
36 
42 // fse, 22.04.02
43 
44 class Util
45 {
46 public:
47  enum Direction { LEFT, CENTER, RIGHT };
48  static void shiftStr(string& str, string recruit, Direction dir = RIGHT);
49  static string toLower(const string& str);
50  static string doubleToStr(double val, int format, int digits, int shiftNum, double forceSci = FORCE_SCI);
51  static string doubleToSxgStr(double val);
52  static string stripTrailingOs(const string& numStr);
53  static string shiftPoint(double num, int digits, int shiftNum);
54  static string shiftPointEng(const string& numStr, Direction dir, int digits);
55  static void getMantExp(const string& numStr, double& m, int& e);
56  static bool getMantExp(const string& numStr, string& mnt, string& exp);
57  static int getEngShiftNum(int e, int eng);
58  static string roundMantisse(string& numStr, int digits, double forceSci = FORCE_SCI);
59  static string formatFixNum(double num, int digits);
60  static string formatFixNumStr(string numStr, int digits);
61  static string roundNumStr(string& numStr, int digits, bool isSci, double forceSci = FORCE_SCI);
62  static string roundSxgNumStr(string& numStr, int maxLen);
63  static string formatSeven(string& numStr, int len, int expLen, char fillChar);
64  static string formatFixNumStr(string& numStr, int digits, int digitsAfterPoint, bool isOstripped = true);
65  static string trimNumStr(string numStr, int maxLen);
66  static string trimStr(string str, int len = 15, Direction dir = LEFT, char fillChar = ' ');
67  static string trimStr(int num , int len = 15, Direction dir = LEFT, char fillChar = ' ');
68  static string replace(const string& srcStr, const string& oldStr, const string& newStr);
69  static string stripLines(string str);
70  static void eraseCrs(string& str);
71  static void stripLine(string& line);
72  static string getNextSym(string& expr);
73  static double fact(double n);
74  static double root(double x, double y);
75 };
76 
77 //******************************************************************************
78 
79 #endif // !UTIL_H
80 
Allgemeine Funktionen, die nicht einer speziellen Klasse zugerechnet werden koennen.
Definition: util.h:44