Browse code

Shorten two pathnames with 103 chars to <= 100 chars by renaming fusion_sdk/ folder to fusion/ (fixes #35)

Henrik Bengtsson authored on 22/09/2021 16:19:01
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,137 @@
1
+////////////////////////////////////////////////////////////////
2
+//
3
+// Copyright (C) 2005 Affymetrix, Inc.
4
+//
5
+// This library is free software; you can redistribute it and/or modify
6
+// it under the terms of the GNU Lesser General Public License
7
+// (version 2.1) as published by the Free Software Foundation.
8
+//
9
+// This library is distributed in the hope that it will be useful, but
10
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
12
+// for more details.
13
+//
14
+// You should have received a copy of the GNU Lesser General Public License
15
+// along with this library; if not, write to the Free Software Foundation, Inc.,
16
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+//
18
+////////////////////////////////////////////////////////////////
19
+
20
+/**
21
+ * @file   LineFile.h
22
+ * @author Mybrid Spalding
23
+ * @date   Mon May 23 11:27:16 2005
24
+ *
25
+ * @brief  DO NOT USE. Except in cases of test code. Platform safe file class to read lines.
26
+ */
27
+
28
+#ifndef _LINE_FILE_H_
29
+#define _LINE_FILE_H_
30
+
31
+//
32
+#include <fstream>
33
+#include <string>
34
+//
35
+
36
+/**
37
+ *  LineFile
38
+ * @brief Platform safe class for reading lines.
39
+ *
40
+ * For Test Code ONLY.
41
+ * Chances are you should be using file/TsvFile/TsvFile
42
+ * and not this object. This file is intended for test code in util/
43
+ * being used by file/TsvFile/TsvFile and other
44
+ * code not using TsvFile.
45
+ */
46
+
47
+class LineFile
48
+{
49
+
50
+public:
51
+
52
+  /** Line endings are platform specific, this encodes different types
53
+      we know of. */
54
+  enum FileLineEnding {
55
+    UNIX = 0,   // '\n'
56
+    DOS = 1,    // '\r\n'
57
+    MAC = 2,    // '\r'
58
+    UNKNOWN = 3 // ???
59
+  };
60
+
61
+  /**
62
+   * Constructor.
63
+   */
64
+  LineFile();
65
+
66
+  /**
67
+   * @brief Destructor closes stream.
68
+   */
69
+  virtual ~LineFile();
70
+
71
+  /**
72
+   * @brief Platform safe open for read, can be used multiple times
73
+   * with different file names.
74
+   * @return ifstream in question.
75
+   *         
76
+   */
77
+  std::ifstream & open(const std::string & fileName, bool abortOnError = false);
78
+  /**
79
+   * @brief close the ifstream if needed. 
80
+   * @return void
81
+   */
82
+  void            close();
83
+
84
+  /**
85
+   * @brief Platform safe reading of a line, stripping the eol.
86
+   * File is automatically closed when eof is reached.
87
+   * @param line - returned if possible, cleared otherwise.
88
+   * @param trim - false by default, true strips trailing spaces.
89
+   * @return true if line is returned.
90
+   *         line will be cleared when false is returned. .
91
+   */
92
+  bool getline(std::string & line, bool trim = false);
93
+
94
+  /**
95
+   * @brief What type of file is this one?
96
+   * @return Type of file that has been determined.
97
+   */
98
+  enum FileLineEnding getFileType() {
99
+    return m_endType;
100
+  }
101
+
102
+  /**
103
+   * @brief What is the name of the file we're reading from?
104
+   * @return name of file being read.
105
+   */
106
+  std::string getFileName() {
107
+    return m_fileName;
108
+  }
109
+
110
+  /**
111
+   * @brief - get the input file stream.
112
+   * @return ifstream reference.
113
+   */
114
+  std::ifstream & getStream() {
115
+    return m_fileStream;
116
+  }
117
+
118
+  bool is_open() {
119
+    return m_fileStream.is_open();
120
+  }
121
+  bool fail() {
122
+    return m_fileStream.fail();
123
+  }
124
+  bool eof() {
125
+    return m_fileStream.eof() ;
126
+  }
127
+
128
+private:
129
+
130
+  std::string m_fileName;
131
+  std::ifstream m_fileStream;
132
+  enum FileLineEnding m_endType;
133
+
134
+
135
+};
136
+
137
+#endif /* _LINE_FILE_ */