summaryrefslogtreecommitdiff
path: root/public/panorama/layout/stylesymbol.h
blob: c94286b63121a2156c2468585bef8c5d86fdb2f6 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//=========== Copyright Valve Corporation, All rights reserved. ===============//
//
// Purpose: 
//=============================================================================//

#ifndef STYLESYMBOL_H
#define STYLESYMBOL_H

#ifdef _WIN32
#pragma once
#endif

#define MAX_PANORAMA_STYLE_SYMBOLS 128

#include "tier0/validator.h"
#include "utlsymbol.h"
#include "utlvector.h"
#ifdef SOURCE_PANORAMA_FIXME
#include "UtlSortVector.h"
#else
#include "utlsortvector.h"
#endif
#include "utlstring.h"


namespace panorama
{

	class CStyleProperty;

	class CStyleSymbol
	{
	public:
		// constructor, destructor
		CStyleSymbol() : m_Id( 0xFF ) {}
		CStyleSymbol( uint8 id ) : m_Id( id ) {}
		CStyleSymbol( char const* pStr );
		CStyleSymbol( char const* pStr, bool bCreateNew );
		CStyleSymbol( CStyleSymbol const& sym ) : m_Id(sym.m_Id) {}

		// operator=
		CStyleSymbol& operator=( CStyleSymbol const& src ) { m_Id = src.m_Id; return *this; }

		// operator==
		bool operator==( CStyleSymbol const& src ) const { return m_Id == src.m_Id; }
		bool operator==( char const* pStr ) const;

		// operator != 
		bool operator!=( CStyleSymbol const& src ) const { return m_Id != src.m_Id; }

		// operator <
		bool operator < (const CStyleSymbol &rhs ) const { return m_Id < rhs.m_Id; }


		uint8 GetID() const { return m_Id; }

		// Is valid?
		bool IsValid() const { return m_Id != 0xFF; }

		// Gets the string associated with the symbol
		char const* String() const;

		operator const char *() const { return String(); }

	protected:
		uint8   m_Id;
	};

	uint32 HashItem( const CStyleSymbol &item );

} // namespace panorama

#endif // STYLESYMBOL_H