Linux multi-monitor fullscreen support
[ryzomcore.git] / studio / src / plugins / bnp_manager / bnp_file.h
blob87798955f8dcc04e9aca24ee08b7e2208ad17d2b
1 // Object Viewer Qt - BNP Manager Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2011 Roland WINKLMEIER <roland.m.winklmeier@gmail.com>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef BNP_FILE_H
18 #define BNP_FILE_H
20 // Project includes
22 // Nel includes
23 #include "nel/misc/types_nl.h"
24 #include <nel/misc/singleton.h>
26 // Qt includes
27 #include <QString>
30 namespace BNPManager
33 struct PackedFile
35 PackedFile();
36 std::string m_name;
37 uint32 m_size;
38 uint32 m_pos;
39 std::string m_path;
42 typedef std::vector<PackedFile> TPackedFilesList;
44 class BNPFileHandle
46 NLMISC_SAFE_SINGLETON_DECL(BNPFileHandle)
48 /**
49 * Private constructor
51 BNPFileHandle();
53 /**
54 * Private destructor
56 ~BNPFileHandle();
58 public:
59 // release memory
60 static void releaseInstance();
62 /*void append (const QString destFilename, const QString origFilename, uint32 sizeToRead);
63 void packRecurse();*/
65 /**
66 * Read the header from the bnp file and create a filelist
67 * \param filename (consisting the whole path)
69 bool readHeader (const std::string &filePath);
71 bool writeHeader (const std::string &filePath, uint32 offset);
73 /**
74 * Append the header to a created bnp file
75 * \param filename (consisting the whole path)
77 void appendHeader (const std::string &filename) {}
79 /**
80 * Create a vector of all packed files inside the bnp file
81 * \param reference to the vector, which has to be filled
83 void list (TPackedFilesList& FileList);
85 /**
86 * Create a vector of all file names inside the bnp file
87 * \param reference to the vector, which has to be filled
89 void fileNames( std::vector<std::string>& fileNames );
91 /**
92 * Create a new bnp file
93 * \param string file path
95 void createFile( std::string filePath );
97 /**
98 * Add files to the current aktive bnp file
99 * \param vector of file pathes to add
101 void addFiles( const std::vector<std::string>& filePathes );
104 * Delete files from the current aktive bnp file
105 * \param vector of files names
107 void deleteFiles (const std::vector<std::string>& fileNames);
110 * Unpack the selected packed files into user defined dir
111 * \param directory path, where the files should be unpacked
112 * \param list of files, which has to be unpacked
114 bool unpack (const std::string &dirName, const std::vector<std::string>& fileList);
117 * Compares two filenames
118 * \param left: left packed file
119 * \param right: right packed file
120 * \return: TODO
122 static bool compare(const PackedFile &left, const PackedFile &right);
124 private:
127 * Append one file to an existing bnp file
128 * \param destination: the active bnp file to append the file
129 * \param source: the source file to pack
131 void append( const std::string& destination, const PackedFile& source );
133 TPackedFilesList m_packedFiles;
135 // currently opened and displayed bnp file
136 std::string m_openedBNPFile;
138 // offset where the header of the bnp file begins
139 uint32 m_offsetFromBeginning;
145 #endif