Revision | 5741bf229df9beb2eb9c57eec71c0cee64447855 (tree) |
---|---|
Time | 2011-01-04 20:31:14 |
Author | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Input lines are trimmed.
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/MolDS/trunk@28 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -7,6 +7,7 @@ | ||
7 | 7 | #include<time.h> |
8 | 8 | #include<list> |
9 | 9 | #include<vector> |
10 | +#include"base/Utilities.h" | |
10 | 11 | #include"base/MolDSException.h" |
11 | 12 | #include"base/Enums.h" |
12 | 13 | #undef INCLUDED_ENUMS |
@@ -20,7 +21,6 @@ | ||
20 | 21 | #include"base/atoms/Satom.h" |
21 | 22 | #include"base/MallocerFreer.h" |
22 | 23 | #include"base/InputParser.h" |
23 | -#include"base/Utilities.h" | |
24 | 24 | #include"base/EularAngle.h" |
25 | 25 | #include"base/Parameters.h" |
26 | 26 | #include"cndo/Cndo2.h" |
@@ -304,7 +304,9 @@ void InputParser::OutputInputTerms(vector<string> inputTerms){ | ||
304 | 304 | * # or // are treated as comment out |
305 | 305 | * |
306 | 306 | ****/ |
307 | -bool InputParser::IsCommentOut(string str){ | |
307 | +bool InputParser::IsCommentOut(string tempStr){ | |
308 | + | |
309 | + string str = TrimString(tempStr); | |
308 | 310 | |
309 | 311 | string commentPrefix1 = "#"; |
310 | 312 | string prefix1; |
@@ -1,8 +1,7 @@ | ||
1 | 1 | #ifndef INCLUDED_UTILITIES |
2 | 2 | #define INCLUDED_UTILITIES |
3 | 3 | |
4 | -#include <stdio.h> // printf, sprintf使用 | |
5 | -#include <time.h> // tm構造体, time, localtime, gmtime使用 | |
4 | +using namespace std; | |
6 | 5 | |
7 | 6 | namespace MolDS_base{ |
8 | 7 |
@@ -26,6 +25,33 @@ char *fmttm(char *buf, struct tm *st) | ||
26 | 25 | return buf; |
27 | 26 | } |
28 | 27 | |
28 | + | |
29 | +string TrimString(const string str){ | |
30 | + | |
31 | + int nStart = 0; | |
32 | + int nEnd = str.length() - 1; | |
33 | + | |
34 | + // left trim | |
35 | + for(int n = 0; n < str.length(); n++ ){ | |
36 | + if( str.data()[n] != ' ' ){ | |
37 | + nStart = n; | |
38 | + break; | |
39 | + } | |
40 | + } | |
41 | + | |
42 | + // right trim | |
43 | + for(int n = str.length() - 1; n >= 0; n-- ){ | |
44 | + if( str.data()[n] != ' ' ){ | |
45 | + nEnd = n; | |
46 | + break; | |
47 | + } | |
48 | + } | |
49 | + | |
50 | + return(str.substr( nStart, nEnd - nStart + 1 )); | |
51 | + | |
52 | +} | |
53 | + | |
54 | + | |
29 | 55 | } |
30 | 56 | #endif |
31 | 57 |
@@ -4,7 +4,7 @@ SCF | ||
4 | 4 | SCF_END |
5 | 5 | |
6 | 6 | THEORY |
7 | - //cndo/2 | |
7 | + #cndo/2 | |
8 | 8 | //indo |
9 | 9 | //zindo/s |
10 | 10 | none |