summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/src/ChunkStack.h
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-05-19 16:22:10 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-05-19 19:14:52 +0900
commit71fb4a139179e9d27070f7f3e98971e3e029697f (patch)
tree92fbf03f1e546b3c99e6e06e98100b6ef8e4e2c6 /debian/uncrustify-trinity/uncrustify-trinity-0.73.0/src/ChunkStack.h
parent6eae1a16a1001287ef5129db86f4ef2145ace3ca (diff)
downloadextra-dependencies-71fb4a139179e9d27070f7f3e98971e3e029697f.tar.gz
extra-dependencies-71fb4a139179e9d27070f7f3e98971e3e029697f.zip
uncrustify: updated to version 0.73
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.73.0/src/ChunkStack.h')
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.73.0/src/ChunkStack.h123
1 files changed, 123 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/src/ChunkStack.h b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/src/ChunkStack.h
new file mode 100644
index 00000000..8434d895
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/src/ChunkStack.h
@@ -0,0 +1,123 @@
+/**
+ * @file ChunkStack.h
+ * Manages a simple stack of chunks
+ *
+ * @author Ben Gardner
+ * @license GPL v2+
+ */
+#ifndef CHUNKSTACK_H_INCLUDED
+#define CHUNKSTACK_H_INCLUDED
+
+#include "uncrustify_types.h"
+
+class ChunkStack
+{
+public:
+ struct Entry
+ {
+ Entry()
+ : m_seqnum(0)
+ , m_pc(0)
+ {
+ }
+
+
+ Entry(const Entry &ref)
+ : m_seqnum(ref.m_seqnum)
+ , m_pc(ref.m_pc)
+ {
+ }
+
+
+ Entry(size_t sn, chunk_t *pc)
+ : m_seqnum(sn)
+ , m_pc(pc)
+ {
+ }
+
+
+ size_t m_seqnum;
+ chunk_t *m_pc;
+ };
+
+protected:
+ std::deque<Entry> m_cse;
+ size_t m_seqnum; //! current sequence number
+
+public:
+ ChunkStack()
+ : m_seqnum(0)
+ {
+ }
+
+
+ ChunkStack(const ChunkStack &cs)
+ {
+ Set(cs);
+ }
+
+
+ virtual ~ChunkStack()
+ {
+ }
+
+
+ void Set(const ChunkStack &cs);
+
+
+ void Push_Back(chunk_t *pc)
+ {
+ Push_Back(pc, ++m_seqnum);
+ }
+
+
+ bool Empty() const
+ {
+ return(m_cse.empty());
+ }
+
+
+ size_t Len() const
+ {
+ return(m_cse.size());
+ }
+
+
+ const Entry *Top() const;
+
+
+ const Entry *Get(size_t idx) const;
+
+
+ chunk_t *GetChunk(size_t idx) const;
+
+
+ chunk_t *Pop_Back();
+
+
+ void Push_Back(chunk_t *pc, size_t seqnum);
+
+
+ chunk_t *Pop_Front();
+
+
+ void Reset()
+ {
+ m_cse.clear();
+ }
+
+
+ /**
+ * Mark an entry to be removed by Collapse()
+ *
+ * @param idx The item to remove
+ */
+ void Zap(size_t idx);
+
+
+ //! Compresses down the stack by removing dead entries
+ void Collapse();
+};
+
+
+#endif /* CHUNKSTACK_H_INCLUDED */