aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/raw_pdb/src/PDB_NamesStream.h
blob: c305242a50fd45ad34626ab8b33fced0c2d47f03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)

#pragma once

#include "Foundation/PDB_Macros.h"
#include "PDB_Types.h"
#include "PDB_CoalescedMSFStream.h"


namespace PDB
{
	class RawFile;

	struct NamesHeader
	{
		uint32_t magic;
		uint32_t hashVersion;
		uint32_t size;
	};

	class PDB_NO_DISCARD NamesStream
	{
	public:
		NamesStream(void) PDB_NO_EXCEPT;
		explicit NamesStream(const RawFile& file, uint32_t streamIndex) PDB_NO_EXCEPT;

		PDB_DEFAULT_MOVE(NamesStream);

		// Returns the header of the stream.
		PDB_NO_DISCARD inline const NamesHeader* GetHeader(void) const PDB_NO_EXCEPT
		{
			return m_header;
		}

		PDB_NO_DISCARD inline const char* GetFilename(uint32_t filenameOffset) const PDB_NO_EXCEPT
		{
			return m_stringTable + filenameOffset;
		}

	private:
		CoalescedMSFStream m_stream;
		const NamesHeader* m_header;
		const char* m_stringTable;

		PDB_DISABLE_COPY(NamesStream);
	};
}