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
/********************************************************************
*
*	Created:	8/4/2014   14:59
*
*	File:		fsCNameComponent.h
*
*	Author:		Mick Waites
*	
*	Purpose:	Calculates and stores information about a HOG entity
*				based on the name of the entity.
*
*********************************************************************/

#ifndef fsCNameComponenthdr
#define fsCNameComponenthdr

#include <fsCore/src/fsCUniqueId.h>

#include <fsAppCore/src/components/fsIComponent.h>


class fsCNameComponent : public fsIComponent
{
	friend class fsCComponentFactory;

public:

	static fsCNameComponent* get(const fsCEntity* pEntity);
	static fsCNameComponent* get(const fsIComponent* pComponent);

	static fsStr localisedNameCalculate(const fsStr& pLayerName);
	static fsStr nameSansSuffixCalculate(const fsStr& pLayerName);
	static fsStr nameSansPrefixCalculate(const fsStr& pLayerName);

	const fsStr& nameSansSuffixGet() const;
	const fsStr& nameSansPrefixGet() const;
	const fsStr& localisedNameGet() const;

	static const fsChar mHiddenPrefix;
	static const fsChar mVisiblePrefix;
	static const fsStr mTaskChar;
	static const fsCUniqueId mTypeId;

protected:

	static fsIComponent* create(fsCEntity* pParent);

	fsCNameComponent(fsCEntity* pParent);
	virtual ~fsCNameComponent();<--- Destructor in derived class

	fsStr mFullName;
	fsStr mStrippedName;
	fsStr mLocalisedName;

private:

	void initialise();

	static void localisedNameCalculate(const fsStr& pFullName, const fsStr& pStrippedName, fsStr& pLocalisedName);
};

#endif