Example #1
0
void
Decoder::decodeTags(ByteStream& strm, TagSet& tags)
{
	//M_ASSERT(strm.remaining());

	mstl::string name;
	mstl::string value;

	for (tag::ID id = tag::ID(strm.get()); id; id = tag::ID(strm.get()))
	{
		if (id == tag::ExtraTag)
		{
			name.clear();
			value.clear();
			strm.get(name);
			strm.get(value);
			tags.setExtra(name, value);
		}
		else
		{
			value.clear();
			strm.get(value);
			tags.set(id, value);

			if (tag::isRatingTag(id))
				tags.setSignificance(id, 0);
		}

#define SCI_TAGS_FIX
#ifdef SCI_TAGS_FIX
		if (strm.remaining() == 0)
			return;
#endif
	}
}
Example #2
0
QValidator::State TagValidator::validate(QString& input, int &pos) const
{
	Q_UNUSED(pos);

	QString str = input.trimmed();

	if(str.length()==0)
		return Acceptable;


	TagSet ts = TagSet::parse(str);
	for(int i=0;i<=ts.sets();++i) {
		foreach(const QString& tag, ts.tags(i)) {
			// A tag name cannot start with ":" because that is reserved for
			// pseudo tags
			if(tag.at(0)==':')
				return Invalid;

			// A tag name cannot contain any of the separator characters
			for(int j=0;j<tag.length();++j) {
				QChar chr = tag.at(j);
				for(unsigned int k=0;k<sizeof(BADCHARS);++k) {
					if(chr==BADCHARS[k])
						return Invalid;
				}
			}
		}
	}

	return Acceptable;
}
Example #3
0
save::State
Decoder::doDecoding(db::Consumer& consumer, TagSet& tags)
{
	uint16_t flags	= m_strm.uint16();
	uint16_t idn	= flags & 0x0fff;

	if (idn)
	{
		m_position.setup(idn);
	}
	else
	{
		mstl::string fen;
		m_strm.get(fen);
		m_position.setup(fen);
		tags.set(tag::SetUp, "1");	// bad PGN design
		tags.set(tag::Fen, fen);
	}

	if (!consumer.startGame(tags, m_position.board()))
		return save::UnsupportedVariant;

	Byte* dataSection = m_strm.base() + m_strm.uint24();
	ByteStream text, data;

	if (flags & 0x8000)
	{
		unsigned size = ByteStream::uint24(dataSection);

		text.setup(dataSection + 3, size);
		data.setup(text.end(), m_strm.end());
	}
	else
	{
		data.setup(dataSection, m_strm.end());
	}

	if (flags & 0x7000)
	{
		EngineList engines;
		decodeEngines(data, engines);
		consumer.swapEngines(engines);
	}

	consumer.startMoveSection();
	decodeRun(m_strm.uint16(), consumer);
	decodeVariation(consumer, data, text);
	consumer.finishMoveSection(result::fromString(tags.value(tag::Result)));

	if (data.remaining())
		decodeTags(data, tags);

	return consumer.finishGame(tags);
}
	void splitTags(const string &tagString, TagSet &tagSet) {
		stringstream ss(tagString);
		string tag;
		while(getline(ss, tag, ',')) {
			tagSet.insert(tag);
		}
	}
Example #5
0
save::State
Consumer::endGame(TagSet const& tags)
{
	TagSet const* tagSet = &tags;
	TagSet* myTags = 0;

	if (m_text.tellp() > 0 && m_lastCommentPos == plyCount() && !tags.contains(tag::Termination))
	{
		result::ID result = result::fromString(tags.value(tag::Result));

		if (result == result::White || result == result::Black)
		{
			Byte const* s = m_text.data() + m_text.tellp() - 1;

			while (s > m_text.base() && s[-1])
				--s;

			if (	::strcasecmp(reinterpret_cast<char const*>(s), "time") == 0
				|| ::strcasecmp(reinterpret_cast<char const*>(s), "time/") == 0
				|| ::strcasecmp(reinterpret_cast<char const*>(s), "time!") == 0
				|| ::strcasecmp(reinterpret_cast<char const*>(s), "time forfeit") == 0)
			{
				myTags = new TagSet(tags);
				myTags->set(tag::Termination, termination::toString(termination::TimeForfeit));
				tagSet = myTags;
			}
		}
	}

	unsigned dataOffset = m_strm.tellp();

	encodeTextSection();
	encodeDataSection(engines());
	encodeTags(*tagSet, allowedTags(), allowExtraTags());
	ByteStream::set(m_strm.base() + m_streamPos, uint24_t(dataOffset));

	m_stream.provide();
	save::State state = m_codec.addGame(m_stream, *tagSet, *this);

	if (myTags)
		delete myTags;

	return state;
}
Example #6
0
void BooksUtil::collectTagsFromLibrary(TagList &tags) {
	const TagList &lTags = Library::Instance().tags();
	TagSet tagSet;

	for (TagList::const_iterator it = lTags.begin(); it != lTags.end(); ++it) {
		shared_ptr<Tag> tag = *it;
		if (tag.isNull()) {
			tagSet.insert(tag);
			tags.push_back(tag);
		} else {
			TagList tagStack;
			do {
				tagStack.push_back(tag);
				tag = tag->parent();
			} while (!tag.isNull() && tagSet.find(tag) == tagSet.end());
			tagSet.insert(tagStack.begin(), tagStack.end());
			tags.insert(tags.end(), tagStack.rbegin(), tagStack.rend());
		}
	}
}
Example #7
0
void
Node::visit(Visitor& visitor, List const& nodes, TagSet const& tags)
{
	result::ID result = result::fromString(tags.value(tag::Result));

	visitor.start(result);

	for (unsigned i = 0; i < nodes.size(); ++i)
		nodes[i]->visit(visitor);

	visitor.finish(result);
}
Example #8
0
bool ClassHandler::init(Core::BaseObject *obj, void *n, TagSet &mandatory) {
	xmlNodePtr node = reinterpret_cast<xmlNodePtr>(n);

	// Fill in mandatory tags
	for ( MemberList::iterator it = attributes.begin();
	      it != attributes.end(); ++it ) {
		if ( !it->optional ) mandatory.insert(it->tag);
	}

	for ( MemberList::iterator it = elements.begin();
	      it != elements.end(); ++it ) {
		if ( !it->optional && !it->tag.empty() ) mandatory.insert(it->tag);
	}

	for ( MemberList::iterator it = childs.begin();
	      it != childs.end(); ++it ) {
		if ( !it->optional && !it->tag.empty() ) mandatory.insert(it->tag);
	}

	if ( cdataUsed )
		cdata.get(obj, n, this);

	if ( attributes.empty() ) return true;

	for ( xmlAttrPtr attr = node->properties; attr != NULL; attr = attr->next ) {
		if ( attr->children ) {
			for ( MemberList::iterator it = attributes.begin();
			      it != attributes.end(); ++it ) {
				if ( equalsTag(attr, it->tag.c_str(), it->nameSpace.c_str()) ) {
					if ( it->get(obj, attr, this) && !it->optional ) {
						mandatory.erase(it->tag);
						break;
					}
				}
			}
		}
	}

	return true;
}
// Disabled because Baloo does not work like Nepomuk: it does not create tags
// independently of files.
void SemanticInfoBackEndTest::testTagForLabel()
{
    QSignalSpy spy(mBackEnd, SIGNAL(tagAdded(SemanticInfoTag,QString)));

    TagSet oldAllTags = mBackEnd->allTags();
    QString label = "testTagForLabel-" + KRandom::randomString(5);
    SemanticInfoTag tag1 = mBackEnd->tagForLabel(label);
    QVERIFY(!tag1.isEmpty());
    QVERIFY(!oldAllTags.contains(tag1));
    QVERIFY(mBackEnd->allTags().contains(tag1));

    // This is a new tag, we should receive a signal
    QCOMPARE(spy.count(), 1);

    SemanticInfoTag tag2 = mBackEnd->tagForLabel(label);
    QCOMPARE(tag1, tag2);
    // This is not a new tag, we should not receive a signal
    QCOMPARE(spy.count(), 1);

    QString label2 = mBackEnd->labelForTag(tag2);
    QCOMPARE(label, label2);
}
Example #10
0
DatabaseCodec::InfoData::InfoData(TagSet const& tags)
	:whiteCountry(country::Unknown)
	,blackCountry(country::Unknown)
	,eventCountry(country::Unknown)
	,whiteTitle(title::None)
	,blackTitle(title::None)
	,whiteType(species::Unspecified)
	,blackType(species::Unspecified)
	,whiteSex(sex::Unspecified)
	,blackSex(sex::Unspecified)
	,whiteFideID(0)
	,blackFideID(0)
	,eventType(event::Unknown)
	,timeMode(time::Unknown)
	,eventMode(event::Undetermined)
{
	if (tags.contains(tag::WhiteCountry))
		whiteCountry = country::fromString(tags.value(tag::WhiteCountry));

	if (tags.contains(tag::WhiteTitle))
		whiteTitle = title::fromString(tags.value(tag::WhiteTitle));

	if (tags.contains(tag::WhiteType))
		whiteType = species::fromString(tags.value(tag::WhiteType));

	if (tags.contains(tag::WhiteSex))
		whiteSex = sex::fromChar(*tags.value(tag::WhiteSex));

	if (tags.contains(tag::BlackCountry))
		blackCountry = country::fromString(tags.value(tag::BlackCountry));

	if (tags.contains(tag::BlackTitle))
		blackTitle = title::fromString(tags.value(tag::BlackTitle));

	if (tags.contains(tag::BlackType))
		blackType = species::fromString(tags.value(tag::BlackType));

	if (tags.contains(tag::BlackSex))
		blackSex = sex::fromChar(*tags.value(tag::BlackSex));

	if (tags.contains(tag::WhiteFideId))
		whiteFideID = tags.asInt(tag::WhiteFideId);

	if (tags.contains(tag::BlackFideId))
		blackFideID = tags.asInt(tag::BlackFideId);

	if (tags.contains(tag::EventType))
		eventType = event::typeFromString(tags.value(tag::EventType));

	if (tags.contains(tag::Mode))
		eventMode = event::modeFromString(tags.value(tag::Mode));

	if (tags.contains(tag::TimeMode))
		timeMode = time::fromString(tags.value(tag::TimeMode));

	if (tags.contains(tag::EventType))
		eventType = event::typeFromString(tags.value(tag::EventType));

	if (tags.contains(tag::EventCountry))
		eventCountry = country::fromString(tags.value(tag::EventCountry));

	if (tags.contains(tag::EventDate))
		eventDate.fromString(tags.value(tag::EventDate));
}
Example #11
0
save::State
DatabaseCodec::saveGame(ByteStream const& gameData, TagSet const& tags, Provider const& provider)
{
	//M_REQUIRE(isOpen());

	typedef Namebase::PlayerEntry*	Player;
	typedef Namebase::EventEntry*		Event;
	typedef Namebase::SiteEntry*		Site;
	typedef Namebase::Entry*			Entry;

	if (gameData.size() > maxGameRecordLength())
		return save::GameTooLong;
	if (provider.plyCount() > maxGameLength())
		return save::GameTooLong;

	GameInfo*	info = 0;
	unsigned		index;

	if (provider.index() >= 0)
	{
		index = provider.index();
		info = m_db->m_gameInfoList[index];
		*m_storedInfo = *info;
		info->reset(m_db->m_namebases);
	}
	else if (m_db->size() == maxGameCount())
	{
		return save::TooManyGames;
	}
	else
	{
		index = m_db->m_gameInfoList.size();
	}

	unsigned maxAnnotatorCount	= this->maxAnnotatorCount();
	unsigned maxPlayerCount		= this->maxPlayerCount();

	InfoData data(tags);

	Player	whiteEntry;
	Player	blackEntry;
	Site		siteEntry;

	switch (provider.sourceFormat())
	{
		case format::Scid3:
		case format::Scid4:
			{
				mstl::string name;

				whiteEntry = namebase(Namebase::Player).insertPlayer(
									::normalizePlayerName(tags.value(tag::White), name),
									data.whiteCountry,
									data.whiteTitle,
									data.whiteType,
									data.whiteSex,
									data.whiteFideID,
									maxPlayerCount);
				blackEntry = namebase(Namebase::Player).insertPlayer(
									::normalizePlayerName(tags.value(tag::Black), name),
									data.blackCountry,
									data.blackTitle,
									data.blackType,
									data.blackSex,
									data.blackFideID,
									maxPlayerCount);
				siteEntry = namebase(Namebase::Site).insertSite(
									::normalizeSiteName(tags.value(tag::Site), name),
									data.eventCountry,
									maxSiteCount());
			}
			break;

		default:
			whiteEntry	= namebase(Namebase::Player).insertPlayer(
									tags.value(tag::White),
									data.whiteCountry,
									data.whiteTitle,
									data.whiteType,
									data.whiteSex,
									data.whiteFideID,
									maxPlayerCount);
			blackEntry	= namebase(Namebase::Player).insertPlayer(
									tags.value(tag::Black),
									data.blackCountry,
									data.blackTitle,
									data.blackType,
									data.blackSex,
									data.blackFideID,
									maxPlayerCount);
			siteEntry	= namebase(Namebase::Site).insertSite(
									tags.value(tag::Site),
									data.eventCountry,
									maxSiteCount());
	}

	Event eventEntry = namebase(Namebase::Event).insertEvent(
								tags.value(tag::Event),
								data.eventDate,
								data.eventType,
								data.timeMode,
								data.eventMode,
								maxEventCount(),
								siteEntry ? siteEntry : NamebaseEvent::emptySite());
	Entry annotatorEntry	= NamebaseEntry::emptyEntry();

	if (maxAnnotatorCount)
	{
		annotatorEntry =
			namebase(Namebase::Annotator).insert(tags.value(tag::Annotator), maxAnnotatorCount);
	}

	save::State state = save::Ok;

	bool failed =		whiteEntry == 0
						|| blackEntry == 0
						|| eventEntry == 0
						|| siteEntry == 0
						|| annotatorEntry == 0;

	unsigned gameOffset = 0; // shut up compiler

	if (!failed)
	{
		if (info)
			gameOffset = putGame(gameData, info->gameOffset(), info->gameRecordLength());
		else
			gameOffset = putGame(gameData);
	}

	if (failed || int(gameOffset) < 0)
	{
		if (info)
			info->restore(*m_storedInfo, m_db->m_namebases);

		namebases().update();

		switch (gameOffset)
		{
			/*case util::BlockFile::MaxFileSizeExceeded:
				IO_RAISE(Game, Max_File_Size_Exceeded, "maximal file size (2 GB) exceeded");

			case util::BlockFile::SyncFailed:
				IO_RAISE(Game, Write_Failed, "sync failed");

			case util::BlockFile::ReadError:
				IO_RAISE(Game, Read_Error, "read error");

			case util::BlockFile::IllegalOffset:
				IO_RAISE(Game, Write_Failed, "offset failure (internal error)");*/
		}

		if (!whiteEntry)	return save::TooManyPlayerNames;
		if (!blackEntry)	return save::TooManyPlayerNames;
		if (!eventEntry)	return save::TooManyEventNames;
		if (!siteEntry)	return save::TooManySiteNames;

		return save::TooManyAnnotatorNames;
	}

	if (info == 0)
	{
		info = allocGameInfo();
		m_db->m_gameInfoList.push_back(info);
	}

	info->setup(gameOffset,
					gameData.size(),
					whiteEntry,
					blackEntry,
					eventEntry,
					annotatorEntry,
					tags,
					provider,
					m_db->m_namebases);

	return state;
}
Example #12
0
save::State
DatabaseCodec::updateCharacteristics(unsigned index, TagSet const& tags)
{
	//M_REQUIRE(isOpen());

	typedef Namebase::PlayerEntry*	Player;
	typedef Namebase::EventEntry*		Event;
	typedef Namebase::SiteEntry*		Site;
	typedef Namebase::Entry*			Entry;

	GameInfo* info = m_db->m_gameInfoList[index];
	*m_storedInfo = *info;
	info->resetCharacteristics(m_db->m_namebases);

	unsigned maxAnnotatorCount	= this->maxAnnotatorCount();
	unsigned maxPlayerCount		= this->maxPlayerCount();

	InfoData data(tags);

	Player	whiteEntry		= namebase(Namebase::Player).insertPlayer(
										tags.value(tag::White),
										data.whiteCountry,
										data.whiteTitle,
										data.whiteType,
										data.whiteSex,
										data.whiteFideID,
										maxPlayerCount);
	Player	blackEntry		= namebase(Namebase::Player).insertPlayer(
										tags.value(tag::Black),
										data.blackCountry,
										data.blackTitle,
										data.blackType,
										data.blackSex,
										data.blackFideID,
										maxPlayerCount);
	Site		siteEntry		= namebase(Namebase::Site).insertSite(
										tags.value(tag::Site),
										data.eventCountry,
										maxSiteCount());
	Event		eventEntry		= namebase(Namebase::Event).insertEvent(
										tags.value(tag::Event),
										data.eventDate,
										data.eventType,
										data.timeMode,
										data.eventMode,
										maxEventCount(),
										siteEntry ? siteEntry : NamebaseEvent::emptySite());
	Entry		annotatorEntry	= NamebaseEntry::emptyEntry();

	if (maxAnnotatorCount)
	{
		annotatorEntry = namebase(Namebase::Annotator).
									insert(tags.value(tag::Annotator), maxAnnotatorCount);
	}

	bool failed = 		whiteEntry == 0
						|| blackEntry == 0
						|| eventEntry == 0
						|| siteEntry == 0
						|| annotatorEntry == 0;

	save::State state = save::Ok;

	if (!failed && format() != format::Scidb)
	{
	}

	if (failed)
	{
		info->restore(*m_storedInfo, m_db->m_namebases);

		namebases().update();

		if (!whiteEntry)	return save::TooManyPlayerNames;
		if (!blackEntry)	return save::TooManyPlayerNames;
		if (!eventEntry)	return save::TooManyEventNames;
		if (!siteEntry)	return save::TooManySiteNames;

		return save::TooManyAnnotatorNames;
	}

	info->update(	whiteEntry,
						blackEntry,
						eventEntry,
						annotatorEntry,
						tags,
						m_db->m_namebases);

	return state;
}
Example #13
0
bool TagSet::includes(const TagSet& t) const
{
    //return !empty() && std::includes( this->begin(), this->end(), t.begin(), t.end());
    if (t.empty())
        return true;
    if (empty())
    {
        // An empty TagSet satisfies the conditions only if either :
        // t is also empty (already handled)
        // t only includes negative tags
        if (*t.rbegin() <= Tag(0))
            return true;
        // t includes the "0" tag
        if (t.count(Tag(0)) > 0)
            return true;
        // otherwise the TagSet t does not "include" empty sets
        return false;
    }
#if 1
    // Simple but not optimal version
    for (sofa::helper::set<Tag>::const_iterator first2 = t.begin(), last2 = t.end();
        first2 != last2; ++first2)
    {
        Tag t2 = *first2;
        if (t2 == Tag(0)) continue; // tag "0" is used to indicate that we should include objects without any tag
        if (!t2.negative())
        {
            if (this->count(t2) == 0)
                return false; // tag not found in this
        }
        else
        {
            if (this->count(-t2) > 0)
                return false; // tag found in this
        }
    }
    return true;
#else
    // First test : no negative tag from t should appear as positive in this
    if (t.begin()->negative())
    {
        sofa::helper::set<Tag>::const_reverse_iterator first1, last1;
        sofa::helper::set<Tag>::const_iterator first2, last2;
        first1 = this->rbegin(); last1 = this->rend();
        first2 = t.begin(); last2 = t.end();
        for (; first2 != last2; ++first1)
        {
            if (first1 == last1) break; // no more tags in this
            Tag t1 = *first1;
            if (t1.negative()) break; // no more positive tags in this
            Tag t2 = *first2;
            if (!t2.negative()) break; // no more negative tags in t
            if (-t1 == t2)
                return false; // found an excluded tag
            if (!(-t1 < t2))
                ++first2;
        }
    }
    // Second test : all positive tags from t should appear as positive in this
    if (!t.rbegin()->negative())
    {
        sofa::helper::set<Tag>::const_iterator first1, last1;
        sofa::helper::set<Tag>::const_iterator first2, last2;
        first1 = this->lower_bound(Tag(0)); last1 = this->end();
        first2 = t.lower_bound(Tag(0)); last2 = t.end();
        //for(; first1 != last1 && first1->negative(); ++first1); // skip negative tags in this
        //for(; first2 != last2 && first2->negative(); ++first2); // skip negative tags in t
        for (; first2 != last2; ++first1)
        {
            if (first1 == last1)
                return false; // no more positive tags in this
            Tag t1 = *first1;
            Tag t2 = *first2;
            if (t2 < t1)
                return false; // tag not found
            if (!(t1 < t2))
                ++first2;
        }
    }
    return true; // all tests passed
#endif
}
Example #14
0
bool Importer::traverse(NodeHandler *handler, void *n, void *c, Core::BaseObject *target) {
	xmlNodePtr node = reinterpret_cast<xmlNodePtr>(n);
	xmlNodePtr childs = reinterpret_cast<xmlNodePtr>(c);
	ChildList remaining;
	TagSet mandatory;

	handler->init(target, n, mandatory);

	bool result = true;

	for ( xmlNodePtr child = childs; child != NULL; child = child->next ) {
		if ( child->type != XML_ELEMENT_NODE ) continue;

		handler->propagate(NULL, false, true);

		try {
			handler->get(target, child);
		}
		catch ( std::exception &e ) {
			if ( handler->isOptional )
				SEISCOMP_WARNING("(optional) %s.%s: %s", node->name, child->name, e.what());
			else
				throw e;
		}

		if ( !handler->isOptional )
			mandatory.erase((const char*)child->name);

		if ( handler->object == NULL && handler->isAnyType ) {
			if ( _any.get(target, child) ) {
				handler->object = _any.object;
				handler->childHandler = _any.childHandler;
				handler->newInstance = _any.newInstance;
			}
		}

		Core::BaseObject *newTarget = handler->object;
		MemberNodeHandler *memberHandler = handler->memberHandler;
		NodeHandler *childHandler = handler->childHandler;
		bool newInstance = handler->newInstance;
		bool optional = handler->isOptional;

		if ( newTarget ) {
			if ( childHandler == NULL ) {
				childHandler = _typemap->getHandler(newTarget->className());
				if ( childHandler == NULL ) {
					SEISCOMP_WARNING("No class handler for %s", newTarget->className());
					if ( newInstance )
						delete newTarget;
					handler->object = NULL;
					newTarget = NULL;
					childHandler = &_none;
				}
			}
		}
		else
			childHandler = &_none;

		try {
			if ( traverse(childHandler, child, child->children, handler->object) ) {
				if ( newTarget && newInstance && !memberHandler )
					remaining.push_back(newTarget);

			}
			else {
				if ( newTarget && newInstance )
					delete newTarget;
				newTarget = NULL;
				if ( optional )
					SEISCOMP_INFO("Invalid %s element: ignoring", child->name);
				else {
					SEISCOMP_WARNING("%s is not optional within %s", child->name, node->name);
					result = false;
				}
			}
		}
		catch ( std::exception &e ) {
			SEISCOMP_WARNING("%s: %s", child->name, e.what());
			if ( newTarget ) {
				if ( newInstance )
					delete newTarget;

				if ( !optional ) {
					SEISCOMP_WARNING("%s is not optional within %s", child->name, node->name);
					result = false;
				}
				else
					SEISCOMP_WARNING("%s: ignoring optional member %s: invalid", node->name, child->name);

				newTarget = NULL;
			}
		}

		if ( memberHandler ) {
			if ( !memberHandler->finalize(target, newTarget) ) {
				if ( newTarget && newInstance )
					remaining.push_back(newTarget);
			}
		}
	}

	handler->finalize(target, &remaining);

	if ( target != NULL ) {
		for ( ChildList::iterator it = remaining.begin(); it != remaining.end(); ++it )
			if ( *it != NULL ) delete *it;
	}
	else {
		for ( ChildList::iterator it = remaining.begin(); it != remaining.end(); ++it ) {
			if ( *it != NULL ) {
				if ( _result == NULL )
					_result = *it;
				else
					delete *it;
			}
		}
	}

	if ( !mandatory.empty() ) {
		std::string attribs;
		for ( TagSet::iterator it = mandatory.begin(); it != mandatory.end(); ++it ) {
			if ( it != mandatory.begin() ) attribs += ", ";
			attribs += *it;
		}
		SEISCOMP_WARNING("%s: missing mandatory attribute%s: %s", node->name, mandatory.size() == 1?"":"s", attribs.c_str());
		return false;
	}

	return result;
}
Example #15
0
QDebug operator<<(QDebug dbg, const TagSet &ts)
{

    dbg.nospace() << "Tagset " << ts.uri() << " [" << ts.title() << "]" <<"\n";
    dbg.nospace() << "  DiscId " << ts.diskTag(TAG_DISCID) << "\n";
    dbg.nospace() << "  Genre  " << ts.diskTag(TAG_GENRE) << "\n";
    dbg.nospace() << "  Artist " << ts.diskTag(TAG_PERFORMER) << "\n";
    dbg.nospace() << "  Album  " << ts.diskTag(TAG_ALBUM) << "\n";
    dbg.nospace() << "  Date   " << ts.diskTag(TAG_DATE) << "\n";
    for (int i=0; i < ts.tracksCount(); ++i)
    {
        dbg.nospace() << "  Track " << i << "-=-=-=-=-" << "\n";
        dbg.nospace() << "    * Album  " << ts.trackTag(i, TAG_ALBUM) << "\n";
        dbg.nospace() << "    * Artist " << ts.trackTag(i, TAG_PERFORMER) << "\n";
        dbg.nospace() << "    * Title  " << ts.trackTag(i, TAG_TITLE) << "\n";
        dbg.nospace() << "    * Genre  " << ts.trackTag(i, TAG_GENRE) << "\n";
    }

    return dbg.space();
}
Example #16
0
bool TagSet::includes(const TagSet& t) const
{
    return !empty() && std::includes( this->begin(), this->end(), t.begin(), t.end());
}