• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ poco_assert函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中poco_assert函数的典型用法代码示例。如果您正苦于以下问题:C++ poco_assert函数的具体用法?C++ poco_assert怎么用?C++ poco_assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了poco_assert函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: poco_assert

void Context::enableSessionCache(bool flag, const std::string& sessionIdContext)
{
	poco_assert (isForServerUse());

	if (flag)
	{
		SSL_CTX_set_session_cache_mode(_pSSLContext, SSL_SESS_CACHE_SERVER);
	}
	else
	{
		SSL_CTX_set_session_cache_mode(_pSSLContext, SSL_SESS_CACHE_OFF);
	}
	
	unsigned length = static_cast<unsigned>(sessionIdContext.length());
	if (length > SSL_MAX_SSL_SESSION_ID_LENGTH) length = SSL_MAX_SSL_SESSION_ID_LENGTH;
	int rc = SSL_CTX_set_session_id_context(_pSSLContext, reinterpret_cast<const unsigned char*>(sessionIdContext.data()), length);
	if (rc != 1) throw SSLContextException("cannot set session ID context");
}
开发者ID:RobertAcksel,项目名称:poco,代码行数:18,代码来源:Context.cpp


示例2: poco_assert

void JobManager::WakeUp(InternalJob::Pointer job, Poco::Timestamp::TimeDiff delay)
{
  poco_assert(delay >= 0); // "Scheduling delay is negative"

  {
    Poco::ScopedLock<Poco::Mutex> m_managerLock (m_mutex);
    //cannot wake up if it is not sleeping
    if (job->GetState() != Job::SLEEPING)
    return;
    DoSchedule(job, delay);
  }
  //call the pool outside sync block to avoid deadlock
  m_Pool->JobQueued();

  /// IListenerExtension only notify of wake up if immediate
  if (delay == 0)
  m_JobListeners.Awake(job.Cast<Job>());
}
开发者ID:test-fd301,项目名称:MITK,代码行数:18,代码来源:berryJobManager.cpp


示例3: poco_assert

void BundleFile::list(const std::string& path, std::vector<std::string>& files) const	
{
	poco_assert (_pArchive);
	
	files.clear();
	int depth = 0;
	std::string parent;
	if (!path.empty())
	{
		// ensure parent ends with a slash
		Path parentPath(path, Path::PATH_UNIX);
		parentPath.makeDirectory();
		parent = parentPath.toString(Path::PATH_UNIX);
	}
	ZipArchive::FileHeaders::const_iterator it;
	ZipArchive::FileHeaders::const_iterator end(_pArchive->headerEnd());
	if (path.empty())
	{
		it = _pArchive->headerBegin();
	}
	else
	{
		it = _pArchive->findHeader(parent);
		if (it != end) ++it;
		depth = Path(parent).depth();
	}
	
	std::set<std::string> fileSet;
	while (it != end && isSubdirectoryOf(it->first, parent))
	{
		Path p(it->first, Path::PATH_UNIX);
		p.makeFile();
		if (p.depth() == depth)
		{
			std::string name = p.getFileName();
			if (fileSet.find(name) == fileSet.end())
			{
				files.push_back(name);
				fileSet.insert(name);
			}
		}
		++it;
	}
}
开发者ID:JoneXie,项目名称:macchina.io,代码行数:44,代码来源:BundleFile.cpp


示例4: poco_assert

std::size_t Preparation::maxDataSize(std::size_t pos) const
{
	poco_assert (pos >= 0 && pos < _pValues.size());

	std::size_t sz = 0;
	std::size_t maxsz = getMaxFieldSize();

	try 
	{
		ODBCColumn col(_rStmt, pos);
		sz = col.length();
		if (ODBCColumn::FDT_STRING == col.type()) ++sz;
	}
	catch (StatementException&) 
	{
	}
	if (!sz || sz > maxsz) sz = maxsz;
	return sz;
}
开发者ID:BrianHoldsworth,项目名称:Poco,代码行数:19,代码来源:Preparation.cpp


示例5: poco_assert

void FileImpl::setSizeImpl(FileSizeImpl size)
{
    poco_assert (!_path.empty());

    int fd = open(_path.c_str(), O_WRONLY, S_IRWXU);
    if (fd != -1)
    {
        try
        {
            if (ftruncate(fd, size) != 0)
                handleLastErrorImpl(_path);
        }
        catch (...)
        {
            close(fd);
            throw;
        }
    }
}
开发者ID:as2120,项目名称:ZPoco,代码行数:19,代码来源:File_VX.cpp


示例6: poco_assert_dbg

int StreamConverterBuf::readFromDevice()
{
	poco_assert_dbg (_pIstr);

	if (_pos < _sequenceLength) return _buffer[_pos++];

	_pos = 0;
	_sequenceLength = 0;
	int c = _pIstr->get();
	if (c == -1) return -1;	

	poco_assert (c < 256);
	int uc;
	_buffer [0] = (unsigned char) c;
	int n = _inEncoding.queryConvert(_buffer, 1);
	int read = 1;

	while (-1 > n)
	{
		poco_assert_dbg(-n <= sizeof(_buffer));
		_pIstr->read((char*) _buffer + read, -n - read);
		read = -n;
		n = _inEncoding.queryConvert(_buffer, -n);
	}

	if (-1 >= n)
	{
		uc = _defaultChar;
		++_errors;
	}
	else
	{
		uc = n;
	}

	_sequenceLength = _outEncoding.convert(uc, _buffer, sizeof(_buffer));
	if (_sequenceLength == 0)
		_sequenceLength = _outEncoding.convert(_defaultChar, _buffer, sizeof(_buffer));
	if (_sequenceLength == 0)
		return -1;
	else
		return _buffer[_pos++];
}
开发者ID:sdottaka,项目名称:winmerge-v2,代码行数:43,代码来源:StreamConverter.cpp


示例7: _year

DateTime::DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond):
	_year(year),
	_month(month),
	_day(day),
	_hour(hour),
	_minute(minute),
	_second(second),
	_millisecond(millisecond),
	_microsecond(microsecond)
{
	poco_assert (year >= 0 && year <= 9999);
	poco_assert (month >= 1 && month <= 12);
	poco_assert (day >= 1 && day <= daysOfMonth(year, month));
	poco_assert (hour >= 0 && hour <= 23);
	poco_assert (minute >= 0 && minute <= 59);
	poco_assert (second >= 0 && second <= 59);
	poco_assert (millisecond >= 0 && millisecond <= 999);
	poco_assert (microsecond >= 0 && microsecond <= 999);
	
	_utcTime = toUtcTime(toJulianDay(year, month, day)) + 10*(hour*Timespan::HOURS + minute*Timespan::MINUTES + second*Timespan::SECONDS + millisecond*Timespan::MILLISECONDS + microsecond);
}
开发者ID:RangelReale,项目名称:sandbox,代码行数:21,代码来源:DateTime.cpp


示例8: _n

SemaphoreImpl::SemaphoreImpl(int n, int max): _n(n), _max(max)
{
	poco_assert (n >= 0 && max > 0 && n <= max);

#if defined(POCO_VXWORKS)
	// This workaround is for VxWorks 5.x where
	// pthread_mutex_init() won't properly initialize the mutex
	// resulting in a subsequent freeze in pthread_mutex_destroy()
	// if the mutex has never been used.
	std::memset(&_mutex, 0, sizeof(_mutex));
#endif
	if (pthread_mutex_init(&_mutex, NULL))
		throw SystemException("cannot create semaphore (mutex)");

#if defined(POCO_HAVE_MONOTONIC_PTHREAD_COND_TIMEDWAIT)
	pthread_condattr_t attr;
	if (pthread_condattr_init(&attr))
	{
		pthread_mutex_destroy(&_mutex);
		throw SystemException("cannot create semaphore (condition attribute)");
	}
	if (pthread_condattr_setclock(&attr, CLOCK_MONOTONIC))
    {
		pthread_condattr_destroy(&attr);
		pthread_mutex_destroy(&_mutex);
		throw SystemException("cannot create semaphore (condition attribute clock)");
    }
	if (pthread_cond_init(&_cond, &attr))
	{
		pthread_condattr_destroy(&attr);
		pthread_mutex_destroy(&_mutex);
		throw SystemException("cannot create semaphore (condition)");
	}
	pthread_condattr_destroy(&attr);
#else
	if (pthread_cond_init(&_cond, NULL))
	{
		pthread_mutex_destroy(&_mutex);
		throw SystemException("cannot create semaphore (condition)");
	}
#endif
}
开发者ID:Bjoe,项目名称:poco,代码行数:42,代码来源:Semaphore_POSIX.cpp


示例9: _minCapacity

ThreadPool::ThreadPool(int minCapacity,
	int maxCapacity,
	int idleTime,
	int stackSize): 
	_minCapacity(minCapacity), 
	_maxCapacity(maxCapacity), 
	_idleTime(idleTime),
	_serial(0),
	_age(0),
	_stackSize(stackSize)
{
	poco_assert (minCapacity >= 1 && maxCapacity >= minCapacity && idleTime > 0);

	for (int i = 0; i < _minCapacity; i++)
	{
		PooledThread* pThread = createThread();
		_threads.push_back(pThread);
		pThread->start();
	}
}
开发者ID:PsyCommando,项目名称:ppmdu,代码行数:20,代码来源:ThreadPool.cpp


示例10: lock

AbstractSession& SimpleSessionStore::getSession(const std::string& sessionId)
{
    std::unique_lock<std::mutex> lock(_mutex);

    SessionMap::iterator sessionsIter = _sessionMap.find(sessionId);

    if (sessionsIter != _sessionMap.end())
    {
        // This must be valid b/c it's designed that way and we
        // need to return a reference.
        poco_assert(sessionsIter->second);

        return (*sessionsIter->second);
    }
    else
    {

        throw Poco::InvalidAccessException("Session " + sessionId + " not found.");
    }
}
开发者ID:ChulseungYoo,项目名称:ofxHTTP,代码行数:20,代码来源:SessionStore.cpp


示例11: _in

Decompress::Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs, bool keepIncompleteFiles):
	_in(in),
	_outDir(outputDir),
	_flattenDirs(flattenDirs),
	_keepIncompleteFiles(keepIncompleteFiles),
	_mapping()
{
	_outDir.makeAbsolute();
	_outDir.makeDirectory();
	poco_assert (_in.good());
	Poco::File tmp(_outDir);
	if (!tmp.exists())
	{
		tmp.createDirectories();
	}
	if (!tmp.isDirectory())
		throw Poco::IOException("Failed to create/open directory: " + _outDir.toString());
	EOk += Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk);

}
开发者ID:12307,项目名称:poco,代码行数:20,代码来源:Decompress.cpp


示例12: poco_assert

void ZipLocalFileHeader::init(	const Poco::Path& fName, 
								ZipCommon::CompressionMethod cm, 
								ZipCommon::CompressionLevel cl)
{
	poco_assert (_fileName.empty());
	setSearchCRCAndSizesAfterData(false);
	Poco::Path fileName(fName);
	fileName.setDevice(""); // clear device!
	setFileName(fileName.toString(Poco::Path::PATH_UNIX), fileName.isDirectory());
	setRequiredVersion(2, 0);
	if (fileName.isFile())
	{
		setCompressionMethod(cm);
		setCompressionLevel(cl);
	}
	else
		setCompressionMethod(ZipCommon::CM_STORE);
    
    _rawHeader[GENERAL_PURPOSE_POS+1] |= 0x08; // Set "language encoding flag" to indicate that filenames and paths are in UTF-8.
}
开发者ID:Aahart911,项目名称:ClickHouse,代码行数:20,代码来源:ZipLocalFileHeader.cpp


示例13: poco_assert

bool FileImpl::existsImpl() const
{
	poco_assert (!_path.empty());

	DWORD attr = GetFileAttributes(_path.c_str());
	if (attr == 0xFFFFFFFF)
	{
		switch (GetLastError())
		{
		case ERROR_FILE_NOT_FOUND:
		case ERROR_PATH_NOT_FOUND:
		case ERROR_NOT_READY:
		case ERROR_INVALID_DRIVE:
			return false;
		default:
			handleLastErrorImpl(_path);
		}
	}
	return true;
}
开发者ID:9drops,项目名称:poco,代码行数:20,代码来源:File_WIN32.cpp


示例14: poco_assert

void FileImpl::setExecutableImpl(bool flag)
{
	poco_assert (!_path.empty());

	struct stat st;
	if (stat(_path.c_str(), &st) != 0) 
		handleLastErrorImpl(_path);
	mode_t mode;
	if (flag)
	{
		mode = st.st_mode | S_IXUSR;
	}
	else
	{
		mode_t wmask = S_IXUSR | S_IXGRP | S_IXOTH;
		mode = st.st_mode & ~wmask;
	}
	if (chmod(_path.c_str(), mode) != 0) 
		handleLastErrorImpl(_path);
}
开发者ID:12307,项目名称:poco,代码行数:20,代码来源:File_UNIX.cpp


示例15: it

int TextConverter::convert(const std::string& source, std::string& destination, Transform trans)
{
	int errors = 0;
	TextIterator it(source, _inEncoding);
	TextIterator end(source);
	unsigned char buffer[TextEncoding::MAX_SEQUENCE_LENGTH];

	while (it != end)
	{
		int c = *it;
		if (c == -1) { ++errors; c = _defaultChar; }
		c = trans(c);
		int n = _outEncoding.convert(c, buffer, sizeof(buffer));
		if (n == 0) n = _outEncoding.convert(_defaultChar, buffer, sizeof(buffer));
		poco_assert (n <= sizeof(buffer));
		destination.append((const char*) buffer, n);
		++it;
	}
	return errors;
}
开发者ID:Victorcasas,项目名称:georest,代码行数:20,代码来源:TextConverter.cpp


示例16: poco_check_ptr

void NodeAppender::appendChild(Node* newChild)
{
	poco_check_ptr (newChild);
	poco_assert (_pLast == 0 || _pLast->_pNext == 0);

	if (static_cast<AbstractNode*>(newChild)->_pOwner != _pParent->_pOwner)
		throw DOMException(DOMException::WRONG_DOCUMENT_ERR);
		
	if (newChild->nodeType() == Node::DOCUMENT_FRAGMENT_NODE)
	{
		AbstractContainerNode* pFrag = static_cast<AbstractContainerNode*>(newChild);
		AbstractNode* pChild = pFrag->_pFirstChild;
		if (pChild)
		{
			if (_pLast)
				_pLast->_pNext = pChild;
			else
				_pParent->_pFirstChild = pChild;
			while (pChild)
			{
				_pLast = pChild;
				pChild->_pParent = _pParent;
				pChild = pChild->_pNext;
			}
			pFrag->_pFirstChild = 0;
		}
	}
	else
	{
		AbstractNode* pAN = static_cast<AbstractNode*>(newChild);
		pAN->duplicate();
		if (pAN->_pParent) 
			pAN->_pParent->removeChild(pAN);
		pAN->_pParent = _pParent;
		if (_pLast)
			_pLast->_pNext = pAN;
		else
			_pParent->_pFirstChild = pAN;
		_pLast = pAN;
	}
}
开发者ID:Alcibiades586,项目名称:roadrunner,代码行数:41,代码来源:NodeAppender.cpp


示例17: ZeroMemory

std::string& SerialChannelImpl::readImpl(std::string& buffer, std::size_t length)
{
	buffer.clear();
	int bufSize = length ? (int) length : (int) _config.getBufferSizeImpl();
	if (0 == bufSize) return buffer;
	char* pReadBuf = new char[bufSize+1];
	DWORD read = 0;
	DWORD readCount = 0;
	buffer.clear();
	do
    {
		ZeroMemory(pReadBuf, bufSize+1);
		if (!ReadFile(_handle, pReadBuf + readCount, bufSize - readCount, &read, NULL)) 
		{
			delete[] pReadBuf;
			handleError(_name);
		}
		else if (0 == read) break;

		poco_assert(read <= bufSize - readCount);
		buffer.append(pReadBuf + readCount, read);

		if (length) readCount += read;
		
		if (_config.getUseEOFImpl()) 
		{
			size_t pos = buffer.find(_config.getEOFCharImpl());
			if (pos != buffer.npos)
			{
				buffer = buffer.substr(0, pos);
				PurgeComm(_handle, PURGE_RXCLEAR);
				break;
			}
		}

		if (length && readCount >= length) break;
	}while(true);

	delete[] pReadBuf;
	return buffer;
}
开发者ID:RangelReale,项目名称:sandbox,代码行数:41,代码来源:SerialChannel_WIN32U.cpp


示例18: poco_assert

void FileStreamBuf::open(const std::string& path, std::ios::openmode mode)
{
	poco_assert (_handle == INVALID_HANDLE_VALUE);

	_path = path;
	_pos = 0;
	setMode(mode);
	resetBuffers();

	DWORD access = 0;
	if (mode & std::ios::in)
		access |= GENERIC_READ;
	if (mode & std::ios::out)
		access |= GENERIC_WRITE;

	DWORD shareMode = FILE_SHARE_READ;
	if (!(mode & std::ios::out))
		shareMode |= FILE_SHARE_WRITE;
		
	DWORD creationDisp = OPEN_EXISTING;
	if (mode & std::ios::trunc)
		creationDisp = CREATE_ALWAYS;
	else if (mode & std::ios::out)
		creationDisp = OPEN_ALWAYS;

	DWORD flags = FILE_ATTRIBUTE_NORMAL;
	
#if defined (POCO_WIN32_UTF8)
	std::wstring utf16Path;
	UnicodeConverter::toUTF16(path, utf16Path);
	_handle = CreateFile2(utf16Path.c_str(), access, shareMode, creationDisp, NULL);
#else
	_handle = CreateFileA(path.c_str(), access, shareMode, NULL, creationDisp, flags, NULL);
#endif

	if (_handle == INVALID_HANDLE_VALUE)
		File::handleLastError(_path);
		
	if ((mode & std::ios::ate) || (mode & std::ios::app))
		seekoff(0, std::ios::end, mode);
}
开发者ID:MSOpenTech,项目名称:graphics-dependencies,代码行数:41,代码来源:FileStream_WIN32.cpp


示例19: poco_assert

std::streamsize StreamCopier::copyToString(std::istream& istr, std::string& str, unsigned bufferSize)
{
	poco_assert (bufferSize > 0);

	Buffer<char> buffer(bufferSize);
	std::streamsize len = 0;
	istr.read(buffer.begin(), bufferSize);
	std::streamsize n = istr.gcount();
	while (n > 0)
	{
		len += n;
		str.append(buffer.begin(), static_cast<std::string::size_type>(n));
		if (istr)
		{
			istr.read(buffer.begin(), bufferSize);
			n = istr.gcount();
		}
		else n = 0;
	}
	return len;
}
开发者ID:beneon,项目名称:MITK,代码行数:21,代码来源:StreamCopier.cpp


示例20: poco_assert

DateTime& DateTime::assign(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond)
{
	poco_assert (year >= 0 && year <= 9999);
	poco_assert (month >= 1 && month <= 12);
	poco_assert (day >= 1 && day <= daysOfMonth(year, month));
	poco_assert (hour >= 0 && hour <= 23);
	poco_assert (minute >= 0 && minute <= 59);
	poco_assert (second >= 0 && second <= 59);
	poco_assert (millisecond >= 0 && millisecond <= 999);
	poco_assert (microsecond >= 0 && microsecond <= 999);

	_utcTime     = toUtcTime(toJulianDay(year, month, day)) + 10*(hour*Timespan::HOURS + minute*Timespan::MINUTES + second*Timespan::SECONDS + millisecond*Timespan::MILLISECONDS + microsecond);
	_year        = year;
	_month       = month;
	_day         = day;
	_hour        = hour;
	_minute      = minute;
	_second      = second;
	_millisecond = millisecond;
	_microsecond = microsecond;
	
	return *this;
}
开发者ID:RangelReale,项目名称:sandbox,代码行数:23,代码来源:DateTime.cpp



注:本文中的poco_assert函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ poco_assert_dbg函数代码示例发布时间:2022-05-30
下一篇:
C++ pnp_write_config函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap