diff options
author | vng <viktor.govako@gmail.com> | 2010-12-30 00:40:34 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:08:53 +0300 |
commit | e04540f8b6ee9c139a0e8634a3d44c8838488a2e (patch) | |
tree | 721da06b10b1aea52c5e59c4de3d904856cfe91d /coding/file_container.hpp | |
parent | 2d8a35967cad81e51aef9e720de32f318d1c3436 (diff) |
File container compile test.
Diffstat (limited to 'coding/file_container.hpp')
-rw-r--r-- | coding/file_container.hpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/coding/file_container.hpp b/coding/file_container.hpp new file mode 100644 index 0000000000..355517c767 --- /dev/null +++ b/coding/file_container.hpp @@ -0,0 +1,70 @@ +#pragma once +#include "file_reader.hpp" +#include "file_writer.hpp" + +#include "../std/vector.hpp" +#include "../std/string.hpp" + +class FilesContainerBase +{ +protected: + + typedef string Tag; + + struct Info + { + Tag m_tag; + uint64_t m_offset; + uint64_t m_size; + + Info() {} + Info(Tag const & tag, uint64_t offset) : m_tag(tag), m_offset(offset) {} + }; + + struct less_info + { + bool operator() (Info const & t1, Info const & t2) const + { + return (t1.m_tag < t2.m_tag); + } + bool operator() (Info const & t1, Tag const & t2) const + { + return (t1.m_tag < t2); + } + bool operator() (Tag const & t1, Info const & t2) const + { + return (t1 < t2.m_tag); + } + }; + + typedef vector<Info> info_cont_t; + info_cont_t m_info; +}; + +class FilesContainerR : public FilesContainerBase +{ + typedef public FilesContainerBase base_type; + + FileReader m_source; + +public: + FilesContainerR(string const & fName); + + FileReader GetReader(Tag const & tag); +}; + +class FilesContainerW : public FilesContainerBase +{ + typedef public FilesContainerBase base_type; + + string m_name; + + uint64_t SaveCurrentSize(); + +public: + FilesContainerW(string const & fName); + + FileWriter GetWriter(Tag const & tag); + + void Finish(); +}; |