⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hidedoclist.cpp

📁 Linux下的C、C++ IDE
💻 CPP
字号:
// FILE: hidedoclist.cpp// DESCRIPTION: Implementation of the hIDE document list object.// AUTHOR: James Martin (boolean_machine@yahoo.com)#include "hidedoclist.h"// Add a document to the list.bool HideDocList::add(HideDoc &doc){	// If the list has documents check if this one is present...	if (!listPath.isEmpty())	{		for (QStringList::size_type i=0; i < listPath.count(); i++)		{			// If it's already in the list, avoid needless waste...			if (listPath[i] == doc.getPath())				return false;		}	}		// Add the documents data to the list...	listPath += doc.getPath();	listName += doc.getName();	listData += doc.getData();	listMod.push_back(doc.isModified());		return true;}// Remove a document from the list.bool HideDocList::remove(HideDoc &doc){	// Go through the list to find this document...		for (QStringList::size_type i=0; i < count(); i++)	{		// If found, remove it...	 	if (listPath[i] == doc.getPath())	 	{	 		listPath.erase(listPath.at(i));	 		listName.erase(listName.at(i));	 		listData.erase(listData.at(i));	 		listMod.erase(listMod.at(i));	 					 		return true;	 	}	}	return false; // Wasn't found (this should never happen).}// Update a documents data in the list.void HideDocList::update(HideDoc &doc){	// Go through the list until this document is found...	for (QStringList::size_type i = 0; i < count(); i++)	{		// If the documents found, update and return...	 	if (listPath[i] == doc.getPath())	 	{	 	 	listData[i] = doc.getData();	 	 	listMod[i] = doc.isModified();	 	 		 	 	return;	 	}	}}// Get a document based on its name (title).	HideDoc HideDocList::getByName(QString n){	HideDoc hd;		// Go through the list to find the document...	for (QStringList::size_type i=0; i < count(); i++)	{		// If the document is found return a copy...	 	if (listName[i] == n)	 	{	 		hd.set(listPath[i], listName[i], listData[i]);	 		hd.setModified(listMod[i]);	 			 		return hd;	 	}	}		return hd; // Wasn't found, return a blank document.}// Get on document based on a path.HideDoc HideDocList::getByPath(QString p){	HideDoc hd;		// Go through the list to find the document...	for (QStringList::size_type i=0; i < count(); i++)	{		// If the document is found return a copy...	 	if (listPath[i] == p)	 	{	 		hd.set(listPath[i], listName[i], listData[i]);	 		hd.setModified(listMod[i]);	 			 		return hd;	 	}	}		return hd; // Wasn't found, return a blank document.}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -