mirror of
				https://github.com/Laupetin/OpenAssetTools.git
				synced 2025-10-30 18:17:15 +00:00 
			
		
		
		
	Skip until first non empty line for templater
This commit is contained in:
		
							
								
								
									
										40
									
								
								src/Parser/Parsing/Impl/SkipUntilFirstNonEmptyProxy.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/Parser/Parsing/Impl/SkipUntilFirstNonEmptyProxy.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| #include "SkipUntilFirstNonEmptyProxy.h" | ||||
|  | ||||
| SkipUntilFirstNonEmptyProxy::SkipUntilFirstNonEmptyProxy(IParserLineStream* stream) | ||||
|     : m_stream(stream), | ||||
|       m_had_non_empty(false) | ||||
| { | ||||
| } | ||||
|  | ||||
| ParserLine SkipUntilFirstNonEmptyProxy::NextLine() | ||||
| { | ||||
|     auto line = m_stream->NextLine(); | ||||
|     if (!m_had_non_empty) | ||||
|     { | ||||
|         while (line.m_line.empty() && !m_stream->Eof()) | ||||
|             line = m_stream->NextLine(); | ||||
|         m_had_non_empty = true; | ||||
|     } | ||||
|  | ||||
|     return line; | ||||
| } | ||||
|  | ||||
| bool SkipUntilFirstNonEmptyProxy::IncludeFile(const std::string& filename) | ||||
| { | ||||
|     return m_stream->IncludeFile(filename); | ||||
| } | ||||
|  | ||||
| void SkipUntilFirstNonEmptyProxy::PopCurrentFile() | ||||
| { | ||||
|     m_stream->PopCurrentFile(); | ||||
| } | ||||
|  | ||||
| bool SkipUntilFirstNonEmptyProxy::IsOpen() const | ||||
| { | ||||
|     return m_stream->IsOpen(); | ||||
| } | ||||
|  | ||||
| bool SkipUntilFirstNonEmptyProxy::Eof() const | ||||
| { | ||||
|     return m_stream->Eof(); | ||||
| } | ||||
							
								
								
									
										19
									
								
								src/Parser/Parsing/Impl/SkipUntilFirstNonEmptyProxy.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/Parser/Parsing/Impl/SkipUntilFirstNonEmptyProxy.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "Parsing/IParserLineStream.h" | ||||
|  | ||||
| class SkipUntilFirstNonEmptyProxy final : public IParserLineStream | ||||
| { | ||||
| public: | ||||
|     explicit SkipUntilFirstNonEmptyProxy(IParserLineStream* stream); | ||||
|  | ||||
|     ParserLine NextLine() override; | ||||
|     bool IncludeFile(const std::string& filename) override; | ||||
|     void PopCurrentFile() override; | ||||
|     _NODISCARD bool IsOpen() const override; | ||||
|     _NODISCARD bool Eof() const override; | ||||
|  | ||||
| private: | ||||
|     IParserLineStream* const m_stream; | ||||
|     bool m_had_non_empty; | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user