Stroika Library 3.0d20
 
Loading...
Searching...
No Matches
Archive/Writer.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_DataExchange_Archive_Writer_h_
5#define _Stroika_Foundation_DataExchange_Archive_Writer_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
11
12/**
13 * \file
14 *
15 * \note Code-Status: <a href="Code-Status.md#Alpha">Alpha</a>
16 */
17
18namespace Stroika::Foundation::DataExchange::Archive::Writer {
19
20 using Characters::String;
21 using Memory::BLOB;
22
23 /**
24 * Abstraction for Writers that maps collections of files to a binary stream format (like zipfile)
25 * SUPER simplistic for now (no depth/hierarchy, no editing functions - just create and append).
26 */
27
28 class IRep;
29
30 class Ptr {
31 protected:
32 public:
33 Ptr () = delete;
34 Ptr (const Ptr&) = delete;
35 Ptr (Ptr&& src);
36 explicit Ptr (const shared_ptr<IRep>& rep);
37 Ptr& operator= (const Ptr&) = delete;
38
39 public:
40 /**
41 */
42 nonvirtual void Add (const String& fileName, const BLOB& data);
43
44 protected:
45 nonvirtual IRep& _GetRep ();
46 nonvirtual const IRep& _GetRep () const;
47
48 private:
49 shared_ptr<IRep> fRep_;
50 };
51
52 /**
53 */
54 class IRep {
55 public:
56 virtual ~IRep () = default;
57 virtual void Add (const String& fileName, const span<const byte>& data) = 0;
58 };
59
60}
61
62/*
63 ********************************************************************************
64 ***************************** Implementation Details ***************************
65 ********************************************************************************
66 */
67#include "Writer.inl"
68
69#endif /*_Stroika_Foundation_DataExchange_Archive_Writer_h_*/