parserstate.h 988 Bytes
Newer Older
1
2
#pragma once

3
4
5
6
#ifndef PARSERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define PARSERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66


7
8
#include <string>
#include <map>
9
10
#include <stack>
#include <cassert>
11
12
13
14

namespace YAML
{
	struct Version {
15
		bool isDefault;
16
17
		int major, minor;
	};
18
	
19
20
	struct ParserState
	{
21
22
		enum COLLECTION_TYPE { NONE, BLOCK_MAP, BLOCK_SEQ, FLOW_MAP, FLOW_SEQ, COMPACT_MAP };
		
23
		ParserState();
24

25
		const std::string TranslateTagHandle(const std::string& handle) const;
26
27
28
29
		COLLECTION_TYPE GetCurCollectionType() const { if(collectionStack.empty()) return NONE; return collectionStack.top(); }
		
		void PushCollectionType(COLLECTION_TYPE type) { collectionStack.push(type); }
		void PopCollectionType(COLLECTION_TYPE type) { assert(type == GetCurCollectionType()); collectionStack.pop(); }
30
	
31
32
		Version version;
		std::map <std::string, std::string> tags;
33
		std::stack <COLLECTION_TYPE> collectionStack;
34
35
	};
}
36
37

#endif // PARSERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66