mirror of
				https://github.com/Laupetin/OpenAssetTools.git
				synced 2025-10-31 10:36:58 +00:00 
			
		
		
		
	Make skipping lines in defines stream proxy configurable
This commit is contained in:
		| @@ -122,8 +122,9 @@ void DefinesStreamProxy::Define::IdentifyParameters(const std::vector<std::strin | ||||
|     } | ||||
| } | ||||
|  | ||||
| DefinesStreamProxy::DefinesStreamProxy(IParserLineStream* stream) | ||||
| DefinesStreamProxy::DefinesStreamProxy(IParserLineStream* stream, const bool skipDirectiveLines) | ||||
|     : m_stream(stream), | ||||
|       m_skip_directive_lines(skipDirectiveLines), | ||||
|       m_ignore_depth(0), | ||||
|       m_in_define(false) | ||||
| { | ||||
| @@ -668,10 +669,22 @@ ParserLine DefinesStreamProxy::NextLine() | ||||
|         if (m_in_define) | ||||
|         { | ||||
|             ContinueDefine(line); | ||||
|             if (!m_skip_directive_lines) | ||||
|             { | ||||
|                 line.m_line = std::string(); | ||||
|                 return line; | ||||
|             } | ||||
|  | ||||
|             line = m_stream->NextLine(); | ||||
|         } | ||||
|         else if (MatchDirectives(line) || !m_modes.empty() && m_modes.top() != BlockMode::IN_BLOCK) | ||||
|         { | ||||
|             if (!m_skip_directive_lines) | ||||
|             { | ||||
|                 line.m_line = std::string(); | ||||
|                 return line; | ||||
|             } | ||||
|  | ||||
|             line = m_stream->NextLine(); | ||||
|         } | ||||
|         else | ||||
|   | ||||
| @@ -54,6 +54,7 @@ private: | ||||
|     }; | ||||
|  | ||||
|     IParserLineStream* const m_stream; | ||||
|     const bool m_skip_directive_lines; | ||||
|     std::map<std::string, Define> m_defines; | ||||
|     std::stack<BlockMode> m_modes; | ||||
|     unsigned m_ignore_depth; | ||||
| @@ -79,7 +80,7 @@ private: | ||||
|     bool FindDefineForWord(const ParserLine& line, unsigned wordStart, unsigned wordEnd, Define*& value); | ||||
|  | ||||
| public: | ||||
|     explicit DefinesStreamProxy(IParserLineStream* stream); | ||||
|     DefinesStreamProxy(IParserLineStream* stream, bool skipDirectiveLines = false); | ||||
|  | ||||
|     void AddDefine(Define define); | ||||
|     void Undefine(const std::string& name); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user