fs/io/FileReader: add methods GetSize(), GetPosition()
This commit is contained in:
		@@ -89,6 +89,32 @@ public:
 | 
				
			|||||||
	gcc_pure
 | 
						gcc_pure
 | 
				
			||||||
	FileInfo GetFileInfo() const;
 | 
						FileInfo GetFileInfo() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						gcc_pure
 | 
				
			||||||
 | 
						uint64_t GetSize() const {
 | 
				
			||||||
 | 
					#ifdef WIN32
 | 
				
			||||||
 | 
							LARGE_INTEGER size;
 | 
				
			||||||
 | 
							return GetFileSizeEx(handle, &size)
 | 
				
			||||||
 | 
								? size.QuadPart
 | 
				
			||||||
 | 
								: 0;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
							return fd.GetSize();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						gcc_pure
 | 
				
			||||||
 | 
						uint64_t GetPosition() const {
 | 
				
			||||||
 | 
					#ifdef WIN32
 | 
				
			||||||
 | 
							LARGE_INTEGER zero;
 | 
				
			||||||
 | 
							zero.QuadPart = 0;
 | 
				
			||||||
 | 
							LARGE_INTEGER position;
 | 
				
			||||||
 | 
							return SetFilePointerEx(handle, zero, &position, FILE_CURRENT)
 | 
				
			||||||
 | 
								? position.QuadPart
 | 
				
			||||||
 | 
								: 0;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
							return fd.Tell();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void Rewind() {
 | 
						void Rewind() {
 | 
				
			||||||
		Seek(0);
 | 
							Seek(0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user