Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
c5721c306This file is pinned to the selected release. Download the original to open it in your design tool.
// Filter.cpp
// Copyright (c) 2022, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.
#include "stdafx.h"
#include "Filter.h"
CFilter::CFilter(int type, bool empty_means_none):m_empty_means_none(empty_means_none)
{
AddType(type);
}
bool CFilter::IsTypeInFilter(int type)const{
if (type == 0)return false;
if (m_types.size() == 0)return !m_empty_means_none;
return (m_types.find(type) != m_types.end());
}
ostream & operator<<(ostream &os, const CFilter &f)
{
if (f.m_types.size() == 0)
{
if (f.m_empty_means_none)
os << "allow none";
else
os << "allow all";
}
else
{
int i = 0;
for (std::set<int>::iterator It = f.m_types.begin(); ; It++, i++)
{
if (i > 5)
{
os << "...";
break;
}
if (It == f.m_types.end())break;
int t = *It;
if (i > 0)
os << " ";
os << t;
}
}
return os;
}