InspIRCd  3.0
fileutils.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2013 Peter Powell <[email protected]>
5  *
6  * This file is part of InspIRCd. InspIRCd is free software: you can
7  * redistribute it and/or modify it under the terms of the GNU General Public
8  * License as published by the Free Software Foundation, version 2.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 
20 #pragma once
21 
23 class CoreExport FileReader
24 {
26  std::vector<std::string> lines;
27 
29  unsigned long totalSize;
30 
31  public:
33  FileReader() : totalSize(0) { }
34 
38  FileReader(const std::string& filename);
39 
44  void Load(const std::string& filename);
45 
47  std::string GetString() const;
48 
50  const std::vector<std::string>& GetVector() const { return lines; }
51 
53  unsigned long TotalSize() const { return totalSize; }
54 };
55 
57 class CoreExport FileSystem
58 {
59 private:
60  FileSystem() { }
61 
62 public:
67  static std::string ExpandPath(const std::string& base, const std::string& fragment);
68 
74  static bool FileExists(const std::string& path);
75 
80  static std::string GetFileName(const std::string& path);
81 
86  static bool StartsWithWindowsDriveLetter(const std::string& path);
87 };
unsigned long TotalSize() const
Definition: fileutils.h:53
Definition: fileutils.h:57
FileReader()
Definition: fileutils.h:33
Definition: fileutils.h:23
const std::vector< std::string > & GetVector() const
Definition: fileutils.h:50