diff options
| author | robot-piglet <[email protected]> | 2023-12-01 16:59:11 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2023-12-01 19:54:31 +0300 |
| commit | 3715aa9254f65ae1058290101351a72a6d3a67d4 (patch) | |
| tree | 9ac5a1cdab42dfc7cd095a06a362e0681cb1482f /contrib/libs/antlr4_cpp_runtime/src/support/BitSet.h | |
| parent | b20a8c04fb7e595955ca9d1b943033342b6580cb (diff) | |
Intermediate changes
Diffstat (limited to 'contrib/libs/antlr4_cpp_runtime/src/support/BitSet.h')
| -rw-r--r-- | contrib/libs/antlr4_cpp_runtime/src/support/BitSet.h | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/contrib/libs/antlr4_cpp_runtime/src/support/BitSet.h b/contrib/libs/antlr4_cpp_runtime/src/support/BitSet.h deleted file mode 100644 index bb30364be08..00000000000 --- a/contrib/libs/antlr4_cpp_runtime/src/support/BitSet.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -#pragma once - -#include "antlr4-common.h" - -namespace antlrcpp { - - class ANTLR4CPP_PUBLIC BitSet : public std::bitset<2048> { - public: - size_t nextSetBit(size_t pos) const { - for (size_t i = pos; i < size(); i++){ - if (test(i)) { - return i; - } - } - - return INVALID_INDEX; - } - - // Prints a list of every index for which the bitset contains a bit in true. - friend std::wostream& operator << (std::wostream& os, const BitSet& obj) - { - os << "{"; - size_t total = obj.count(); - for (size_t i = 0; i < obj.size(); i++){ - if (obj.test(i)){ - os << i; - --total; - if (total > 1){ - os << ", "; - } - } - } - - os << "}"; - return os; - } - - static std::string subStringRepresentation(const std::vector<BitSet>::iterator &begin, - const std::vector<BitSet>::iterator &end) { - std::string result; - std::vector<BitSet>::iterator vectorIterator; - - for (vectorIterator = begin; vectorIterator != end; vectorIterator++) { - result += vectorIterator->toString(); - } - // Grab the end - result += end->toString(); - - return result; - } - - std::string toString() const { - std::stringstream stream; - stream << "{"; - bool valueAdded = false; - for (size_t i = 0; i < size(); ++i){ - if (test(i)){ - if (valueAdded) { - stream << ", "; - } - stream << i; - valueAdded = true; - } - } - - stream << "}"; - return stream.str(); - } - - }; -} |
