scide: implement selectionLength for openDocument
[supercollider.git] / external_libraries / yaml-cpp-0.3.0 / src / collectionstack.h
blob4a986bc98262a89b66485191eaf7dbc95e7f4d1b
1 #ifndef COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2 #define COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
4 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
5 #pragma once
6 #endif
9 #include <stack>
10 #include <cassert>
12 namespace YAML
14 struct CollectionType {
15 enum value { None, BlockMap, BlockSeq, FlowMap, FlowSeq, CompactMap };
18 class CollectionStack
20 public:
21 CollectionType::value GetCurCollectionType() const {
22 if(collectionStack.empty())
23 return CollectionType::None;
24 return collectionStack.top();
27 void PushCollectionType(CollectionType::value type) { collectionStack.push(type); }
28 void PopCollectionType(CollectionType::value type) { assert(type == GetCurCollectionType()); collectionStack.pop(); }
30 private:
31 std::stack<CollectionType::value> collectionStack;
35 #endif // COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66