From 3dae696b414d9141b3faa6872f3723332b7b6395 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 19 Jul 2020 21:20:27 +0100 Subject: Remove ProtocolPalettes --- src/Protocol/ProtocolPalettes.h | 63 ----------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 src/Protocol/ProtocolPalettes.h (limited to 'src/Protocol/ProtocolPalettes.h') diff --git a/src/Protocol/ProtocolPalettes.h b/src/Protocol/ProtocolPalettes.h deleted file mode 100644 index fad093a04..000000000 --- a/src/Protocol/ProtocolPalettes.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include "../OSSupport/CriticalSection.h" - - - - - -// fwd: -class BlockTypePalette; - - - - - -/** Loads the protocol-specific palettes on startup and provides them to the individual protocol -instances when they are created. -Uses the data in the $/Server/Protocol folder. Each protocol version has a subfolder there, -containing possibly multiple palette files. All the files are loaded in sequence (alpha-sorted), -into the palette corresponding to the file's extension (*.btp.txt -> BlockTypePalette). -Provides thread safety for the data properly. */ -class ProtocolPalettes -{ -public: - - /** Loads all the per-protocol palettes. - aProtocolFolder is the folder that contains a subfolder for each protocol version; - each subfolder contains the protocol-specific palettes (as in $/Server/Protocol) - If a protocol version is already loaded, yet present in the folder, the newly loaded data is merged - into the current data. - Always succeeds (even when there are no palettes). */ - void load(const AString & aProtocolFolder); - - /** Returns the BlockTypePalette for the specified protocol. - Returns nullptr if no such palette has been loaded. */ - std::shared_ptr blockTypePalette(const AString & aProtocolVersion) const; - - /** Returns the version names of all protocols that have been loaded. */ - std::vector protocolVersions() const; - - -protected: - - /** Container for all palettes for a single protocol. */ - struct Palettes - { - std::shared_ptr mBlockTypePalette; - // TODO: ItemTypePalette - - Palettes(); - }; - - - /** The CS protecting all members against multithreaded access. */ - mutable cCriticalSection mCS; - - /** The map of protocol version -> all its palettes. */ - std::map mPalettes; - - - /** Loads all the palettes from the specified folder into mPalettes under the aProtocolVersion key. */ - void loadSingleVersion(const AString & aProtocolVersion, const AString & aFolder); -}; -- cgit v1.2.3