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

C++ preload函数代码示例

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

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



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

示例1: __attribute__

/* Initialize module */
void __attribute__ ((constructor)) _init(void)
{
	int opt = 1;
	struct sockaddr_in sin;

	orig_sendto = preload("sendto");
	orig_recvfrom = preload("recvfrom");
	orig_setsockopt = preload("setsockopt");
	orig_bind = preload("bind");

	ctrl_socket = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
	if (ctrl_socket < 0) {
		printf ("Ajil lib failed to create control socket\n");
		exit (-1);
	}
	orig_setsockopt (ctrl_socket, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));

	memset (&sin, 0, sizeof(struct sockaddr_in));
	sin.sin_family = AF_INET;
	sin.sin_addr.s_addr = inet_addr(DADDRESS);
	sin.sin_port = htons(DPORT);

	if (connect (ctrl_socket, (struct sockaddr *) &sin, sizeof(struct sockaddr_in)) < 0) {
		printf ("Could not connect to Ajil daemon\n");
		exit (-1);
	} else {
		printf ("Connected to Ajil daemon\n");
		usleep (500);
		if (recv (ctrl_socket, (void *) &data_port, sizeof(uint16_t), 0) < 0) {
			printf ("Error receiving port number from daemon\n");
			exit (-1);
		}
	}
}
开发者ID:hussam,项目名称:ajil,代码行数:35,代码来源:ajillib.c


示例2: QObject

SlippyMapCache::SlippyMapCache()
: QObject(0), DownloadReply(0), DownloadBusy(false), theMap(0)
{
    baseUrl.setUrl("http://tile.openstreetmap.org");
    Download.setProxy(M_PREFS->getProxy(baseUrl));

    connect(&Download,SIGNAL(finished(QNetworkReply*)),this,SLOT(on_requestFinished(QNetworkReply*)));

    preload(Coord(0,0,0),":/Tiles/000.png");
    preload(Coord(0,0,1),":/Tiles/100.png");
    preload(Coord(0,1,1),":/Tiles/101.png");
    preload(Coord(1,0,1),":/Tiles/110.png");
    preload(Coord(1,1,1),":/Tiles/111.png");
}
开发者ID:chxyfish,项目名称:merkaartor,代码行数:14,代码来源:SlippyMapWidget.cpp


示例3: QObject

SlippyMapCache::SlippyMapCache()
: QObject(0), DownloadId(0), DownloadBusy(false), theMap(0)
{
    Download.setProxy(M_PREFS->getProxy(QUrl(QString("http://tile.openstreetmap.org"))));
    Download.setHost("tile.openstreetmap.org");

    DownloadBuffer.setBuffer(&DownloadData);
    DownloadBuffer.open(QIODevice::WriteOnly);
    connect(&Download,SIGNAL(requestFinished(int,bool)),this,SLOT(on_requestFinished(int, bool)));

    preload(Coord(0,0,0),":/Tiles/000.png");
    preload(Coord(0,0,1),":/Tiles/100.png");
    preload(Coord(0,1,1),":/Tiles/101.png");
    preload(Coord(1,0,1),":/Tiles/110.png");
    preload(Coord(1,1,1),":/Tiles/111.png");
}
开发者ID:Harpalus,项目名称:merkaartor,代码行数:16,代码来源:SlippyMapWidget.cpp


示例4:

__int64 binstream::read_int64( )
{
	if (pos>inbuffer-8) preload();
	__int64 i64=*((__int64*)&buffer[pos]);
	pos+=8;
	return i64;
}
开发者ID:alhunor,项目名称:projects,代码行数:7,代码来源:filesystems.cpp


示例5: read_int

int binstream::read_int( )
{
	if (pos>inbuffer-4) preload();
	int i= *((int*)&buffer[pos]);
	pos+=4;
	return i;
}
开发者ID:alhunor,项目名称:projects,代码行数:7,代码来源:filesystems.cpp


示例6: read_double

double binstream::read_double( )
{
	if (pos>inbuffer-8) preload();
	double d=*((double*)&buffer[pos]);
	pos+=8;
	return d;
}
开发者ID:alhunor,项目名称:projects,代码行数:7,代码来源:filesystems.cpp


示例7: readblock

int binstream::readblock(void* dataPtr, int len)
{
	if (pos>inbuffer-len) preload();
	memcpy(dataPtr, &buffer[pos], len);
	pos+=len;
	return len;
}
开发者ID:alhunor,项目名称:projects,代码行数:7,代码来源:filesystems.cpp


示例8: read_bool

bool binstream::read_bool( )
{
	if (pos>inbuffer-1) preload();
	bool b= *((bool*)&buffer[pos]);
	++pos;
	return b;
}
开发者ID:alhunor,项目名称:projects,代码行数:7,代码来源:filesystems.cpp


示例9: preload

void 
MMRDecoder::VLSource::shift(const int n)
{ 
  codeword<<=n;
  lowbits+=n;
  if (lowbits>=16)
    preload();
}
开发者ID:scootalootf2,项目名称:bookr-irshell,代码行数:8,代码来源:MMRDecoder.cpp


示例10: getchar

char binstream::getchar()
{
	if (pos>inbuffer || inbuffer==0) preload();
	char c=buffer[pos];
	pos++;
	if (unicode) pos++;
	return c;
}
开发者ID:alhunor,项目名称:projects,代码行数:8,代码来源:filesystems.cpp


示例11: Window

Options_Window::Options_Window() : 
Window(SCREEN_WIDTH, SCREEN_HEIGHT, "Options"),
tabs(*this),
content_area(*this)
{
  preload(10,10);

}
开发者ID:MisterZeus,项目名称:SNES-Tracker,代码行数:8,代码来源:Options_Window.cpp


示例12: preload

void HTMLResourcePreloader::takeAndPreload(PreloadRequestStream& r)
{
    PreloadRequestStream requests;
    requests.swap(r);

    for (PreloadRequestStream::iterator it = requests.begin(); it != requests.end(); ++it)
        preload(it->release());
}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:8,代码来源:HTMLResourcePreloader.cpp


示例13: openanswerfile

void PEAC:: openanswerfile()
{
    name= QFileDialog::getOpenFileName (this,"Browse Files","~/Desktop",("PEAC File (*.peac)"));
    preload();

   // ui->textEdit_2->append(list[0]);
    checkNA();
}
开发者ID:t27,项目名称:other-projects,代码行数:8,代码来源:peac.cpp


示例14: read_bigendianint

int binstream::read_bigendianint()
{
	if (pos>inbuffer-4) preload();
	int i= (unsigned char)buffer[pos++];
	i = (i<<8) + (unsigned char)buffer[pos++];
	i = (i<<8) + (unsigned char)buffer[pos++];
	i = (i<<8) + (unsigned char)buffer[pos++];
	return i;
}
开发者ID:alhunor,项目名称:projects,代码行数:9,代码来源:filesystems.cpp


示例15: preload

void ResourcePreloader::takeAndPreload(PreloadRequestStream& r)
{
    PreloadRequestStream requests;
    NetworkHintsInterfaceImpl networkHintsInterface;
    requests.swap(r);

    for (PreloadRequestStream::iterator it = requests.begin(); it != requests.end(); ++it)
        preload(it->release(), networkHintsInterface);
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:9,代码来源:ResourcePreloader.cpp


示例16: ReadDependentCB

static void
ReadDependentCB(const char *aDependentLib, bool do_preload)
{
    if (do_preload)
        preload(aDependentLib);
    (void) NSAddImage(aDependentLib,
                      NSADDIMAGE_OPTION_RETURN_ON_ERROR |
                      NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:9,代码来源:nsGlueLinkingOSX.cpp


示例17: flush

bool binstream::open(const wchar_t* filename)
{
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa365747(v=vs.85).aspx
	if (opened)
	{
		flush();
		CloseHandle(f);
	}

	inbuffer=0;
	pos=0;
	fileStream = true;

	if (buffersize<2)
		throw "Buffer should be at least 2 characters long.";
	if (writable)
	{
		f = CreateFileW( filename, 
			GENERIC_WRITE,
			0, // No sharing
			NULL,
			CREATE_ALWAYS, // 
			FILE_ATTRIBUTE_NORMAL,
			NULL);
	} else
	{
		f = CreateFileW( filename, 
			GENERIC_READ,
			0, // No sharing
			NULL,
			OPEN_EXISTING, // 
			FILE_ATTRIBUTE_NORMAL,
			NULL);
		if (GetLastError()==ERROR_FILE_NOT_FOUND )
		{
		failbit=true;
			throw "File not found.";
		}
	}
	if (!f)
	{			
		failbit=true;
		return false;
	}

	if (!buffer)
		buffer = new char[buffersize]; 
	preload();

	testforUnicode();

	opened=true;
	return true;
} // binstream::open(wchar_t* filename)
开发者ID:alhunor,项目名称:projects,代码行数:54,代码来源:filesystems.cpp


示例18: read_wchar

wchar_t* binstream::read_wchar( )
{
	wchar_t* wc; //shared ptr would be better
	int len=read_int();
	if (pos>inbuffer-len*2) preload();
	wc=new wchar_t[len+1];
	memcpy(wc,&buffer[pos], len*2);
	pos+=len*2;
	wc[len]=0;
	return wc;
}
开发者ID:alhunor,项目名称:projects,代码行数:11,代码来源:filesystems.cpp


示例19: preload

bool binstream::eof()
{
	if (pos<inbuffer)
		return false;
	
	if (!fileStream) return true; // end of the memory stream
	
	// read on more data if it is a file stream
	preload();
	return inbuffer==0;
}
开发者ID:alhunor,项目名称:projects,代码行数:11,代码来源:filesystems.cpp


示例20: read_char

char* binstream::read_char( )
{
	char* c; //shared ptr would be better
	int len=read_int();
	if (pos>inbuffer-len) preload();
	c=new char[len+1];
	memcpy(c,&buffer[pos], len);
	pos+=len;
	c[len]=0;
	return c;
}
开发者ID:alhunor,项目名称:projects,代码行数:11,代码来源:filesystems.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ preloader_console_init函数代码示例发布时间:2022-05-30
下一篇:
C++ preinit_state函数代码示例发布时间: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