Beispiel #1
0
	const_iterator begin() const
	{
		const_iterator::iterator_type start = _ranges.begin(), end = _ranges.begin();
		if(end != _ranges.end())
			++end;
		return const_iterator(_ranges.end(), start, end);
	}
Beispiel #2
0
 shared_ptr<CallingRange> RepositoryXL::getCallingRange() {
     string callerName = FunctionCall::instance().callerName();
     if (callerName == "VBA") {
         // Called from VBA - check whether the corresponding calling range
         // object exists and create it if not.
         RangeMap::const_iterator i = callingRanges_.find(callerName);
         if (i == callingRanges_.end()) {
             shared_ptr<CallingRange> callingRange(new CallingRange);
             callingRanges_[callingRange->key()] = callingRange;
             return callingRange;
         } else {
             return i->second;
         }
         // Called from a worksheet formula
     } else if (callerName.empty()) {
         // Calling range not yet named - create a new CallingRange object
         shared_ptr<CallingRange> callingRange(new CallingRange);
         callingRanges_[callingRange->key()] = callingRange;
         return callingRange;
     } else {
         // Calling range already named - return associated CallingRange object
         RangeMap::const_iterator i = callingRanges_.find(callerName);
         OH_REQUIRE(i != callingRanges_.end(), "No calling range named " << callerName);
         return i->second;
     }
 }
Beispiel #3
0
    void RepositoryXL::dump(std::ostream& out) {
        Repository::dump(out);

        out << endl << "calling ranges:";
        if (callingRanges_.empty()) {
            out << " none." << endl;
        } else {
            out << endl << endl;
            for (RangeMap::const_iterator i = callingRanges_.begin();
                i != callingRanges_.end(); ++i) {
                    out << i->second;
            }
        }

        out << endl << "Error messages:";
        if (errorMessageMap_.empty()) {
            out << " none." << endl;
        } else {
            out << endl << endl;
            for (ErrorMessageMap::const_iterator i = errorMessageMap_.begin();
                i != errorMessageMap_.end(); ++i) {
                    out << std::left << std::setw(50) << i->first << i->second->errorMessage() << endl;
            }
        }

        out << endl << endl << "VBA error message: " << vbaError_ << endl;
    }
Beispiel #4
0
bool rangeBasedShouldSuppress(int beginLine, clang::ASTContext &context, oclint::RuleBase *rule)
{
    std::string filePath = getMainFilePath(context);
    auto commentRangesIt = rangeMapping.find(filePath);
    RangeSet commentRanges;
    if (commentRangesIt == rangeMapping.end())
    {
        DeclAnnotationRangeCollector annotationCollector;
        commentRanges = annotationCollector.collect(context, rule);
        rangeMapping[filePath] = commentRanges;
    }
    else
    {
        commentRanges = commentRangesIt->second;
    }

    for (const auto& range : commentRanges)
    {
        if (beginLine >= range.first && beginLine <= range.second)
        {
            return true;
        }
    }

    return false;
}
Beispiel #5
0
	void add(value_type start, value_type end)
	{
		if(end <= start)
			return;
		// dirty list represents ranges with alternate elements: start,end,start,end 
		// to insert a new range:
		// find insert point of start. find element before, if it is a start element then it is the start of the new range
		// otherwise the new insertion is
		// find insert point of end. find element after, if it is an end element then it is the end of the new range
		// otherwise the new insertion is
		std::pair<RangeMap::iterator, bool> sloc = _ranges.insert(RangeRec(start, true));

		if(sloc.first != _ranges.begin())
		{
			RangeMap::iterator prev = sloc.first; prev--;
			if(prev->start)
			{
				sloc.first--;
			}
		}
		std::pair<RangeMap::iterator, bool> eloc = _ranges.insert(RangeRec(end, false));
		RangeMap::iterator next = eloc.first; next++;

		if(next != _ranges.end() && !next->start)
		{
			eloc.first++;
		}

		// erase the interior of the range
		++sloc.first;
		if(sloc.first != eloc.first && sloc.first != _ranges.end())
		{
			//eloc.first;
			if(sloc.first != eloc.first)
				_ranges.erase(sloc.first, eloc.first);
			else
				_ranges.erase(sloc.first);
		}
		assert((_ranges.size() - 1) % 2 != 0);
	}
Beispiel #6
0
    void RepositoryXL::collectGarbage(const bool &deletePermanent) {

        RangeMap::iterator i = callingRanges_.begin();
        while (i != callingRanges_.end()) {
            shared_ptr<CallingRange> callingRange = i->second;
            if (callingRange->valid()) {
                ++i;
            } else {
                callingRange->clearResidentObjects(deletePermanent);
                if (callingRange->empty())
                    callingRanges_.erase(i++);
                else
                    ++i;
            }
        }
    }
Beispiel #7
0
	const_iterator end() const
	{
		return const_iterator(_ranges.end(), _ranges.end(), _ranges.end());
	}
Beispiel #8
0
	iterator end()
	{
		return iterator(_ranges.end(), _ranges.end(), _ranges.end());
	}