bit7z 4.0.0
A C++ library for interfacing with the 7-zip shared libs.
Loading...
Searching...
No Matches
bitpropvariant.hpp
1/*
2 * bit7z - A C++ static library to interface with the 7-zip shared libraries.
3 * Copyright (c) 2014-2023 Riccardo Ostani - All Rights Reserved.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef BITPROPVARIANT_HPP
11#define BITPROPVARIANT_HPP
12
13#include <chrono>
14#include <cstdint>
15
16#include "bitdefines.hpp"
17#include "bittypes.hpp"
18#include "bitwindows.hpp"
19
20namespace bit7z {
21
26
30enum struct BitProperty : PROPID {
31 NoProperty = 0,
32 MainSubfile,
33 HandlerItemIndex,
34 Path,
35 Name,
36 Extension,
37 IsDir,
38 Size,
39 PackSize,
40 Attrib,
41 CTime,
42 ATime,
43 MTime,
44 Solid,
45 Commented,
46 Encrypted,
47 SplitBefore,
48 SplitAfter,
49 DictionarySize,
50 CRC,
51 Type,
52 IsAnti,
53 Method,
54 HostOS,
55 FileSystem,
56 User,
57 Group,
58 Block,
59 Comment,
60 Position,
61 Prefix,
62 NumSubDirs,
63 NumSubFiles,
64 UnpackVer,
65 Volume,
66 IsVolume,
67 Offset,
68 Links,
69 NumBlocks,
70 NumVolumes,
71 TimeType,
72 Bit64,
73 BigEndian,
74 Cpu,
75 PhySize,
76 HeadersSize,
77 Checksum,
78 Characts,
79 Va,
80 Id,
81 ShortName,
82 CreatorApp,
83 SectorSize,
84 PosixAttrib,
85 SymLink,
86 Error,
87 TotalSize,
88 FreeSpace,
89 ClusterSize,
90 VolumeName,
91 LocalName,
92 Provider,
93 NtSecure,
94 IsAltStream,
95 IsAux,
96 IsDeleted,
97 IsTree,
98 Sha1,
99 Sha256,
100 ErrorType,
101 NumErrors,
102 ErrorFlags,
103 WarningFlags,
104 Warning,
105 NumStreams,
106 NumAltStreams,
107 AltStreamsSize,
108 VirtualSize,
109 UnpackSize,
110 TotalPhySize,
111 VolumeIndex,
112 SubType,
113 ShortComment,
114 CodePage,
115 IsNotArcType,
116 PhySizeCantBeDetected,
117 ZerosTailIsAllowed,
118 TailSize,
119 EmbeddedStubSize,
120 NtReparse,
121 HardLink,
122 INode,
123 StreamId,
124 ReadOnly,
125 OutName,
126 CopyLink
127};
128
132enum struct BitPropVariantType : uint32_t {
133 Empty,
134 Bool,
135 String,
136 UInt8,
137 UInt16,
138 UInt32,
139 UInt64,
140 Int8,
141 Int16,
142 Int32,
143 Int64,
144 FileTime
145};
146
150struct BitPropVariant final : public PROPVARIANT {
155
162
168 BitPropVariant( BitPropVariant&& other ) noexcept;
169
175 explicit BitPropVariant( bool value ) noexcept;
176
182 explicit BitPropVariant( const wchar_t* value );
183
189 explicit BitPropVariant( const std::wstring& value );
190
196 explicit BitPropVariant( uint8_t value ) noexcept;
197
203 explicit BitPropVariant( uint16_t value ) noexcept;
204
210 explicit BitPropVariant( uint32_t value ) noexcept;
211
217 explicit BitPropVariant( uint64_t value ) noexcept;
218
224 explicit BitPropVariant( int8_t value ) noexcept;
225
231 explicit BitPropVariant( int16_t value ) noexcept;
232
238 explicit BitPropVariant( int32_t value ) noexcept;
239
245 explicit BitPropVariant( int64_t value ) noexcept;
246
252 explicit BitPropVariant( FILETIME value ) noexcept;
253
260
268 auto operator=( const BitPropVariant& other ) -> BitPropVariant&;
269
277 auto operator=( BitPropVariant&& other ) noexcept -> BitPropVariant&;
278
288 template< typename T >
289 auto operator=( const T& value ) noexcept( std::is_integral< T >::value ) -> BitPropVariant& {
290 *this = BitPropVariant( value );
291 return *this;
292 }
293
298 BIT7Z_NODISCARD auto getBool() const -> bool;
299
304 BIT7Z_NODISCARD auto getString() const -> tstring;
305
310 BIT7Z_NODISCARD auto getNativeString() const -> native_string;
311
316 BIT7Z_NODISCARD auto getUInt8() const -> uint8_t;
317
322 BIT7Z_NODISCARD auto getUInt16() const -> uint16_t;
323
328 BIT7Z_NODISCARD auto getUInt32() const -> uint32_t;
329
334 BIT7Z_NODISCARD auto getUInt64() const -> uint64_t;
335
340 BIT7Z_NODISCARD auto getInt8() const -> int8_t;
341
346 BIT7Z_NODISCARD auto getInt16() const -> int16_t;
347
352 BIT7Z_NODISCARD auto getInt32() const -> int32_t;
353
358 BIT7Z_NODISCARD auto getInt64() const -> int64_t;
359
364 BIT7Z_NODISCARD auto getFileTime() const -> FILETIME;
365
370 BIT7Z_NODISCARD auto getTimePoint() const -> time_type;
371
375 BIT7Z_NODISCARD auto toString() const -> tstring;
376
380 BIT7Z_NODISCARD auto isEmpty() const noexcept -> bool;
381
385 BIT7Z_NODISCARD auto isBool() const noexcept -> bool;
386
390 BIT7Z_NODISCARD auto isString() const noexcept -> bool;
391
395 BIT7Z_NODISCARD auto isUInt8() const noexcept -> bool;
396
400 BIT7Z_NODISCARD auto isUInt16() const noexcept -> bool;
401
405 BIT7Z_NODISCARD auto isUInt32() const noexcept -> bool;
406
410 BIT7Z_NODISCARD auto isUInt64() const noexcept -> bool;
411
415 BIT7Z_NODISCARD auto isInt8() const noexcept -> bool;
416
420 BIT7Z_NODISCARD auto isInt16() const noexcept -> bool;
421
425 BIT7Z_NODISCARD auto isInt32() const noexcept -> bool;
426
430 BIT7Z_NODISCARD auto isInt64() const noexcept -> bool;
431
435 BIT7Z_NODISCARD auto isFileTime() const noexcept -> bool;
436
440 BIT7Z_NODISCARD auto type() const -> BitPropVariantType;
441
445 void clear() noexcept;
446
447 private:
448 void internalClear() noexcept;
449
450 friend auto operator==( const BitPropVariant& lhs, const BitPropVariant& rhs ) noexcept -> bool;
451
452 friend auto operator!=( const BitPropVariant& lhs, const BitPropVariant& rhs ) noexcept -> bool;
453};
454
455auto operator==( const BitPropVariant& lhs, const BitPropVariant& rhs ) noexcept -> bool;
456
457auto operator!=( const BitPropVariant& lhs, const BitPropVariant& rhs ) noexcept -> bool;
458
459} // namespace bit7z
460
461#endif // BITPROPVARIANT_HPP
The main namespace of the bit7z library.
Definition bit7zlibrary.hpp:30
BitProperty
The BitProperty enum represents the archive/item properties that 7-zip can read or write.
Definition bitpropvariant.hpp:30
BitPropVariantType
The BitPropVariantType enum represents the possible types that a BitPropVariant can store.
Definition bitpropvariant.hpp:132
@ String
String BitPropVariant type.
@ Int16
16-bit signed int BitPropVariant type
@ FileTime
FILETIME BitPropVariant type.
@ Int8
8-bit signed int BitPropVariant type
@ UInt16
16-bit unsigned int BitPropVariant type
@ UInt64
64-bit unsigned int BitPropVariant type
@ UInt8
8-bit unsigned int BitPropVariant type
@ Int32
32-bit signed int BitPropVariant type
@ Bool
Boolean BitPropVariant type.
@ Empty
Empty BitPropVariant type.
@ UInt32
32-bit unsigned int BitPropVariant type
@ Int64
64-bit signed int BitPropVariant type
The BitPropVariant struct is a light extension to the WinAPI PROPVARIANT struct providing useful gett...
Definition bitpropvariant.hpp:150
void clear() noexcept
Clears the current value of the variant object.
auto getTimePoint() const -> time_type
auto getInt8() const -> int8_t
auto isInt8() const noexcept -> bool
auto isString() const noexcept -> bool
auto isInt64() const noexcept -> bool
auto getFileTime() const -> FILETIME
BitPropVariant(int16_t value) noexcept
Constructs a 16-bit integer BitPropVariant.
auto getBool() const -> bool
BitPropVariant(uint32_t value) noexcept
Constructs a 32-bit unsigned integer BitPropVariant.
BitPropVariant(FILETIME value) noexcept
Constructs a FILETIME BitPropVariant.
auto toString() const -> tstring
BitPropVariant(uint16_t value) noexcept
Constructs a 16-bit unsigned integer BitPropVariant.
BitPropVariant(uint8_t value) noexcept
Constructs an 8-bit unsigned integer BitPropVariant.
auto getString() const -> tstring
BitPropVariant()
Constructs an empty BitPropVariant object.
auto operator=(const T &value) noexcept(std::is_integral< T >::value) -> BitPropVariant &
Assignment operator.
Definition bitpropvariant.hpp:289
auto isUInt32() const noexcept -> bool
auto isInt16() const noexcept -> bool
auto getUInt32() const -> uint32_t
auto isBool() const noexcept -> bool
~BitPropVariant()
BitPropVariant destructor.
auto getInt16() const -> int16_t
BitPropVariant(int8_t value) noexcept
Constructs an 8-bit integer BitPropVariant.
auto getNativeString() const -> native_string
auto getUInt16() const -> uint16_t
BitPropVariant(int32_t value) noexcept
Constructs a 32-bit integer BitPropVariant.
auto getUInt8() const -> uint8_t
auto type() const -> BitPropVariantType
auto getUInt64() const -> uint64_t
BitPropVariant(int64_t value) noexcept
Constructs a 64-bit integer BitPropVariant.
BitPropVariant(const std::wstring &value)
Constructs a string BitPropVariant from a wstring.
auto isUInt64() const noexcept -> bool
auto isInt32() const noexcept -> bool
BitPropVariant(uint64_t value) noexcept
Constructs a 64-bit unsigned integer BitPropVariant.
auto isUInt8() const noexcept -> bool
auto isEmpty() const noexcept -> bool
auto getInt32() const -> int32_t
auto operator=(BitPropVariant &&other) noexcept -> BitPropVariant &
Move assignment operator.
auto getInt64() const -> int64_t
BitPropVariant(BitPropVariant &&other) noexcept
Move constructs this BitPropVariant from another one.
BitPropVariant(const wchar_t *value)
Constructs a string BitPropVariant from a null-terminated C wide string.
BitPropVariant(const BitPropVariant &other)
Copy constructs this BitPropVariant from another one.
auto isFileTime() const noexcept -> bool
auto operator=(const BitPropVariant &other) -> BitPropVariant &
Copy assignment operator.
auto isUInt16() const noexcept -> bool
BitPropVariant(bool value) noexcept
Constructs a boolean BitPropVariant.