| 
									
										
										
										
											2018-07-08 02:41:44 +08:00
										 |  |  | #include "..\e2dtool.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | e2d::Resource::Resource(const String & fileName) | 
					
						
							|  |  |  | 	: _isResource(false) | 
					
						
							|  |  |  | 	, _fileName(fileName) | 
					
						
							|  |  |  | 	, _resNameId(0) | 
					
						
							|  |  |  | 	, _resType() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-16 22:11:27 +08:00
										 |  |  | e2d::Resource::Resource(size_t resNameId, const String & resType) | 
					
						
							| 
									
										
										
										
											2018-07-08 02:41:44 +08:00
										 |  |  | 	: _isResource(true) | 
					
						
							|  |  |  | 	, _fileName() | 
					
						
							|  |  |  | 	, _resNameId(resNameId) | 
					
						
							|  |  |  | 	, _resType(resType) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool e2d::Resource::isResource() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return _isResource; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const e2d::String & e2d::Resource::getFileName() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return _fileName; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-16 22:11:27 +08:00
										 |  |  | size_t e2d::Resource::getResNameId() const | 
					
						
							| 
									
										
										
										
											2018-07-08 02:41:44 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	return _resNameId; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const e2d::String & e2d::Resource::getResType() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return _resType; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-16 22:11:27 +08:00
										 |  |  | size_t e2d::Resource::getKey() const | 
					
						
							| 
									
										
										
										
											2018-07-08 02:41:44 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-07-16 22:11:27 +08:00
										 |  |  | 	return _isResource ? _resNameId : _fileName.getHashCode(); | 
					
						
							| 
									
										
										
										
											2018-07-08 02:41:44 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool e2d::Resource::operator>(const Resource &res) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return this->getKey() > res.getKey(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool e2d::Resource::operator>=(const Resource &res) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return this->getKey() >= res.getKey(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool e2d::Resource::operator<(const Resource &res) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return this->getKey() < res.getKey(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool e2d::Resource::operator<=(const Resource &res) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return this->getKey() <= res.getKey(); | 
					
						
							|  |  |  | } |